Skip to content

Add a limit parameter to /api/v1/series and /api/v1/labels and /api/v1/label/{name}/values #12795

@bboreham

Description

@bboreham

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions