Skip to content

feat(ui): show alert labels in the alert sidebar - #6907

Merged
shahargl merged 1 commit into
keephq:mainfrom
henricop:feat/6898-alert-sidebar-labels
Nov 4, 2026
Merged

shahargl merged 1 commit into
keephq:mainfrom
henricop:feat/6898-alert-sidebar-labels

Conversation

@henricop

@henricop henricop commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Closes #6898

Alerts from providers like Grafana carry a labels map that usually says what fired (job, host, customer). Today the sidebar can only show it if you add a custom path to ALERT_SIDEBAR_FIELDS, and then labels renders as a raw JSON block.

This adds a built-in labels sidebar field:

  • alertSidebarFields.tsx: new labels entry that renders each label as a key=value badge, in the same style as service. Non-string values are stringified, and the field is skipped when the alert has no labels.
  • getConfig.ts and docs/deployment/configuration.mdx: labels is part of the default ALERT_SIDEBAR_FIELDS list, after message. Deployments that set the variable explicitly keep their own list, and custom paths like labels.JobName still work as before.
  • entities/alerts/model/types.ts: labels added to the frontend AlertDto (the backend model already has labels: dict | None).

Tests

  • New features/alerts/alert-detail-sidebar/lib/__tests__/alertSidebarFields.test.tsx. It checks that labels is treated as a built-in field (and labels.X still as a custom path), that each label renders as a key=value badge, and that the field is skipped for missing, null or empty labels. The test mocks FormattedContent, because it imports react-markdown, which is ESM-only and not transformed by the jest config. All three tests fail without the change.
  • npx tsc --noEmit: no errors in the touched files (the 10 existing errors are in unrelated test files and are the same on main).
  • next lint and prettier --check on the touched files: clean.

Running UI. Setup:

  • keep-api 0.54.3 (the published image), AUTH_TYPE=NO_AUTH, SQLite;
  • keep-ui from source with next dev, telemetry off;
  • one Grafana-style alert posted to /alerts/event with labels: {job, host, customer, team};
  • no ALERT_SIDEBAR_FIELDS set, so the default list applies.

"Before" is main at this branch's base (c5d8d89de); "after" is this branch. The "8 Issues" badge is the Next.js dev overlay and shows the same warnings on both.

Before (main) After
before after

Alerts from providers such as Grafana carry a labels map that often
identifies what fired (job, host, customer), but the sidebar only
showed it through a custom ALERT_SIDEBAR_FIELDS path, rendered as raw
JSON. Add a built-in "labels" sidebar field that renders each label as
a key=value badge, include it in the default field list, and add
labels to the frontend AlertDto type to match the backend model.

Closes keephq#6898
@mintlify

mintlify Bot commented Nov 1, 2026

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit aec82e3.

Approve preview

@CLAassistant

CLAassistant commented Nov 1, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@shahargl shahargl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@shahargl
shahargl merged commit 0fe31e4 into keephq:main Nov 4, 2026
16 checks passed
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

🚀 Fantastic work @henricop! Your very first PR to keep has been merged! 🎉🥳

You've just taken your first step into open-source, and we couldn't be happier to have you onboard. 🙌
If you're feeling adventurous, why not dive into another issue and keep contributing? The community would love to see more from you! 🚀

For any support, feel free to reach out on the community: https://slack.keephq.dev. Happy coding! 👩‍💻👨‍💻

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.

[➕ Feature]: Display labels in Alert view

3 participants