Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[➕ Feature]: Change relation between Alerts and Incidents to work with fingerprints instead of alert_ids #2398

Open
VladimirFilonov opened this issue Nov 5, 2024 · 0 comments · May be fixed by #2473
Assignees
Labels
Architecture Requires an architecture change/review Feature A new feature

Comments

@VladimirFilonov
Copy link
Contributor

VladimirFilonov commented Nov 5, 2024

Problem statement

Each alert in the database has a unique alert_id and a non-unique fingerprint, which separates a UNIQUE alert from its appearance. This allows us to track minor changes in alerts. Currently, in the UI, we always show the last appearance of the alert grouped by fingerprint.

AlertToIncident many-to-many relation right now uses alert_id as a key, and there is a runtime logic that assigns all alert_ids with the same fingerprint to the incident when we assign the last appearance. This leads to a huge size of the AlertToIncident table.

More of that - we still need to group alerts back by fingerprint to show the last one in an incident UI.

Current database structure

image

Assumption

If we will refactor AlertToIncident to have a relation via fingerprint we will dramatically reduce the amount of entities in AlertToIncident tables.

Also, to simplify finding a last appearance we want to introduce a new table latest_alerts which will contain the fingerprint and last alert_id. This will allow us to avoid grouping by fingerprint to get last alert appearance

Target database structure

image

For smooth migration, we suggest making a new table FingerprintToIncident with a new structure, then performing data migration, and then drop an old AlertToIncident table later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Architecture Requires an architecture change/review Feature A new feature
Projects
None yet
1 participant