Skip to content

Prometheus label values API: add rest action#145098

Merged
felixbarny merged 6 commits intoelastic:mainfrom
felixbarny:prometheus-label-values-api-rest-action-2
Mar 27, 2026
Merged

Prometheus label values API: add rest action#145098
felixbarny merged 6 commits intoelastic:mainfrom
felixbarny:prometheus-label-values-api-rest-action-2

Conversation

@felixbarny
Copy link
Copy Markdown
Member

@felixbarny felixbarny commented Mar 27, 2026

Re-creation of #144958, which was reverted in 08162c1 due to a compilation issue (PROMETHEUS_FEATURE_FLAG referenced in PrometheusLabelValuesRestIT no longer existing on main). That reference has been removed.

This PR also improves the handling of limit=0 (Prometheus semantics for "disabled"): instead of omitting the ESQL LIMIT node entirely — which caused ESQL to silently add a default limit of 1 000 with a "No limit defined" warning — we now emit LIMIT Integer.MAX_VALUE, letting ESQL silently cap to esql.query.result_truncation_max_size (default 10 000) without a warning. The default for the parameter is changed from 10 000 to 0 to match Prometheus semantics where omitting the parameter means no explicit limit.

Adds PrometheusLabelValuesRestAction, the REST handler for GET /_prometheus/api/v1/label/{name}/values. It wires together the plan builder and response listener from the prerequisite PRs and registers the action with the Prometheus plugin. Integration tests are covered by PrometheusLabelValuesRestIT.

This is part of a stack implementing the Prometheus label values API endpoint:

Stacking order

felixbarny and others added 6 commits March 25, 2026 17:05
Implements the REST handler for GET /_prometheus/api/v1/label/{name}/values,
wiring together the plan builder and response listener. Registers the action
in PrometheusPlugin and adds integration tests.
…rometheusLabelValuesRestIT

The FeatureFlag enum does not have a PROMETHEUS_FEATURE_FLAG constant.
The endpoint is already gated by xpack.prometheus.enabled (default: true),
matching the pattern used by the other prometheus REST IT tests.
…_size

When limit=0 (Prometheus "disabled" semantics), always emit an explicit
LIMIT Integer.MAX_VALUE node so ESQL silently caps to its own
result_truncation_max_size setting (default 10 000) instead of adding
a default limit of 1 000 with a "No limit defined" warning.

Change the default from 10 000 to 0 to match Prometheus semantics where
omitting the parameter means no explicit limit.
@felixbarny felixbarny added the :StorageEngine/PromQL PromQL support for Elastic label Mar 27, 2026
@elasticsearchmachine elasticsearchmachine added external-contributor Pull request authored by a developer outside the Elasticsearch team Team:StorageEngine v9.4.0 labels Mar 27, 2026
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

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

@felixbarny felixbarny enabled auto-merge (squash) March 27, 2026 15:50
@felixbarny felixbarny merged commit 5d29b03 into elastic:main Mar 27, 2026
38 of 40 checks passed
@felixbarny felixbarny deleted the prometheus-label-values-api-rest-action-2 branch March 28, 2026 11:05
mamazzol pushed a commit to mamazzol/elasticsearch that referenced this pull request Mar 30, 2026
Implements the REST handler for GET /_prometheus/api/v1/label/{name}/values,
wiring together the plan builder and response listener. Registers the action
in PrometheusPlugin and adds integration tests.
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/PromQL PromQL support for Elastic Team:StorageEngine v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants