Skip to content

Commit

Permalink
Set LookbackDelta on VectorSelectors from NodeReplacer
Browse files Browse the repository at this point in the history
With this option we can configure promql to not select previous points
on certain VectorSelectors when iterating. This is important as we have
pulled the data from another promql interface and as such don't want to
re-do the full LookbackDelta when selecting within the vector.

Fixes #298
  • Loading branch information
jacksontj committed May 14, 2020
1 parent 6f84319 commit f8bae29
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkg/proxystorage/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ func (p *ProxyStorage) NodeReplacer(ctx context.Context, s *promql.EvalStmt, nod
var warnings api.Warnings
var err error
if s.Interval > 0 {
n.LookbackDelta = s.Interval - time.Duration(1)
result, warnings, err = state.client.QueryRange(ctx, n.String(), v1.Range{
Start: s.Start.Add(-offset),
End: s.End.Add(-offset),
Expand Down
16 changes: 12 additions & 4 deletions vendor/github.com/prometheus/prometheus/promql/ast.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/prometheus/prometheus/promql/engine.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f8bae29

Please sign in to comment.