Browse Source

Backfill: Do not query after --end (#9340)

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
pull/9364/head
Julien Pivotto 3 years ago committed by GitHub
parent
commit
bd217c58a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      cmd/promtool/rules.go

6
cmd/promtool/rules.go

@ -105,11 +105,15 @@ func (importer *ruleImporter) importRule(ctx context.Context, ruleExpr, ruleName
for startWithAlignment.Unix() < currStart {
startWithAlignment = startWithAlignment.Add(grp.Interval())
}
end := time.Unix(min(endOfBlock/int64(time.Second/time.Millisecond), end.Unix()), 0).UTC()
if end.Before(startWithAlignment) {
break
}
val, warnings, err := importer.apiClient.QueryRange(ctx,
ruleExpr,
v1.Range{
Start: startWithAlignment,
End: time.Unix(min(endOfBlock/int64(time.Second/time.Millisecond), end.Unix()), 0).UTC(),
End: end,
Step: grp.Interval(),
},
)

Loading…
Cancel
Save