Skip to content

feat(workflow_engine): Add in hook for producing occurrences from the stateful detector - #1815

Open
kaihao-zhao wants to merge 2 commits into
workflow-engine-stateful-detector-beforefrom
workflow-engine-stateful-detector-after-stdsol61-r1
Open

kaihao-zhao wants to merge 2 commits into
workflow-engine-stateful-detector-beforefrom
workflow-engine-stateful-detector-after-stdsol61-r1

Conversation

@kaihao-zhao

Copy link
Copy Markdown

See title.

wedamija and others added 2 commits November 5, 2024 23:20
… 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. -->

@unblocked-local-kaihao unblocked-local-kaihao Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found.

About Unblocked

Unblocked has been set up to automatically review your team's pull requests to identify genuine bugs and issues.

📖 Documentation — Learn more in our docs.

💬 Ask questions — Mention @unblocked-local-kaihao to request a review or summary, or ask follow-up questions.

👍 Give feedback — React to comments with 👍 or 👎 to help us improve.

⚙️ Customize — Adjust settings in your preferences.

Comment on lines +11 to +12
class MetricAlertDetectorHandler(StatefulDetectorHandler[QuerySubscriptionUpdate]):
pass

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StatefulDetectorHandler requires implementations of counter_names, get_dedupe_value, get_group_key_values, and build_occurrence_and_event_data. This empty subclass is therefore abstract. Accessing detector.detector_handler for a metric_alert_fire detector now raises TypeError when the property instantiates the registered handler, aborting process_detectors before it can process the remaining detectors. Implement these methods before switching the base class, or retain a concrete DetectorHandler stub whose evaluate returns {}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants