Global scope setters#540
Merged
Merged
Conversation
…) update Hub.push_scope() to allow it to act as both a contentmanager and a decorator, (api.py, utils.py) add new scopemethod api methods {set_tag, set_extra, set_user, set_level} that allow for updating of the current scope
…ator inherit from contextlib.ContextDecorator
…corator with _ScopeManager
…tDecorator compat issue, (sentry_sdk/api.py) update typing to match that of Hub.push_scope()
…(tests/test_basics.py) remove unneeded test_scope_leaks_cleaned_up()
…(sentry_sdk/_compat.py) satisfy linters
…() 'as a decorator' code
…yle in rest of file
Codecov Report
@@ Coverage Diff @@
## master #540 +/- ##
=========================================
- Coverage 85.83% 84.63% -1.2%
=========================================
Files 107 107
Lines 8766 8801 +35
Branches 899 904 +5
=========================================
- Hits 7524 7449 -75
- Misses 921 1032 +111
+ Partials 321 320 -1
Continue to review full report at Codecov.
|
untitaker
reviewed
Oct 23, 2019
|
|
||
| return _ScopeManager(self) | ||
|
|
||
| scope = push_scope |
Member
There was a problem hiding this comment.
I think this is fine btw. We never documented this method
untitaker
approved these changes
Oct 23, 2019
Member
|
Thanks! |
Contributor
Author
|
Of course! And this looks like it will work well with #530. Once that PR is merged, the global set_extras and set_tags methods can be created. |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This merge would allow the current scope's level, user, tags, context, and extras to be modified at the global scope.
NOTE: This is a follow-up to pull-request #523 which attempted to allow push_scope() to function as a decorator.