-
Notifications
You must be signed in to change notification settings - Fork 0
feat(workflow_engine): Add in hook for producing occurrences from the stateful detector #6
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
base: workflow-engine-stateful-detector-before
Are you sure you want to change the base?
Conversation
… stateful detector (#80168) This adds a hook that can be implemented to produce an occurrence specific to the detector that is subclassing the StatefulDetector. Also change the signature of evaluate to return a dict keyed by groupkey instead of a list. This helps avoid the chance of duplicate results for the same group key. <!-- Describe your PR here. -->
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.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Greptile OverviewConfidence Score: 1/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant DP as DataPacket
participant PD as process_detectors
participant DH as StatefulDetectorHandler
participant EV as evaluate_group_key_value
participant KF as produce_occurrence_to_kafka
DP->>PD: process data packet
PD->>DH: handler.evaluate(data_packet)
DH->>DH: get_dedupe_value(data_packet)
DH->>DH: get_group_key_values(data_packet)
DH->>DH: get_state_data(group_keys)
loop For each group_key
DH->>EV: evaluate_group_key_value(group_key, value, state_data, dedupe)
EV->>EV: Check if status changed
alt Status changed to OK
EV->>EV: Create StatusChangeMessage (RESOLVED)
else Status changed to active
EV->>DH: build_occurrence_and_event_data(group_key, value, new_status)
DH-->>EV: Return IssueOccurrence + event_data
end
EV-->>DH: Return DetectorEvaluationResult
end
DH-->>PD: Return dict[group_key, result]
loop For each result with result.result != None
PD->>KF: create_issue_occurrence_from_result(result)
KF->>KF: produce_occurrence_to_kafka
end
PD->>DH: handler.commit_state_updates()
DH->>DH: Update Redis and DB state
|
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.
4 files reviewed, 1 comment
| class MetricAlertDetectorHandler(StatefulDetectorHandler[QuerySubscriptionUpdate]): | ||
| pass |
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.
logic: MetricAlertDetectorHandler doesn't implement required abstract methods from StatefulDetectorHandler including build_occurrence_and_event_data, counter_names, get_dedupe_value, and get_group_key_values - will cause runtime errors when instantiated
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/sentry/incidents/grouptype.py
Line: 11:12
Comment:
**logic:** `MetricAlertDetectorHandler` doesn't implement required abstract methods from `StatefulDetectorHandler` including `build_occurrence_and_event_data`, `counter_names`, `get_dedupe_value`, and `get_group_key_values` - will cause runtime errors when instantiated
How can I resolve this? If you propose a fix, please make it concise.
Test [new PR number opened]
Replicated from ai-code-review-evaluation/sentry-greptile#10