Add PrometheusSeriesPlanBuilder for series endpoint#144493
Merged
felixbarny merged 10 commits intoelastic:mainfrom Mar 30, 2026
Merged
Add PrometheusSeriesPlanBuilder for series endpoint#144493felixbarny merged 10 commits intoelastic:mainfrom
felixbarny merged 10 commits intoelastic:mainfrom
Conversation
Collaborator
|
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
This was referenced Mar 18, 2026
c004c21 to
e7fe3a3
Compare
sidosera
reviewed
Mar 24, 2026
...theus/src/main/java/org/elasticsearch/xpack/prometheus/rest/PrometheusSeriesPlanBuilder.java
Outdated
Show resolved
Hide resolved
Contributor
|
@felixbarny Could you please add more context why do we need this? IIUC this is for prometheus compatible APIs to read metric metadata (https://prometheus.io/docs/prometheus/latest/querying/api/#finding-series-by-label-matchers)? |
Member
Author
|
Yes, more context on the PR that adds the rest action: #144494 |
Extend the prometheus plugin with compile-time dependencies on x-pack-esql, x-pack-esql-core, and esql:compute so that the series endpoint can build and execute ESQL logical plans.
PrometheusSeriesPlanBuilder translates a Prometheus series selector into an ESQL logical plan that fetches matching label combinations. Also extends TranslatePromqlToEsqlPlan to expose the plan-building logic needed by the series endpoint.
Shared logic (tsSource, filterExpression, buildSelectorCondition, etc.) moved to a new PrometheusPlanBuilderUtils utility class so it can be reused by the upcoming labels plan builder.
e7fe3a3 to
2bc5e05
Compare
kkrik-es
reviewed
Mar 25, 2026
.../src/test/java/org/elasticsearch/xpack/prometheus/rest/PrometheusSeriesPlanBuilderTests.java
Outdated
Show resolved
Hide resolved
kkrik-es
approved these changes
Mar 25, 2026
Contributor
kkrik-es
left a comment
There was a problem hiding this comment.
Please wait for Sergey to stamp too.
This was referenced Mar 26, 2026
sidosera
approved these changes
Mar 27, 2026
sidosera
reviewed
Mar 27, 2026
...theus/src/main/java/org/elasticsearch/xpack/prometheus/rest/PrometheusSeriesPlanBuilder.java
Outdated
Show resolved
Hide resolved
- When limit=0 (unlimited), always emit an explicit Limit(Integer.MAX_VALUE) so that ESQL's AddImplicitLimit rule sees an existing node and does not silently inject its own 1 000-row default with a warning header. - When limit>0, use limit+1 as a sentinel so the response listener can detect truncation: if ESQL returns exactly limit+1 rows the result was truncated, a warnings field is added, and the extra row is stripped. - Add limit field to PrometheusSeriesResponseListener constructor; extract buildSuccessResponse as a static package-private method for testability. - Update plan-builder and response-listener unit tests accordingly.
felixbarny
added a commit
to felixbarny/elasticsearch
that referenced
this pull request
Mar 30, 2026
PrometheusSeriesPlanBuilder translates a Prometheus series selector into an ESQL logical plan that fetches matching label combinations. Also extends TranslatePromqlToEsqlPlan to expose the plan-building logic needed by the series endpoint.
mamazzol
pushed a commit
to mamazzol/elasticsearch
that referenced
this pull request
Mar 30, 2026
PrometheusSeriesPlanBuilder translates a Prometheus series selector into an ESQL logical plan that fetches matching label combinations. Also extends TranslatePromqlToEsqlPlan to expose the plan-building logic needed by the series endpoint.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Translates a Prometheus series selector into an ESQL logical plan that fetches matching label combinations. Also extends TranslatePromqlToEsqlPlan to expose the plan-building logic needed by the series endpoint.
Stack:
RequestParamsto handle repeated query parameters #144506