Skip to content

Add parameter support in PromQL query durations#139873

Merged
felixbarny merged 8 commits intoelastic:mainfrom
pirzada-ahmadfaraz:fix/promql-parameter-support
Jan 12, 2026
Merged

Add parameter support in PromQL query durations#139873
felixbarny merged 8 commits intoelastic:mainfrom
pirzada-ahmadfaraz:fix/promql-parameter-support

Conversation

@pirzada-ahmadfaraz
Copy link
Copy Markdown
Contributor

Fixes #139508

Parameters like ?_step or ?1 now work inside PromQL durations: PROMQL step=?_step rate(foo[?_step])

Changes:

  • Add NAMED_OR_POSITIONAL_PARAM token to PromqlBaseLexer.g4
  • Update timeValue rule in PromqlBaseParser.g4 to accept parameters
  • Add parameter resolution in PromqlExpressionBuilder
  • Pass QueryParams through the parser chain
  • Have you signed the contributor license agreement?
  • Have you followed the contributor guidelines?
  • If submitting code, have you built your formula locally prior to submission with gradle check?
  • If submitting code, is your pull request against main? Unless there is a good reason otherwise, we prefer pull requests against main and will backport as needed.
  • If submitting code, have you checked that your submission is for an OS and architecture that we support?
  • If you are submitting this code for a class then read our policy for that.

Fixes elastic#139508

Parameters like ?_step or ?1 now work inside PromQL durations:
PROMQL step=?_step rate(foo[?_step])

Changes:
- Add NAMED_OR_POSITIONAL_PARAM token to PromqlBaseLexer.g4
- Update timeValue rule in PromqlBaseParser.g4 to accept parameters
- Add parameter resolution in PromqlExpressionBuilder
- Pass QueryParams through the parser chain
@cla-checker-service
Copy link
Copy Markdown

cla-checker-service bot commented Dec 21, 2025

💚 CLA has been signed

@elasticsearchmachine elasticsearchmachine added v9.4.0 external-contributor Pull request authored by a developer outside the Elasticsearch team needs:triage Requires assignment of a team area label labels Dec 21, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Dec 23, 2025
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

@elasticsearchmachine elasticsearchmachine removed the needs:triage Requires assignment of a team area label label Dec 23, 2025
@felixbarny felixbarny added :StorageEngine/ES|QL Timeseries / metrics / PromQL / logsdb capabilities in ES|QL and removed :Analytics/ES|QL AKA ESQL labels Jan 8, 2026
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

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

@elasticsearchmachine elasticsearchmachine removed the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Jan 8, 2026
@felixbarny felixbarny self-assigned this Jan 8, 2026
Copy link
Copy Markdown
Member

@felixbarny felixbarny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for your contribution and sorry for the delay. The issue has been assigned to the wrong team initially. The approach looks good to me. I've left a few comments.

@felixbarny
Copy link
Copy Markdown
Member

@elasticmachine test this please

@felixbarny
Copy link
Copy Markdown
Member

@elasticmachine test this please

@felixbarny felixbarny merged commit 8ba0817 into elastic:main Jan 12, 2026
36 checks passed
szybia added a commit to szybia/elasticsearch that referenced this pull request Jan 12, 2026
…i-project-tests

* upstream/main: (23 commits)
  Fix `testAckListenerReceivesNacksIfPublicationTimesOut` (elastic#140514)
  Reduce priority of clear-cache tasks (elastic#139685)
  Add docs and tests about `StreamOutput` to memory (elastic#140365)
  ES|QL - dense_vector support for COUNT, PRESENT, ABSENT aggregator functions (elastic#139914)
  Add release notes for v9.2.4 release (elastic#140487)
  Add release notes for v9.1.10 release (elastic#140488)
  Add conncectors release notes for 9.1.10, 9.2.4 (elastic#140499)
  Add parameter support in PromQL query durations (elastic#139873)
  Improve testing of STS credentials reloading (elastic#140114)
  Fix zstd native binary publishing script to support newer versions (elastic#140485)
  Add FlattenedFieldBinaryVsSortedSetDocValuesSyntheticSourceIT (elastic#140489)
  Store fallback match only text fields in binary doc values (elastic#140189)
  [DiskBBQ] Use the new merge executor for intra-merge parallelism (elastic#139942)
  ESQL: introduce support for mapping-unavailable fields (elastic#140463)
  Add ESNextOSQVectorsScorerTests (elastic#140436)
  Disable high cardinality tests on release builds (elastic#140503)
  ESQL: TRange timezone support (elastic#139911)
  Directly compressing `StreamOutput` (elastic#140502)
  ES|QL - fix dense vector enrich bug (elastic#139774)
  Use CrossProjectModeDecider in RemoteClusterService (elastic#140481)
  ...
spinscale pushed a commit to spinscale/elasticsearch that referenced this pull request Jan 21, 2026
Fixes elastic#139508

Parameters like ?_step or ?1 now work inside PromQL durations:
PROMQL step=?_step rate(foo[?_step])

Changes:
- Add NAMED_OR_POSITIONAL_PARAM token to PromqlBaseLexer.g4
- Update timeValue rule in PromqlBaseParser.g4 to accept parameters
- Add parameter resolution in PromqlExpressionBuilder
- Pass QueryParams through the parser chain

---------

Co-authored-by: Felix Barnsteiner <felix.barnsteiner@elastic.co>
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.

PromQL: add support for parameters in PromQL query

4 participants