Add PrometheusSeriesResponseListener for series endpoint#144492
Merged
felixbarny merged 13 commits intoelastic:mainfrom Mar 25, 2026
Merged
Add PrometheusSeriesResponseListener for series endpoint#144492felixbarny merged 13 commits intoelastic:mainfrom
felixbarny merged 13 commits intoelastic:mainfrom
Conversation
Collaborator
|
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
This was referenced Mar 18, 2026
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.
Implements an ActionListener that converts ESQL query results into a Prometheus-compatible series response, including label name/value extraction and proto serialization.
029ea1e to
0325a05
Compare
These tests exercise PrometheusSeriesRestAction.parseQueryString which doesn't exist on this branch. Move them to the rest action PR.
kkrik-es
reviewed
Mar 23, 2026
.../src/main/java/org/elasticsearch/xpack/prometheus/rest/PrometheusSeriesResponseListener.java
Show resolved
Hide resolved
kkrik-es
approved these changes
Mar 23, 2026
metric_name cannot be null and empty dimensions is not legal, so the test now verifies that the existing assertion in buildLabelMap is tripped rather than expecting a valid empty label map.
sidosera
reviewed
Mar 24, 2026
| * Prometheus HTTP API error type strings, as defined in the Prometheus source: | ||
| * https://github.com/prometheus/prometheus/blob/main/web/api/v1/api.go | ||
| */ | ||
| private static final String ERROR_TYPE_EXECUTION = "execution"; |
Member
Author
There was a problem hiding this comment.
I've consolidated the error handling with PrometheusQueryRangeResponseListener now and created a shared PrometheusErrorResponse helper.
sidosera
reviewed
Mar 24, 2026
.../src/main/java/org/elasticsearch/xpack/prometheus/rest/PrometheusSeriesResponseListener.java
Outdated
Show resolved
Hide resolved
sidosera
reviewed
Mar 24, 2026
.../src/main/java/org/elasticsearch/xpack/prometheus/rest/PrometheusSeriesResponseListener.java
Outdated
Show resolved
Hide resolved
sidosera
reviewed
Mar 24, 2026
.../src/main/java/org/elasticsearch/xpack/prometheus/rest/PrometheusSeriesResponseListener.java
Outdated
Show resolved
Hide resolved
sidosera
reviewed
Mar 24, 2026
.../src/main/java/org/elasticsearch/xpack/prometheus/rest/PrometheusSeriesResponseListener.java
Outdated
Show resolved
Hide resolved
sidosera
reviewed
Mar 24, 2026
.../src/main/java/org/elasticsearch/xpack/prometheus/rest/PrometheusSeriesResponseListener.java
Outdated
Show resolved
Hide resolved
sidosera
reviewed
Mar 24, 2026
| try { | ||
| List<Map<String, String>> seriesList = extractSeries(response); | ||
| channel.sendResponse(buildSuccessResponse(seriesList)); | ||
| } catch (Exception e) { |
Contributor
There was a problem hiding this comment.
Can we reuse org/elasticsearch/action/ActionListener.java:250 ?
sidosera
reviewed
Mar 24, 2026
| sendError(e); | ||
| } | ||
|
|
||
| // ------------------------------------------------------------------------- |
Contributor
There was a problem hiding this comment.
nit: I can we use this comment pattern around tests but not sure how consistent it is with the rest of the codebase. Just flagging.
sidosera
approved these changes
Mar 24, 2026
Contributor
sidosera
left a comment
There was a problem hiding this comment.
Left a few minor comments; otherwise looks good.
One broader question. What’s the intended home for response format conversion rest layer or compute engine. Any particular reason we chose current approach?
- Convert error type string constants to a private enum - Rename buildSuccessResponse -> replaySuccess (void, non-static, sends response directly) - Rename sendError -> replayError - Remove separator comment style - Add imports for XContentParser and XContentParserConfiguration (replacing FQNs)
Both PrometheusQueryRangeResponseListener and PrometheusSeriesResponseListener shared duplicate error type mapping and error JSON construction logic. Extract to a single PrometheusErrorResponse class with: - send(channel, e, logger): builds and sends the error response with fallback - build(status, message): constructs the error JSON builder - mapErrorType(status): maps HTTP status to Prometheus error type string The series listener now uses ExceptionsHelper.status(e) for status resolution (consistent with the range listener) instead of manual instanceof checks.
eranweiss-elastic
pushed a commit
to eranweiss-elastic/elasticsearch
that referenced
this pull request
Mar 25, 2026
seanzatzdev
pushed a commit
to seanzatzdev/elasticsearch
that referenced
this pull request
Mar 27, 2026
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.
Implements an ActionListener that converts ESQL query results into a Prometheus-compatible series response, including label name/value extraction and proto serialization.
Also adds ESQL compile-time dependencies to the prometheus plugin.
Stack:
RequestParamsto handle repeated query parameters #144506