feat(correlation): add incident enrichments to correlation rules#6617
Open
vinayaknolastname wants to merge 1 commit into
Open
feat(correlation): add incident enrichments to correlation rules#6617vinayaknolastname wants to merge 1 commit into
vinayaknolastname wants to merge 1 commit into
Conversation
…support raw alert storage - Introduced `incident_enrichments` field in correlation rules to allow metadata attachment to incidents. - Updated the `KEEP_STORE_RAW_ALERTS` configuration to enable storing raw webhooks for incident enrichment. - Enhanced the rules engine to process and apply incident enrichments during incident creation. - Added database migrations for new fields in the `rule` and `alertraw` tables. - Updated relevant API routes and UI components to support the new enrichment functionality.
|
|
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.
feat: incident enrichments on correlation rules
Closes #5227
What this adds
When a correlation rule creates a new incident, you can copy extra fields onto that incident (e.g. threshold, monitor name, team) using simple templates like
{{ alert.labels.monitor }}.Useful when the incident page needs info that only exists in the original alert or webhook (common with Grafana).
How it works (simple)
Important:
KEEP_STORE_RAW_ALERTS=truein.envand restart the API. Off by default.Grafana tip
The raw webhook is stored as one big JSON blob. Deep fields are under
alerts[0], not the top level.{{ raw.data[0].model... }}{{ raw.alerts[0].data[0].model... }}{{ raw.condition }}{{ raw.alerts[0].condition }}or{{ alert.labels.monitor }}UI
KEEP_STORE_RAW_ALERTS=trueon the server.What changed
incident_enrichmentsfield on correlation rules (DB + API + UI).{{ raw.* }}templates work.Not changed: how raw alerts are saved in the database (still one row per webhook, same as before).
Try it
KEEP_STORE_RAW_ALERTS=truein.env→ restartkeep api.threshold: {{ raw.alerts[0].data[0].model.conditions[0].evaluator.params[0] }}.Checks
##Learning:
Learned a lot about the code base and whole structure, as i never used the keep before, directly contributing to it