feat(workflow_engine): Add in hook for producing occurrences from the stateful detector#6
Open
akshayutture-augment wants to merge 1 commit into
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. -->
|
You have run out of free Bugbot PR reviews for this billing cycle. This will reset on December 14. To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial. |
Author
|
cursor review |
| # TODO: Implement | ||
| return [] | ||
| class MetricAlertDetectorHandler(StatefulDetectorHandler[QuerySubscriptionUpdate]): | ||
| pass |
There was a problem hiding this comment.
Bug: Broken Inheritance: Abstract Methods Missing
MetricAlertDetectorHandler now extends StatefulDetectorHandler but doesn't implement the required abstract methods: counter_names, get_dedupe_value, get_group_key_values, and build_occurrence_and_event_data. This makes the class non-instantiable and will cause a TypeError when attempting to create instances.
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.
Test 10
Replicated from ai-code-review-evaluation/sentry-cursor#10
Note
Adds a hook for stateful detectors to build IssueOccurrences and event data, updates evaluate() to return a dict keyed by group key, and produces OCCURRENCE/STATUS_CHANGE payloads to Kafka.
build_occurrence_and_event_data()abstract hook;evaluate_group_key_value()now buildsIssueOccurrenceon activation andStatusChangeMessageon resolve.DetectorHandler.evaluate()returnsdict[DetectorGroupKey, DetectorEvaluationResult](was list);process_detectors()updated to iterate dict and produce Kafka messages viaproduce_occurrence_to_kafka.group_typeproperty and use it indetector_handlerresolution.MetricAlertDetectorHandlernow extendsStatefulDetectorHandler.BaseDetectorHandlerTest, and expand coverage for state commit, dedupe, multi-group, and status change behaviors.Written by Cursor Bugbot for commit de60b7f. Configure here.