Repository navigation
feat(ui): show alert labels in the alert sidebar - #6907
Merged
Merged
Conversation
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
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
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. 🙌 For any support, feel free to reach out on the community: https://slack.keephq.dev. Happy coding! 👩💻👨💻 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #6898
Alerts from providers like Grafana carry a
labelsmap that usually says what fired (job, host, customer). Today the sidebar can only show it if you add a custom path toALERT_SIDEBAR_FIELDS, and thenlabelsrenders as a raw JSON block.This adds a built-in
labelssidebar field:alertSidebarFields.tsx: newlabelsentry that renders each label as akey=valuebadge, in the same style asservice. Non-string values are stringified, and the field is skipped when the alert has no labels.getConfig.tsanddocs/deployment/configuration.mdx:labelsis part of the defaultALERT_SIDEBAR_FIELDSlist, aftermessage. Deployments that set the variable explicitly keep their own list, and custom paths likelabels.JobNamestill work as before.entities/alerts/model/types.ts:labelsadded to the frontendAlertDto(the backend model already haslabels: dict | None).Tests
features/alerts/alert-detail-sidebar/lib/__tests__/alertSidebarFields.test.tsx. It checks thatlabelsis treated as a built-in field (andlabels.Xstill as a custom path), that each label renders as akey=valuebadge, and that the field is skipped for missing,nullor empty labels. The test mocksFormattedContent, because it importsreact-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 onmain).next lintandprettier --checkon the touched files: clean.Running UI. Setup:
keep-api0.54.3 (the published image),AUTH_TYPE=NO_AUTH, SQLite;keep-uifrom source withnext dev, telemetry off;/alerts/eventwithlabels: {job, host, customer, team};ALERT_SIDEBAR_FIELDSset, so the default list applies."Before" is
mainat 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.main)