Description
Is your feature request related to a problem? Please describe.
The metadata APIs like /api/v1/series
, /api/v1/labels
, /api/v1/label/<name>/values
often timeout when queried with a lot of data.
Recently Prometheus introduced a new limit param in the above APIs for limiting the amount of data returned. This change was implemented in:
- web/api add limit param prometheus/prometheus#13396
- storage: pass limit param as hint in querier prometheus/prometheus#14109
The #14109 allows storage implementations to know that the label names or label values request has a limit applied.
However, we currently don't make use of this information, so ingesters and store-gateways may do a bunch of work retrieving values that will then be thrown away in the querier.
Describe the solution you'd like
Cortex ingesters and store-gateways should truncate the results and return only up to the limit number of results
Describe alternatives you've considered
N/A
Additional context
prometheus/prometheus#12795 has more context about this problem.