Allows num points to be specified in traffic reports

Fixes #5028
This commit is contained in:
Simone Mainardi 2021-02-10 13:10:50 +01:00
parent 149c1a0df1
commit d4a2c23ddb

View file

@ -129,14 +129,15 @@ end
-- ########################################################
function graph_utils.getProtoVolume(ifName, start_time, end_time)
function graph_utils.getProtoVolume(ifName, start_time, end_time, ts_options)
ifId = getInterfaceId(ifName)
local series = ts_utils.listSeries("iface:ndpi", {ifid=ifId}, start_time)
local series = ts_utils.listSeries("iface:ndpi", {ifid = ifId}, start_time)
ret = { }
for _, tags in ipairs(series or {}) do
-- NOTE: this could be optimized via a dedicated driver call
local data = ts_utils.query("iface:ndpi", tags, start_time, end_time)
local data = ts_utils.query("iface:ndpi", tags, start_time, end_time, ts_options)
if(data ~= nil) and (data.statistics.total > 0) then
ret[tags.protocol] = data.statistics.total