Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pagination for silences list #4138

Open
freak12techno opened this issue Nov 27, 2024 · 1 comment
Open

Add pagination for silences list #4138

freak12techno opened this issue Nov 27, 2024 · 1 comment

Comments

@freak12techno
Copy link
Contributor

freak12techno commented Nov 27, 2024

What did you do?

So I'm writing a tool called grafana-interacter and I need to be able to query silences with pagination (so, be able to specify limit/offset via query params) and only get a slice of silences and ideally some metadata like limit/offset.
From the OpenAPI docs https://github.com/prometheus/alertmanager/blob/main/api/v2/openapi.yaml#L61 it doesn't seem like it's possible, so it would be lovely if the silences endpoint can provide this.

Something like this would be ideal, but also API breaking (query params won't be breaking, but changing the response format would):

# Query: either this
GET /api/v2/silences?page=0&per_page=50
# or this
GET /api/v2/silences?limit=50&offset=0

# and the response
{
    silences: [], // array
    meta: {
        total: 95, // the total amount of silences
    }
}

What did you expect to see?

What did you see instead? Under which circumstances?

Environment

  • System information:

    insert output of uname -srm here

  • Alertmanager version:

    insert output of alertmanager --version here (repeat for each alertmanager
    version in your cluster, if relevant to the issue)

  • Prometheus version:

    insert output of prometheus --version here (repeat for each prometheus
    version in your cluster, if relevant to the issue)

  • Alertmanager configuration file:

insert configuration here
  • Prometheus configuration file:
insert configuration here (if relevant to the issue)
  • Logs:
insert Prometheus and Alertmanager logs relevant to the issue here
@grobinson-grafana
Copy link
Contributor

Pagination is a much needed feature, but as mentioned, it is a breaking change that will affect existing clients. I suspect it we will have to release another API (APIv3) with pagination support as updating APIv2 will be too disruptive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants