ref(init): Move sentry_sdk.init out of hub.py#3276
Conversation
| # Use `ClientConstructor` to define the argument types of `init` and | ||
| # `ContextManager[Any]` to tell static analyzers about the return type. |
There was a problem hiding this comment.
This comment is inaccurate, since we actually use _InitGuard in the class definition. However, since I am just copying this code over from hub for now, I think it is out of scope to fix here. Perhaps, we can consider fixing in a separate PR later.
There was a problem hiding this comment.
I also don't really know what the purpose of the _InitGuard is since we never tell people to do the following anywhere, so this is just vague unadvertised functionality.
with sentry_sdk.init():
passThere was a problem hiding this comment.
Indeed, perhaps we should explicitly deprecate this context manager functionality and remove in the next major, in that case? Or is this a potentially valuable feature we should advertise more?
There was a problem hiding this comment.
init is generally one per process anyway. In case people want DSN isolation, multiple clients is the way to go now. So I really don't see the use case for this.
Let's deprecate and remove.
There was a problem hiding this comment.
@sl0thentr0py, I opened an issue to make this change, since I think it belongs in a separate PR. Would appreciate an approval here if everything else looks good to you.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3276 +/- ##
==========================================
- Coverage 79.44% 79.43% -0.01%
==========================================
Files 132 133 +1
Lines 14278 14282 +4
Branches 2999 3000 +1
==========================================
+ Hits 11343 11345 +2
- Misses 2088 2089 +1
- Partials 847 848 +1
|
afa88eb to
1e82809
Compare
dcee881 to
c9727b7
Compare
dc69121 to
d5920bc
Compare
Now that the `Hub`-based API is deprecated, `sentry_sdk.init` should no longer be in `hub.py`. Since it is kind of its own thing, it makes sense to implement `init` in its own file. Closes #3233
d5920bc to
8e0040c
Compare
Now that the `Hub`-based API is deprecated, `sentry_sdk.init` should no longer be in `hub.py`. Since it is kind of its own thing, it makes sense to implement `init` in its own file. Closes getsentry#3233
Now that the
Hub-based API is deprecated,sentry_sdk.initshould no longer be inhub.py. Since it is kind of its own thing, it makes sense to implementinitin its own file.Closes #3233