Skip to content

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

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

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

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.

This subclass leaves counter_names, get_dedupe_value, get_group_key_values, and build_occurrence_and_event_data abstract. Since MetricAlertFire still registers it as its handler, accessing detector.detector_handler for a metric_alert_fire detector now raises TypeError instead of returning the previous no-op handler. process_detectors does not catch this exception, so it aborts processing the packet and any remaining detectors. Implement the abstract members, or retain a concrete DetectorHandler with evaluate returning {} until the stateful implementation is ready.

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