view mod_traceback/mod_traceback.lua @ 4578:d95fcde6e39d

mod_measure_lua: add openmetrics-spirited way to collect lua memory use In the spirit of separate collectors found in other Prometheus packages, this is a separate module to collect metrics related to the lua stack itself.
author Jonas Schäfer <jonas@wielicki.name>
date Sat, 29 May 2021 12:12:17 +0200
parents 7a4e8dbbd30d
children
line wrap: on
line source

module:set_global();

local traceback = require "util.debug".traceback;

require"util.signal".signal(module:get_option_string(module.name, "SIGUSR1"), function ()
	module:log("info", "Received SIGUSR1, writing traceback");
	local f = io.open(prosody.paths.data.."/traceback.txt", "a+");
	f:write(traceback(), "\n");
	f:close();
end);