-
Notifications
You must be signed in to change notification settings - Fork 1k
fix: incident enrichment via workflow when using mysql #5098
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
|
… happen if the WorkflowManager._instance already set, and stop called after)
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5098 +/- ##
==========================================
+ Coverage 46.18% 46.85% +0.67%
==========================================
Files 173 174 +1
Lines 17970 18090 +120
==========================================
+ Hits 8299 8476 +177
+ Misses 9671 9614 -57 ☔ 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
Comprehensive fix for incident enrichment visibility in MySQL deployments by addressing UUID format inconsistencies and workflow-related issues across different database dialects.
- Added migration script
2025-07-01-12-19_alertenrichment_uuid_dashes.py
to standardize UUID formatting across database dialects by removing dashes - Modified
keep/api/core/db.py
to introduce__convert_to_uuid_dialect_str
for proper UUID handling across different databases - Added safeguard in tests by setting
KEEP_STORE_WORKFLOW_LOGS=false
to prevent test failures due to db_session fixture table drops - Fixed scheduler initialization edge case in
keep/workflowmanager/workflowmanager.py
to ensure proper workflow manager restarts
7 files reviewed, 3 comments
Edit PR Review Bot Settings | Greptile
keep/api/models/db/migrations/versions/2025-07-01-12-19_alertenrichment_uuid_dashes.py
Show resolved
Hide resolved
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Kirill Chernakov <yakiryous@gmail.com>
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.
see comment
if not self.scheduler: | ||
self.logger.debug("Scheduler was stopped, reinitializing it") | ||
self.scheduler = WorkflowScheduler(self) | ||
|
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.
first, how is it possible that "self.started" is true and not self.scheduler? if its because of raise condition, than it means that right after you start it, the self.started will become false and stop
won't work anymore
…eep into fix/5097-wf-incident-enrichment # Conflicts: # keep/workflowmanager/workflowmanager.py
…ts.id (UUID) to not to break existing alert enrichments
…eep into fix/5097-wf-incident-enrichment
Closes #5097
Problem
When enriching incident via workflow, python-side str(uuid) is called to get
alert_fingerprint
foralertenrichment
entry.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
__convert_to_uuid_dialect_str
inkeep/api/core/db.py
to introduce for proper UUID handling across different databases.2025-07-01-12-19_alertenrichment_uuid_dashes.py
to standardize UUID formatting across database dialects by removing dashes.