8000 Global scope setters by a-d-collins · Pull Request #540 · getsentry/sentry-python · GitHub
[go: up one dir, main page]

Skip to content

Global scope setters #540

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

Merged
merged 14 commits into from
Oct 23, 2019
Merged

Conversation

a-d-collins
Copy link
Contributor

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.

a-d-collins and others added 14 commits October 2, 2019 15:07
…) 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
…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()
@codecov-io
Copy link
codecov-io commented Oct 23, 2019

Codecov Report

Merging #540 into master will decrease coverage by 1.19%.
The diff coverage is 50%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
sentry_sdk/api.py 50.81% <44.82%> (-1.87%) ⬇️
sentry_sdk/hub.py 77.94% <66.66%> (-0.22%) ⬇️
sentry_sdk/scope.py 78.48% <75%> (-0.68%) ⬇️
tests/integrations/aws_lambda/test_aws.py 23.94% <0%> (-69.02%) ⬇️
sentry_sdk/integrations/aws_lambda.py 0% <0%> (-19.66%) ⬇️
tests/conftest.py 71.42% <0%> (-8.25%) ⬇️
tests/test_serializer.py 82.35% <0%> (-5.89%) ⬇️
sentry_sdk/worker.py 82.79% <0%> (-1.08%) ⬇️
sentry_sdk/integrations/django/__init__.py 76.44% <0%> (-0.83%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 75f09c3...a997206. Read the comment docs.

@@ -483,8 +489,6 @@ def push_scope( # noqa

return _ScopeManager(self)

scope = push_scope
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine btw. We never documented this method

@untitaker untitaker merged commit 68ddcf4 into getsentry:master Oct 23, 2019
@untitaker
Copy link
Member

Thanks!

@a-d-collins a-d-collins deleted the global-scope-setters branch October 23, 2019 12:47
@a-d-collins
Copy link
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.

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.

3 participants
0