Skip to content

PromQL: add support for implicit range selectors #142557

Merged
felixbarny merged 11 commits intoelastic:mainfrom
felixbarny:promql-default-range-vector
Feb 18, 2026
Merged

PromQL: add support for implicit range selectors #142557
felixbarny merged 11 commits intoelastic:mainfrom
felixbarny:promql-default-range-vector

Conversation

@felixbarny
Copy link
Copy Markdown
Member

@felixbarny felixbarny commented Feb 16, 2026

This PR adds implicit range selector support for PromQL range-vector functions and extends that behavior with a configurable scrape_interval parameter.

Queries like rate(metric) are now supported by internally rewriting selector arguments to an implicit range selector and resolving the concrete window during PromQL-to-ESQL translation.

It adds scrape_interval as a PROMQL command parameter with a default of 1m and positive-duration validation, and resolves implicit windows using window = max(step, scrape_interval).

The user impact is that PromQL queries in ES|QL are easier to run without hand-tuning every range selector, especially in Kibana where users frequently switch between different date ranges. This makes dashboards and ad-hoc analysis more resilient as the selected time window changes. A planned follow-up (edit: #142580) will automatically determine step from the selected time range, which makes queries more adaptive to the selected time range and further reduces the need for manual tuning.

Non-selector instant vectors remain rejected where a range vector is required, for example rate(avg(foo)).

@felixbarny felixbarny self-assigned this Feb 16, 2026
@felixbarny felixbarny added >non-issue :StorageEngine/ES|QL Timeseries / metrics / PromQL / logsdb capabilities in ES|QL labels Feb 16, 2026
@elasticsearchmachine elasticsearchmachine added v9.4.0 external-contributor Pull request authored by a developer outside the Elasticsearch team Team:StorageEngine labels Feb 16, 2026
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

@felixbarny felixbarny requested a review from kkrik-es February 17, 2026 16:55
@felixbarny
Copy link
Copy Markdown
Member Author

felixbarny commented Feb 17, 2026

@stratoula fyi: this will add a scrape_interval (default: 1m) parameter make it possible to use an instant selector in places that expect a range_vector. Could you add support for this in Kibana once the PR is merged?

@felixbarny felixbarny enabled auto-merge (squash) February 18, 2026 06:46
@felixbarny felixbarny merged commit 22a4df0 into elastic:main Feb 18, 2026
35 checks passed
@felixbarny felixbarny deleted the promql-default-range-vector branch February 18, 2026 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contributor Pull request authored by a developer outside the Elasticsearch team >non-issue :StorageEngine/ES|QL Timeseries / metrics / PromQL / logsdb capabilities in ES|QL Team:StorageEngine v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants