Skip to content

Commit

Permalink
Skip alignment only if item interval twice less than query interval
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderzobnin committed Sep 23, 2021
1 parent d46b9c9 commit 1f98dc7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/datasource/zabbix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down

0 comments on commit 1f98dc7

Please sign in to comment.