prometheus / prometheus/alertmanager

Add pagination for silences list

Open
#4,138 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component/silences kind/enhancement
Dominant language
Go
Stars
8.6k
Forks
2.5k
Avg merge
2d 6h
Merged PRs (30d)
61

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with api/v2/openapi.yaml around line 61 and trace the silences endpoint in Alertmanager. Decide whether pagination uses limit/offset or page/per_page, and define how metadata is exposed without unnecessarily breaking the response format. Done means the endpoint supports requesting a slice of silences and documents the resulting behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, openapi
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.