comparison mod_measure_storage/mod_measure_storage.lua @ 2702:caabb980d1d8

Merge commit
author tmolitor <thilo@eightysoft.de>
date Mon, 24 Apr 2017 20:57:23 +0200
parents 04ae5b45e6c7
children
comparison
equal deleted inserted replaced
2701:d96831e46b64 2702:caabb980d1d8
12 if opt_use_tags then 12 if opt_use_tags then
13 metric_name, metric_tags = "storage_operation", ("store_name:%s,store_type:%s,store_operation:%s"):format(store_name, store_type, method_name); 13 metric_name, metric_tags = "storage_operation", ("store_name:%s,store_type:%s,store_operation:%s"):format(store_name, store_type, method_name);
14 else 14 else
15 metric_name = store_name.."_"..store_type.."_"..method_name; 15 metric_name = store_name.."_"..store_type.."_"..method_name;
16 end 16 end
17 local measure_operation_started = module:measure(metric_name, metric_tags); 17 local measure_operation_started = module:measure(metric_name, "times", metric_tags);
18 18
19 return function (...) 19 return function (...)
20 module:log("debug", "Measuring storage operation %s (%s)", metric_name, metric_tags or "no tags"); 20 module:log("debug", "Measuring storage operation %s (%s)", metric_name, metric_tags or "no tags");
21 local measure_operation_complete = measure_operation_started(); 21 local measure_operation_complete = measure_operation_started();
22 return return_args_after_calling(measure_operation_complete, method_function(...)); 22 return return_args_after_calling(measure_operation_complete, method_function(...));
41 return new_store; 41 return new_store;
42 end 42 end
43 43
44 local function hook_event(module) 44 local function hook_event(module)
45 module:hook("store-opened", function(event) 45 module:hook("store-opened", function(event)
46 event.store = wrap_store(module, event.store_name, event.store_type, event.store); 46 event.store = wrap_store(module, event.store_name, event.store_type or "keyval", event.store);
47 end); 47 end);
48 end 48 end
49 49
50 function module.load() 50 function module.load()
51 hook_event(module); 51 hook_event(module);