-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Add a limit parameter to /api/v1/series and /api/v1/labels and /api/v1/label/{name}/values #12795
Copy link
Copy link
Open
Description
Proposal
Add a limit parameter to /api/v1/series and /api/v1/labels and /api/v1/label/{name}/values
This was agreed at the dev summit 2023-06-22.
In the meeting we agreed that /query and /query_range could use the same feature.
CONSENSUS: We will have a LIMIT feature in the API. Ordering will not be guaranteed, and we will document this.
CONSENSUS: If a LIMIT is set, and the limit is exceeded, the API will make this obvious in the response.
Motivation:
APIs like /labels and /series are often used to populate autocomplete; in such situations it isn't useful to have 100,000 responses, and wastes memory and CPU dealing with them.
The caller should be able to specify a maximum number of results to return.
Considerations:
- If there are more than N, do we return "any N", "the first N", or just an error?
Previous discussion
- PromQL: add
limitkeyword to reduce too much datapoint return #7485 - Whether limit parameters can be passed on api/v1/series api? #10996
- Comment recommending a limit on /series: [API] api/v1/series with only non-empty matcher killing the memory #8286 (comment)
- Limit the number of exemplars returned by /api/v1/querying_exemplars in some way #10107
Reactions are currently unavailable