util/openmetrics.lua
changeset 11604 a02c277eb97a
parent 11597 0db763f3f3be
child 11933 85d51bfcf56b
--- a/util/openmetrics.lua	Thu Jan 21 23:13:37 2021 +0100
+++ b/util/openmetrics.lua	Mon Jun 14 11:19:42 2021 +0100
@@ -25,6 +25,7 @@
 local log = require "util.logger".init("util.openmetrics");
 local new_multitable = require "util.multitable".new;
 local iter_multitable = require "util.multitable".iter;
+local t_pack, t_unpack = require "util.table".pack, table.unpack or unpack; --luacheck: ignore 113/unpack
 
 -- BEGIN of Utility: "metric proxy"
 -- This allows to wrap a MetricFamily in a proxy which only provides the
@@ -129,10 +130,10 @@
 	end
 	local metric = self.data:get(...)
 	if not metric then
-		local values = table.pack(...)
+		local values = t_pack(...)
 		metric = self:new_metric(values)
 		values[values.n+1] = metric
-		self.data:set(table.unpack(values, 1, values.n+1))
+		self.data:set(t_unpack(values, 1, values.n+1))
 	end
 	return metric
 end
@@ -159,9 +160,9 @@
 	for i=1,nlabels do
 		searchkeys[i] = nil;
 	end
-	local it, state = iter_multitable(self.data, table.unpack(searchkeys, 1, nlabels))
+	local it, state = iter_multitable(self.data, t_unpack(searchkeys, 1, nlabels))
 	return function(_s)
-		local label_values = table.pack(it(_s))
+		local label_values = t_pack(it(_s))
 		if label_values.n == 0 then
 			return nil, nil
 		end