ref: Integration options now live on the client#101
Conversation
Codecov Report
@@ Coverage Diff @@
## master #101 +/- ##
==========================================
- Coverage 68.76% 66.91% -1.86%
==========================================
Files 25 25
Lines 2347 2457 +110
Branches 319 352 +33
==========================================
+ Hits 1614 1644 +30
- Misses 620 680 +60
- Partials 113 133 +20
Continue to review full report at Codecov.
|
| hub = Hub.current | ||
| event, hint = event_from_exception( | ||
| (exctype, value, traceback), | ||
| with_locals=hub.client.options["with_locals"], |
There was a problem hiding this comment.
I don't quite like this entire pattern of accessing Integration.current + Hub.current + assuming that Hub.current.client then is not none. What if we have a method that returns (integration, hub) or (None, None) if the integration is not configured or hub is none or client is none?
There was a problem hiding this comment.
Are you concerned about performance or the potential race condition? I would claim that the race condition is practically irrelevant.
There was a problem hiding this comment.
I'm mostly concerned because the thing is nullable and every time I read such code I'm not sure if the programmer validated that it's not none here. Rust broke me to look at nullables in a different way now :) Performance i'm not that much concerned.
There was a problem hiding this comment.
Ok, I know what you mean but this instance of nullability in particular should be caught by tests. I don't think adding another layer of indirection is really going to help.
| event = new_event | ||
|
|
||
| for processor in self._event_processors: | ||
| for processor in chain(self._event_processors, global_event_processors): |
There was a problem hiding this comment.
Shouldn't it be chain(global_event_processors, self._event_processors)?
There was a problem hiding this comment.
I imagine that every event processor looks like this:
if "key" not in event:
event["key"] = "bar"
and not like this:
event["key"] = "bar"
In the first example, the first event processor sets "key" and every other event processor skips their logic. So the first processor wins.
In the second example the last processor wins, as its the only one whose value does not get overridden.
The reason is that scopes are applied to the event before event processors are, and data set on the scope should win over data set by integrations.
I wonder if we should apply event processors to the event before we apply scope data.
|
|
||
| def install(self): | ||
| @staticmethod | ||
| def install(): |
70647c2 to
ee207e2
Compare
b4daed0 to
250fdd8
Compare
mitsuhiko
left a comment
There was a problem hiding this comment.
I think this is good now.
39c6563 to
8604b28
Compare
44b133a to
8a5aaff
Compare
fix #100