Skip to content

Commit

Permalink
Cortex should still send the request to upstream when Start == end
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Protasio <[email protected]>
  • Loading branch information
alanprot committed Sep 22, 2022
1 parent 42c68cd commit 2a6eb78
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/querier/tripperware/queryrange/split_by_interval.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func splitQuery(r tripperware.Request, interval time.Duration) ([]tripperware.Re
return nil, err
}
var reqs []tripperware.Request
for start := r.GetStart(); start < r.GetEnd(); start = nextIntervalBoundary(start, r.GetStep(), interval) + r.GetStep() {
for start := r.GetStart(); start <= r.GetEnd(); start = nextIntervalBoundary(start, r.GetStep(), interval) + r.GetStep() {
end := nextIntervalBoundary(start, r.GetStep(), interval)
if end+r.GetStep() >= r.GetEnd() {
end = r.GetEnd()
Expand Down
17 changes: 17 additions & 0 deletions pkg/querier/tripperware/queryrange/split_by_interval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,23 @@ func TestSplitQuery(t *testing.T) {
},
interval: day,
},
{
input: &PrometheusRequest{
Start: 60 * 60 * seconds,
End: 60 * 60 * seconds,
Step: 15 * seconds,
Query: "foo",
},
expected: []tripperware.Request{
&PrometheusRequest{
Start: 60 * 60 * seconds,
End: 60 * 60 * seconds,
Step: 15 * seconds,
Query: "foo",
},
},
interval: day,
},
{
input: &PrometheusRequest{
Start: 0,
Expand Down

0 comments on commit 2a6eb78

Please sign in to comment.