Skip to content

Commit

Permalink
Override the LookbackDelta for Interval queries with NodeReplaced data
Browse files Browse the repository at this point in the history
Since we already did a query of a downstream (in some aggregate) we
don't want to apply any LookbackDelta ranges to this (as it was already
computed). This avoids the behavior where a response will "repeat" the
last result seen for the duration of the LookbackDelta.

Fixes #606
  • Loading branch information
jacksontj committed Aug 14, 2023
1 parent e797e5d commit 1063ec6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/proxystorage/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,9 @@ func (p *ProxyStorage) NodeReplacer(ctx context.Context, s *parser.EvalStmt, nod
}

ret := &parser.VectorSelector{OriginalOffset: offset}
if s.Interval > 0 {
ret.LookbackDelta = s.Interval - time.Duration(1)
}
ret.UnexpandedSeriesSet = proxyquerier.NewSeriesSet(series, promhttputil.WarningsConvert(warnings), err)

// Replace with sum(count_values()) BY (label)
Expand Down Expand Up @@ -571,6 +574,9 @@ func (p *ProxyStorage) NodeReplacer(ctx context.Context, s *parser.EvalStmt, nod
}

ret := &parser.VectorSelector{OriginalOffset: offset}
if s.Interval > 0 {
ret.LookbackDelta = s.Interval - time.Duration(1)
}
ret.UnexpandedSeriesSet = proxyquerier.NewSeriesSet(series, promhttputil.WarningsConvert(warnings), err)
n.Expr = ret

Expand Down Expand Up @@ -616,6 +622,9 @@ func (p *ProxyStorage) NodeReplacer(ctx context.Context, s *parser.EvalStmt, nod
}

ret := &parser.VectorSelector{OriginalOffset: offset}
if s.Interval > 0 {
ret.LookbackDelta = s.Interval - time.Duration(1)
}
ret.UnexpandedSeriesSet = proxyquerier.NewSeriesSet(series, promhttputil.WarningsConvert(warnings), err)

// Some functions require specific handling which we'll catch here
Expand Down

0 comments on commit 1063ec6

Please sign in to comment.