Commit 0f453309 authored by Marek Vavrusa's avatar Marek Vavrusa
Browse files

modules/http: some metrics are treated as gauges

parent ae9113ce
local cqueues = require('cqueues') local cqueues = require('cqueues')
local snapshots, snapshots_count = {}, 120 local snapshots, snapshots_count = {}, 120
-- Gauge metrics
local gauges = {
['worker.concurrent'] = true,
}
-- Load dependent modules -- Load dependent modules
if not stats then modules.load('stats') end if not stats then modules.load('stats') end
...@@ -23,7 +28,11 @@ local function snapshot_start(h, ws) ...@@ -23,7 +28,11 @@ local function snapshot_start(h, ws)
-- Get current snapshot -- Get current snapshot
local cur, stats_dt = getstats(), {} local cur, stats_dt = getstats(), {}
for k,v in pairs(cur) do for k,v in pairs(cur) do
stats_dt[k] = v - (prev[k] or 0) if gauges[k] then
stats_dt[k] = v
else
stats_dt[k] = v - (prev[k] or 0)
end
is_empty = is_empty and stats_dt[k] == 0 is_empty = is_empty and stats_dt[k] == 0
end end
prev = cur prev = cur
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment