Skip to content

[FEATURE] add alert manager plugin#647

Merged
jgbernalp merged 1 commit into
mainfrom
feat/alert-manager-plugin
Jun 26, 2026
Merged

[FEATURE] add alert manager plugin#647
jgbernalp merged 1 commit into
mainfrom
feat/alert-manager-plugin

Conversation

@jgbernalp

@jgbernalp jgbernalp commented May 4, 2026

Copy link
Copy Markdown
Contributor

Description

This PR adds the alert manager plugin:

  • Alerts table with hierarchical grouping
  • Silence table with action to expire silences
  • Alerts explore with action to silence alerts (create silence)
  • Silence explore with option to create silences

Part 3 of perses/perses#3645

needs the following PRs: ( CI will fail until these are merged and dependencies are updated )

Screenshots

Screen.Recording.2026-05-04.at.11.26.59.mov
Screenshot 2026-05-04 at 11 31 02 Screenshot 2026-05-04 at 11 30 33 Screenshot 2026-05-04 at 11 34 49

Checklist

  • Pull request has a descriptive title and context useful to a reviewer.
  • Pull request title follows the [<catalog_entry>] <commit message> naming convention using one of the
    following catalog_entry values: FEATURE, ENHANCEMENT, BUGFIX, BREAKINGCHANGE, DOC,IGNORE.
  • All commits have DCO signoffs.

UI Changes

  • Changes that impact the UI include screenshots and/or screencasts of the relevant changes.
  • Code follows the UI guidelines.

Testing locally

  • Pull all the repo PRs locally
# link spec with shared plugin-system
cd <path to perses spec in #21>/ts
npm install
npm run build
cd <path to perses shared in #127>/plugin-system
npm install <relative path to perses spec in #21 e.g. "../../spec/ts">

# link shared with perses
cd <path to perses shared in #127>
npm install
npm run build
./scripts/link-with-perses/link-with-perses.sh --perses

# start perses backend
cd <path to perses in #4047>
make build-cli
./scripts/api_backend_dev.sh --e2e

# in a 2nd terminal, start the app in shared mode
cd <path to perses in #4047>/ui/app
npm run start:shared

# in a 3rd terminal, start the plugin
cd <path to perses plugins in #647>
<path to perses in #4047>/bin/percli plugin start alertmanager

# in a 4th terminal, start the test alert manager and prometheus
cd <path to perses in #4047>
podman compose --file dev/docker-compose.yaml --profile prometheus --profile avalanche --profile alertmanager up

And that is all 😅 , we need to script this away... I'll extend the link script

@jgbernalp jgbernalp force-pushed the feat/alert-manager-plugin branch 2 times, most recently from c81fb7a to 61b2b65 Compare May 4, 2026 09:46
@jgbernalp jgbernalp requested review from Nexucis and shahrokni May 4, 2026 09:46
@jgbernalp jgbernalp force-pushed the feat/alert-manager-plugin branch from 61b2b65 to bcbbbdc Compare May 4, 2026 09:49
@jgbernalp jgbernalp marked this pull request as ready for review May 4, 2026 09:51
@jgbernalp jgbernalp requested review from a team and AntoineThebaud as code owners May 4, 2026 09:51
@jgbernalp jgbernalp marked this pull request as draft May 4, 2026 09:54
@jgbernalp jgbernalp force-pushed the feat/alert-manager-plugin branch from bcbbbdc to 6858481 Compare May 4, 2026 10:26
@jgbernalp jgbernalp marked this pull request as ready for review May 4, 2026 10:39
@jgbernalp jgbernalp force-pushed the feat/alert-manager-plugin branch 3 times, most recently from 31c0f28 to 3258751 Compare May 4, 2026 11:04
@ibakshay

ibakshay commented May 8, 2026

Copy link
Copy Markdown
Contributor

I am testing locally. When I try write something in the label key and in Header, the focus keeps going out after every letter. So, I have to type a letter and then bring the focus back by clicking with the mouse.

image

@ibakshay

ibakshay commented May 8, 2026

Copy link
Copy Markdown
Contributor

How does View run book work?

@jgbernalp

Copy link
Copy Markdown
Contributor Author

How does View run book work?

If the alert has runbook_url as part of its annotations, clicking the "view runbook" will load the runbook link in a new tab

@jgbernalp jgbernalp force-pushed the feat/alert-manager-plugin branch from 3258751 to 5cf3491 Compare May 8, 2026 21:17
@jgbernalp

jgbernalp commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

I am testing locally. When I try write something in the label key and in Header, the focus keeps going out after every letter. So, I have to type a letter and then bring the focus back by clicking with the mouse.

@ibakshay fixed in the latest push

@ibakshay

Copy link
Copy Markdown
Contributor

How does View run book work?

If the alert has runbook_url as part of its annotations, clicking the "view runbook" will load the runbook link in a new tab

cool. can we make the runbook_url configurable? by default it can be runbook_url.

@jgbernalp jgbernalp force-pushed the feat/alert-manager-plugin branch from 5cf3491 to 42a4448 Compare May 22, 2026 13:21
@jgbernalp

Copy link
Copy Markdown
Contributor Author

How does View run book work?

If the alert has runbook_url as part of its annotations, clicking the "view runbook" will load the runbook link in a new tab

cool. can we make the runbook_url configurable? by default it can be runbook_url.

done

@jgbernalp jgbernalp force-pushed the feat/alert-manager-plugin branch from 42a4448 to 2da8aa4 Compare June 8, 2026 14:47
@Nexucis

Nexucis commented Jun 8, 2026

Copy link
Copy Markdown
Member

(chicken and egg problem, maybe the query kinds should be part of the spec) cc @Nexucis WDYT?

yes this should be moved to the spec so it is aligned with the rest of the implementation. I will work on that asap

@Nexucis

Nexucis commented Jun 8, 2026

Copy link
Copy Markdown
Member

mmm I will be cautious to allow the possibility to create silence through Perses without having any control on who does it

@jgbernalp jgbernalp force-pushed the feat/alert-manager-plugin branch from 2da8aa4 to e253bbc Compare June 16, 2026 07:09
@jgbernalp

Copy link
Copy Markdown
Contributor Author

mmm I will be cautious to allow the possibility to create silence through Perses without having any control on who does it

I think backends should also check if the current user has access to do the action that is being executed. In any case, if this should not be allowed from Perses the alert manager datasource follows the prometheus datasource pattern to allow specific endpoints/verbs.

@jgbernalp

Copy link
Copy Markdown
Contributor Author

@Nexucis thnx for adding the query types to the spec, but I think this requires a percli release.

@Nexucis

Nexucis commented Jun 16, 2026

Copy link
Copy Markdown
Member

@Nexucis thnx for adding the query types to the spec, but I think this requires a percli release.

ah yeah :(. Well we need to do that for the annotations as well.

So let's create another beta in Perses to unlock the situation

@Nexucis

Nexucis commented Jun 19, 2026

Copy link
Copy Markdown
Member

@jgbernalp can you rebase your PR. CLI has been updated, your PR should work now.

@jgbernalp jgbernalp force-pushed the feat/alert-manager-plugin branch from e253bbc to 575f0bd Compare June 22, 2026 09:33
Comment thread alertmanager/sdk/go/datasource/datasource.go
@jgbernalp jgbernalp force-pushed the feat/alert-manager-plugin branch 3 times, most recently from b0c4364 to 77ac778 Compare June 22, 2026 10:51
Comment thread alertmanager/sdk/go/datasource/datasource.go Outdated
Comment thread alertmanager/go.mod Outdated
@jgbernalp jgbernalp force-pushed the feat/alert-manager-plugin branch 2 times, most recently from 96124df to cf9c7dd Compare June 22, 2026 11:14
@ibakshay

Copy link
Copy Markdown
Contributor

@jgbernalp,
I tested again and I found a few UI stuff.

  1. Sorting does not seem to work.
image
  1. Same issue for Labels as mentioned in [FEATURE] add alert manager plugin #647 (comment)
image
  1. runbook does not seem to work. Maybe I am missing something. What is the expected behaviour?
image

The performance is a bit slow. But, we can tackle this in the follow-up PRs. Not a show stopper.

@jgbernalp jgbernalp force-pushed the feat/alert-manager-plugin branch 2 times, most recently from 6da6695 to d85c2e4 Compare June 24, 2026 15:05
@jgbernalp

jgbernalp commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

@ibakshay I fixed the issue related to the single character input, it was present on all the lists editors, this also caused a slow rendering as the issue was with react keys.

The sorting works but it was not added to the default columns. Is added now.

The runbook_url works but needs that your alerting rules have the annotation, if you start the dev docker/podman compose with the --profile alertmanager you will see one of the alerts has the link:

Alerting rule:
Screenshot 2026-06-24 at 17 15 34

List with runbook_url:
Screenshot 2026-06-24 at 17 16 59

@jgbernalp jgbernalp requested a review from zhuje June 24, 2026 15:22
@zhuje

zhuje commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

I did some testing, and everything looks good to me! I noticed a couple of small UX nits that might be worth considering in a future PR, but I don't think they need to block this one.

  • Alerts Table & Silences Table: When a search returns no results, the search bar disappears, so there's no way to clear the search without refreshing the page. This happens in both the Alerts Table and Silences Table.
  • Silences Explorer: The Create Silence form lets you add a Comment, but that comment is never displayed in the Silences Explorer.

Here's the verification checklist:

## 1. Alerts Table

### 1.1 Data Loading
- [x] Alerts table loads and displays alerts from the AlertManager datasource
- [x] Alert count and group count shown correctly (e.g. "5 alerts in 4 groups")

### 1.2 Hierarchical Grouping
- [x] Alerts are grouped by `alertname` by default
- [x] Groups are collapsible — click to expand/collapse a group row
- [x] Expanding a group shows individual alerts with their details
- [x] Change "Group by" dropdown to `severity`, `job`, `instance` — verify regrouping works

### 1.3 Columns & Sorting
- [x] Columns render: Status, Alert Name, Severity, Environment, Labels
- [x] Click "Severity" column header — alerts sort ascending/descending by severity
- [x] Click "Alert Name" column header — alphabetical sort works
- [-] Status badges display correct colors (firing = red, pending = orange, etc.)
Notes: (I only saw firing=red, I didn't have any other types of alerts to verify the other status badges)

### 1.4 Labels
- [x] Labels column shows label chips/badges for each alert
- [x] Label color mappings work (severity and environment should auto-color)

### 1.5 Search / Filter
- [x] Search box filters alerts by text
- [x] Type a partial alert name — only matching groups/alerts appear
- [x] Clear search — all alerts return

### 1.6 Actions
- [x] "Silence" action is available on individual alerts
- [x] Clicking silence opens a silence creation form
- [x] Silence form pre-fills matchers from the alert's labels
- [x] Submitting the silence form creates a silence in AlertManager
- [x] "Runbook" action appears if alert has a `runbook_url` annotation

---

## 2. Silence Table

### 2.1 Data Loading
- [x] Silence table loads and displays silences from AlertManager
- [x] Columns render: Status, Matchers, Comment

### 2.2 Sorting
- [x] Click "Status" column header — sorts by status (active/expired/pending)

### 2.3 Search / Filter
- [x] Search box filters silences by text (matcher values, comments)
Nit -- UX issue when your search results in nothing, the search bar disappears and you can't undo without refreshing the whole page (happens in both  Silences Table search bar and Alerts Table search bar)

### 2.4 Expire Action
- [x] "Expire" action button appears on active silences
- [x] Clicking expire sends a request to AlertManager to expire the silence
- [x] After expiring, the silence status updates 
- [x] Expired silences disables expire action

---

## 3. Variables

### 3.1 Variable Dropdowns
- [x] "Job name", "Environment", and "Group By" dropdowns render in the top bar
- [x] Selecting different values updates the variable state
- [x] Multi-select works for Job name and Environment (chips shown)
- [x] "All" option appears for Job name and Environment

---

## 4. Explore Views

### 4.1 Alerts Explorer
- [x] Navigate to Explore > select AlertManager Alerts Explorer
- [x] Alerts explorer loads and displays alerts
- [x] "Silence" action available from explorer — opens silence creation form

### 4.2 Silences Explorer
- [x] Navigate to Explore > select AlertManager Silences Explorer
- [x] Silences explorer loads and displays silences
- [x] "Create Silence" option is available
- [-] Creating a new silence from explorer works end-to-end
Nit: In the 'Create Silence' form you can create a 'comment' but it is never displayed in the Silences Explorer 

---

## 5. Dashboard Edit Mode

### 5.1 Panel Editor
- [x] Click "Edit" on dashboard, then edit the Alerts panel
- [x] Panel options editor loads (group by, columns, deduplication, label colors)
- [x] Changing options and saving updates the panel correctly

### 5.2 Query Editor
- [x] Alerts query editor shows datasource selector and filter options (active, silenced, inhibited, receiver)
- [x] Silences query editor shows datasource selector and filter options
- [x] Changing query options refreshes data correctly

### 5.3 Datasource Editor
- [x] Can create/edit an AlertManager datasource
- [x] Datasource editor shows `directUrl` and proxy config fields

Signed-off-by: Gabriel Bernal <gbernal@redhat.com>
@jgbernalp jgbernalp force-pushed the feat/alert-manager-plugin branch from d85c2e4 to 41fad33 Compare June 26, 2026 08:43
@jgbernalp jgbernalp added this pull request to the merge queue Jun 26, 2026
Merged via the queue into main with commit 1446c3d Jun 26, 2026
16 checks passed
@jgbernalp jgbernalp deleted the feat/alert-manager-plugin branch June 26, 2026 14:35
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

Successfully merging this pull request may close these issues.

4 participants