-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: incident enrichments #5142
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
…/keep into fix/5097-wf-incident-enrichment-3
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5142 +/- ##
===========================================
- Coverage 46.18% 30.74% -15.44%
===========================================
Files 173 101 -72
Lines 17970 11492 -6478
===========================================
- Hits 8299 3533 -4766
+ Misses 9671 7959 -1712 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
Added migration and logic to handle UUID formatting inconsistencies in alert fingerprints across different database dialects (MySQL, SQLite, PostgreSQL).
- Added migration
2025-07-01-12-19_alertenrichment_uuid_dashes.pybut lacks PostgreSQL implementation and proper downgrade function - Modified
enrichments_bl.pyto handle UUIDs consistently using SQLAlchemy's UUIDType for dialect-specific formatting - Added thread-safety in
workflowmanager.get_instance()with proper double-checked locking pattern - Extended test coverage for incident enrichment with UUID handling and multi-database support
8 files reviewed, 7 comments
Edit PR Review Bot Settings | Greptile
keep/api/models/db/migrations/versions/2025-07-01-12-19_alertenrichment_uuid_dashes.py
Outdated
Show resolved
Hide resolved
keep/api/models/db/migrations/versions/2025-07-01-12-19_alertenrichment_uuid_dashes.py
Outdated
Show resolved
Hide resolved
keep/api/models/db/migrations/versions/2025-07-01-12-19_alertenrichment_uuid_dashes.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
…string and migration will can cause incinsistency
🚨 BugBot couldn't runSomething went wrong. Try again by commenting "bugbot run", or contact support (requestId: serverGenReqId_1815e490-4824-4126-9816-85dbb1f7c66c). |
|
bugbot run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ BugBot reviewed your changes and found no bugs!
Was this report helpful? Give feedback by reacting with 👍 or 👎
Closes #5097
Problem
When enriching incident via workflow, python-side str(uuid) is called to get
alert_fingerprintforalertenrichmententry.https://github.com/keephq/keep/blob/v0.45.11/keep/providers/base/base_provider.py#L244-L245
Therefore, when we look up incident enrichments using cast(alert_fingerprint as char) no enrichments will be found, because python will convert uuid to string with dashes, while mysql will convert to string without dashes:
https://github.com/keephq/keep/blob/v0.45.11/keep/api/core/db.py#L3979-L3990
Summary
fingerprintinenrichments_bl.enrich_entityto save uuid in db-specific way.Added migration2025-07-01-12-19_alertenrichment_uuid_dashes.pyto standardize UUID formatting across database dialects by removing dashes.