Diff

mod_prometheus/mod_prometheus.lua @ 3128:a34e7bd87b39

mod_prometheus: Optimise global lookups.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 21 Jun 2018 22:15:15 +0200
parent 3127:36770ae1148f
child 3131:ddd39ca7b953
line wrap: on
line diff
--- a/mod_prometheus/mod_prometheus.lua	Thu Jun 21 22:14:12 2018 +0200
+++ b/mod_prometheus/mod_prometheus.lua	Thu Jun 21 22:15:15 2018 +0200
@@ -7,8 +7,10 @@
 module:set_global();
 module:depends "http";
 
+local tostring = tostring;
 local s_format = string.format;
 local t_insert = table.insert;
+local t_concat = table.concat;
 local socket = require "socket";
 local mt = require "util.multitable";
 
@@ -54,7 +56,7 @@
 	if #values == 0 then
 		return "";
 	end
-	return "{"..table.concat(values, ", ").."}";
+	return "{"..t_concat(values, ", ").."}";
 end
 
 local function repr_sample(metric, labels, value, timestamp)
@@ -112,7 +114,7 @@
 			t_insert(answer, repr_sample(name, {}, value, timestamp));
 		end
 	end
-	return table.concat(answer, "");
+	return t_concat(answer, "");
 end
 
 function module.add_host(module)