From 1f98dc7f4c28c8f3e5a039790bd73446d7cac9d0 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Thu, 23 Sep 2021 13:43:33 +0300 Subject: [PATCH] Skip alignment only if item interval twice less than query interval --- pkg/datasource/zabbix.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/datasource/zabbix.go b/pkg/datasource/zabbix.go index 7d3298b..5c5e589 100644 --- a/pkg/datasource/zabbix.go +++ b/pkg/datasource/zabbix.go @@ -125,8 +125,9 @@ func (ds *ZabbixDatasourceInstance) applyDataProcessing(ctx context.Context, que } else { for _, s := range series { // Skip unnecessary data alignment if item interval less than query interval - // because data will be downsampled in this case - if s.Meta.Interval != nil && *s.Meta.Interval > query.Interval { + // because data will be downsampled in this case. 2 multiplier used to prevent situations when query and item + // intervals are the same, but downsampling will be performed (query interval is rounded value of time range / max data points). + if s.Meta.Interval != nil && *s.Meta.Interval*2 > query.Interval { s.TS = s.TS.Align(*s.Meta.Interval) } }