Comparison

util/statsd.lua @ 10924:0c072dd69603

util.statsd: Update for API change See change d75d805c852f to util.statistics
author Kim Alvefur <zash@zash.se>
date Thu, 11 Jun 2020 22:02:54 +0200
parent 7988:dc758422d896
child 11523:5f15ab7c6ae5
comparison
equal deleted inserted replaced
10923:dff1aebd0f2b 10924:0c072dd69603
36 return send_metric(name..":"..tostring(sample).."|h"); 36 return send_metric(name..":"..tostring(sample).."|h");
37 end 37 end
38 38
39 local methods; 39 local methods;
40 methods = { 40 methods = {
41 amount = function (name, initial) 41 amount = function (name, conf)
42 if initial then 42 if conf and conf.initial then
43 send_gauge(name, initial); 43 send_gauge(name, conf.initial);
44 end 44 end
45 return function (new_v) send_gauge(name, new_v); end 45 return function (new_v) send_gauge(name, new_v); end
46 end; 46 end;
47 counter = function (name, initial) --luacheck: ignore 212/initial 47 counter = function (name, conf) --luacheck: ignore 212/conf
48 return function (delta) 48 return function (delta)
49 send_gauge(name, delta, true); 49 send_gauge(name, delta, true);
50 end; 50 end;
51 end; 51 end;
52 rate = function (name) 52 rate = function (name)
53 return function () 53 return function ()
54 send_counter(name, 1); 54 send_counter(name, 1);
55 end; 55 end;
56 end; 56 end;
57 distribution = function (name, unit, type) --luacheck: ignore 212/unit 212/type 57 distribution = function (name, conf) --luacheck: ignore 212/conf
58 return function (value) 58 return function (value)
59 send_histogram_sample(name, value); 59 send_histogram_sample(name, value);
60 end; 60 end;
61 end; 61 end;
62 sizes = function (name) 62 sizes = function (name)