Mercurial > prosody-hg
comparison util/statsd.lua @ 11200:bf8f2da84007
Merge 0.11->trunk
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 05 Nov 2020 22:31:25 +0100 |
| parents | 0c072dd69603 |
| children | 5f15ab7c6ae5 |
comparison
equal
deleted
inserted
replaced
| 11199:6c7c50a4de32 | 11200:bf8f2da84007 |
|---|---|
| 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) |
