Add debug msg

This commit is contained in:
Alfredo Cardigliano 2023-10-31 09:17:43 +01:00
parent 207b3e9221
commit f1d3b473b4

View file

@ -724,7 +724,15 @@ local function delta_val(reg, metric_name, granularity, curr_val, skip_first)
local key = string.format("%s:%s", metric_name, granularity_num)
-- Read cached value and purify it
local prev_val = tonumber(reg.getCachedAlertValue(key, granularity_num))
local prev_val
local prev = reg.getCachedAlertValue(key, granularity_num)
if prev == nil or type(prev) ~= "number" then -- Safety check and debug
traceError(TRACE_ERROR, TRACE_CONSOLE, "Bad prev val")
tprint(prev)
tprint(debug.traceback())
else
prev_val = tonumber(prev)
end
-- Save the value for the next round
reg.setCachedAlertValue(key, tostring(curr_val), granularity_num)