Software /
code /
prosody
Comparison
util/openmetrics.lua @ 12584:fb0bf0a0864f 0.12
luacheck: Shut up (backports 3caff1f93520, ignores module deleted in trunk)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 30 May 2022 17:34:58 +0200 |
parent | 12387:05c250fa335a |
child | 12535:7ef7abb72cdd |
comparison
equal
deleted
inserted
replaced
12582:e72bb50456c4 | 12584:fb0bf0a0864f |
---|---|
36 -- on metrics created in non-global modules. | 36 -- on metrics created in non-global modules. |
37 local metric_proxy_mt = {} | 37 local metric_proxy_mt = {} |
38 metric_proxy_mt.__index = metric_proxy_mt | 38 metric_proxy_mt.__index = metric_proxy_mt |
39 | 39 |
40 local function new_metric_proxy(metric_family, with_labels_proxy_fun) | 40 local function new_metric_proxy(metric_family, with_labels_proxy_fun) |
41 return { | 41 return setmetatable({ |
42 _family = metric_family, | 42 _family = metric_family, |
43 with_labels = function(self, ...) | 43 with_labels = function(self, ...) |
44 return with_labels_proxy_fun(self._family, ...) | 44 return with_labels_proxy_fun(self._family, ...) |
45 end; | 45 end; |
46 with_partial_label = function(self, label) | 46 with_partial_label = function(self, label) |
47 return new_metric_proxy(self._family, function(family, ...) | 47 return new_metric_proxy(self._family, function(family, ...) |
48 return family:with_labels(label, ...) | 48 return family:with_labels(label, ...) |
49 end) | 49 end) |
50 end | 50 end |
51 } | 51 }, metric_proxy_mt); |
52 end | 52 end |
53 | 53 |
54 -- END of Utility: "metric proxy" | 54 -- END of Utility: "metric proxy" |
55 | 55 |
56 -- BEGIN Rendering helper functions (internal) | 56 -- BEGIN Rendering helper functions (internal) |