mod_prometheus/mod_prometheus.lua
changeset 4546 fb4a50bf60f1
parent 3956 343dc9dd70dd
child 4548 64fa2dd34d43
--- a/mod_prometheus/mod_prometheus.lua	Sun Apr 11 21:59:50 2021 +0200
+++ b/mod_prometheus/mod_prometheus.lua	Tue Apr 13 23:53:53 2021 +0200
@@ -11,7 +11,8 @@
 local t_insert = table.insert;
 local t_concat = table.concat;
 local socket = require "socket";
-local get_stats = require "core.statsmanager".get_stats;
+local statsman = require "core.statsmanager";
+local get_stats = statsman.get_stats;
 
 local function escape(text)
 	return text:gsub("\\", "\\\\"):gsub("\"", "\\\""):gsub("\n", "\\n");
@@ -126,6 +127,9 @@
 local function get_metrics(event)
 	local response = event.response;
 	response.headers.content_type = "text/plain; version=0.0.4";
+	if statsman.collect then
+		statsman.collect()
+	end
 
 	local answer = {};
 	for key, fields in pairs(parse_stats()) do