mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 15:39:33 +00:00
Return 0 filled points instead of nil when no data is available on InfluxDB
This behaviour makes InfluxDB consistent with the RRD driver
This commit is contained in:
parent
78a457e731
commit
f82a8e9767
9 changed files with 99 additions and 58 deletions
|
|
@ -159,4 +159,39 @@ end
|
|||
|
||||
-- ##############################################
|
||||
|
||||
function ts_common.calculateSampledTimeStep(schema, tstart, tend, options)
|
||||
local estimed_num_points = math.ceil((tend - tstart) / schema.options.step)
|
||||
local time_step = schema.options.step
|
||||
|
||||
if estimed_num_points > options.max_num_points then
|
||||
-- downsample
|
||||
local num_samples = math.ceil(estimed_num_points / options.max_num_points)
|
||||
time_step = num_samples * schema.options.step
|
||||
end
|
||||
|
||||
return time_step
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
function ts_common.fillSeries(schema, tstart, tend, time_step, fill_value)
|
||||
local count = math.ceil((tend-tstart) / time_step)
|
||||
local res = {}
|
||||
|
||||
for idx, metric in ipairs(schema._metrics) do
|
||||
local data = {}
|
||||
|
||||
for i=1, count do
|
||||
data[i] = fill_value
|
||||
i = i + 1
|
||||
end
|
||||
|
||||
res[idx] = {label=metric, data=data}
|
||||
end
|
||||
|
||||
return res, count
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
return ts_common
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue