Fix invalid upsampling due to missing points in composed charts

This commit is contained in:
emanuele-f 2019-11-14 20:03:07 +01:00
parent bea63668b8
commit 4628ad3bcd
2 changed files with 5 additions and 2 deletions

View file

@ -496,7 +496,9 @@ local function influx2Series(schema, tstart, tend, tags, options, data, time_ste
-- Fill the missing points at the end
while((tend - next_t) >= 0) do
if(next_t > last_ts) then
-- NOTE: fill_series is required for composed charts. In such case,
-- not filling the serie would result into an incorrect upsampling
if((not options.fill_series) and (next_t > last_ts)) then
-- skip values exceeding the last point
break
end

View file

@ -282,6 +282,7 @@ function ts_utils.getQueryOptions(overrides)
initial_point = false, -- add an extra initial point, not accounted in statistics but useful for drawing graphs
with_series = false, -- in topk query, if true, also get top items series data
no_timeout = true, -- do not abort queries automatically by default
fill_series = false, -- if true, filling missing points is required
}, overrides or {})
end
@ -480,7 +481,7 @@ function ts_utils.queryTopk(schema_name, tags, tstart, tend, options)
top_items.series = {}
-- Query the top items data
local options = table.merge(query_options, {calculate_stats = false})
local options = table.merge(query_options, {calculate_stats = false, fill_series = true})
local count = 0
local step = nil
local raw_step = nil