-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
ref(alerts): use registry pattern for EventAttributeCondition attempt 2 #79456
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## master #79456 +/- ##
==========================================
+ Coverage 78.31% 78.32% +0.01%
==========================================
Files 7137 7137
Lines 315317 315391 +74
Branches 51529 51545 +16
==========================================
+ Hits 246942 247036 +94
+ Misses 61899 61886 -13
+ Partials 6476 6469 -7 |
else: | ||
try: | ||
attribute_values = attr_handler.handle(path, event) | ||
except KeyError: |
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.
🎉 nice that this refactor separates this error handling vs before - it's a lot simpler to reason about the key error.
for extra credit, i think it might be even nicer for us to update the AttributeHandler implementations so each individual handler works as intended (either returning [] or the correct value)
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.
i'll add that and still have the KeyError, but capture the exception since we know it actually shouldn't happen
@@ -365,6 +375,24 @@ def test_error_handled_not_defined(self): | |||
) | |||
self.assertDoesNotPass(rule, event) | |||
|
|||
@patch("sentry.eventstore.models.get_interfaces", return_value={}) |
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.
thanks for adding more test cases to cover this.
This reverts commit da8f866.
I removed a
KeyError
check when I merged the first time in #79435. Putting it back should allow this to deploy now. Added tests that fail without the check.