diff --git a/internal/cortex/querier/queryrange/split_by_interval.go b/internal/cortex/querier/queryrange/split_by_interval.go index 2db7edceaf..9899b7ecbd 100644 --- a/internal/cortex/querier/queryrange/split_by_interval.go +++ b/internal/cortex/querier/queryrange/split_by_interval.go @@ -70,6 +70,11 @@ func (s splitByInterval) Do(ctx context.Context, r Request) (Response, error) { } func splitQuery(r Request, interval time.Duration) ([]Request, error) { + // If Start == end we should just run the original request. + if r.GetStart() == r.GetEnd() { + return []Request{r}, nil + } + // Replace @ modifier function to their respective constant values in the query. // This way subqueries will be evaluated at the same time as the parent query. query, err := evaluateAtModifierFunction(r.GetQuery(), r.GetStart(), r.GetEnd()) diff --git a/internal/cortex/querier/queryrange/split_by_interval_test.go b/internal/cortex/querier/queryrange/split_by_interval_test.go index fe32b71dfb..b4b5bf8013 100644 --- a/internal/cortex/querier/queryrange/split_by_interval_test.go +++ b/internal/cortex/querier/queryrange/split_by_interval_test.go @@ -85,6 +85,23 @@ func TestSplitQuery(t *testing.T) { }, interval: day, }, + { + input: &PrometheusRequest{ + Start: 60 * 60 * seconds, + End: 60 * 60 * seconds, + Step: 15 * seconds, + Query: "foo", + }, + expected: []Request{ + &PrometheusRequest{ + Start: 60 * 60 * seconds, + End: 60 * 60 * seconds, + Step: 15 * seconds, + Query: "foo", + }, + }, + interval: day, + }, { input: &PrometheusRequest{ Start: 0,