Prometheus label values API: add rest action#144958
Conversation
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.
|
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
| : end.minus(DEFAULT_LOOKBACK_HOURS, HOURS); | ||
|
|
||
| // Optional limit; default to DEFAULT_LIMIT to avoid unbounded ESQL scans | ||
| int limit = request.paramAsInt(LIMIT_PARAM, DEFAULT_LIMIT); |
There was a problem hiding this comment.
Do we need the default limit? TS transpilation should lead to the respective limits being applied?
There was a problem hiding this comment.
TimeSeriesAggregate does not fit here: it requires _tsid/tbucket groupings and TimeSeriesAggregateFunction aggregates, while we are doing a plain deduplication (GROUP BY label). With a regular Aggregate, AddImplicitLimit's isTsAggregate check is false, so without the explicit default ESQL would cap at 1,000 rows and emit a "No limit defined" header warning. The DEFAULT_LIMIT = 10_000 is needed.
There was a problem hiding this comment.
How can users adjust it? For the other limits, we use cluster settings.
There was a problem hiding this comment.
There’s a limit query parameter for the api
There was a problem hiding this comment.
So it's possible to request 10b results? We should probably add an upper bound and control it through a cluster setting. That can happen in a follow-up.
This reverts commit 3eabbfa.
|
This broke compilation of |
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.
This reverts commit 3eabbfa.
Adds
PrometheusLabelValuesRestAction, the REST handler forGET /_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 byPrometheusLabelValuesRestIT.This is part of a stack implementing the Prometheus label values API endpoint:
Stacking order