From 677d77e82e0bae7d8d94c910df07ad82fdbcab6d Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Mon, 30 May 2022 17:37:25 +0200
Subject: util.openmetrics: Set __name field on metatables to improve error
 messages

Don't think we cause any such errors right now, but you never know!
---
 util/openmetrics.lua | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'util')

diff --git a/util/openmetrics.lua b/util/openmetrics.lua
index c18e63e9..634f9de1 100644
--- a/util/openmetrics.lua
+++ b/util/openmetrics.lua
@@ -35,6 +35,7 @@ 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)
@@ -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)
-- 
cgit v1.2.3