aboutsummaryrefslogtreecommitdiffstats
path: root/util/openmetrics.lua
diff options
context:
space:
mode:
Diffstat (limited to 'util/openmetrics.lua')
-rw-r--r--util/openmetrics.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/util/openmetrics.lua b/util/openmetrics.lua
index cb7791ec..634f9de1 100644
--- a/util/openmetrics.lua
+++ b/util/openmetrics.lua
@@ -35,10 +35,11 @@ local t_pack, t_unpack = require "util.table".pack, table.unpack or unpack; --lu
-- `with_partial_label` by the moduleapi in order to pre-set the `host` label
-- on metrics created in non-global modules.
local metric_proxy_mt = {}
+metric_proxy_mt.__name = "metric_proxy"
metric_proxy_mt.__index = metric_proxy_mt
local function new_metric_proxy(metric_family, with_labels_proxy_fun)
- return {
+ return setmetatable({
_family = metric_family,
with_labels = function(self, ...)
return with_labels_proxy_fun(self._family, ...)
@@ -48,7 +49,7 @@ local function new_metric_proxy(metric_family, with_labels_proxy_fun)
return family:with_labels(label, ...)
end)
end
- }
+ }, metric_proxy_mt);
end
-- END of Utility: "metric proxy"
@@ -128,6 +129,7 @@ end
-- BEGIN of generic MetricFamily implementation
local metric_family_mt = {}
+metric_family_mt.__name = "metric_family"
metric_family_mt.__index = metric_family_mt
local function histogram_metric_ctor(orig_ctor, buckets)
@@ -278,6 +280,7 @@ local function compose_name(name, unit)
end
local metric_registry_mt = {}
+metric_registry_mt.__name = "metric_registry"
metric_registry_mt.__index = metric_registry_mt
local function new_metric_registry(backend)