Skip to content

Remove scope.span = setter and make sure scope.span reference is correct in context manager regardless of source of span #4439

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 2 commits into from
Jun 4, 2025

Conversation

sl0thentr0py
Copy link
Member

closes #3509

@sl0thentr0py sl0thentr0py requested a review from a team as a code owner June 3, 2025 13:33
@@ -280,10 +279,6 @@ def __enter__(self):
# set as the implicit current context
self._ctx_token = context.attach(ctx)

# get the new scope that was forked on context.attach
Copy link
Member Author

Choose a reason for hiding this comment

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

this is now done universally in the context manager instead of here which would just affect the sentry created spans

rust_tracing.new_span(RustTracingLevel.Info, 3)
current_span = sentry_sdk.get_current_span()
assert current_span is not None
Copy link
Member Author

Choose a reason for hiding this comment

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

this was just INVALID_SPAN before so this test wasn't correct anyway

@sl0thentr0py sl0thentr0py force-pushed the neel/remove-scope-span-setter branch from f01cb0f to 605a673 Compare June 3, 2025 13:36
Copy link

codecov bot commented Jun 3, 2025

Codecov Report

Attention: Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.

Project coverage is 84.80%. Comparing base (bc9af26) to head (5dba74b).
Report is 2 commits behind head on potel-base.

Files with missing lines Patch % Lines
sentry_sdk/integrations/celery/__init__.py 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@              Coverage Diff               @@
##           potel-base    #4439      +/-   ##
==============================================
- Coverage       84.81%   84.80%   -0.02%     
==============================================
  Files             144      144              
  Lines           14726    14725       -1     
  Branches         2342     2343       +1     
==============================================
- Hits            12490    12487       -3     
  Misses           1523     1523              
- Partials          713      715       +2     
Files with missing lines Coverage Δ
sentry_sdk/opentelemetry/contextvars_context.py 100.00% <100.00%> (ø)
sentry_sdk/scope.py 82.22% <ø> (-0.09%) ⬇️
sentry_sdk/tracing.py 80.35% <ø> (-0.21%) ⬇️
sentry_sdk/tracing_utils.py 84.84% <100.00%> (ø)
sentry_sdk/integrations/celery/__init__.py 91.02% <66.66%> (ø)

... and 2 files with indirect coverage changes

Copy link
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

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

lgtm but please check failing tests

@sl0thentr0py sl0thentr0py force-pushed the neel/remove-scope-span-setter branch from 605a673 to 32ec148 Compare June 4, 2025 12:05
correct in context manager regardless of source of span.
@sl0thentr0py sl0thentr0py force-pushed the neel/remove-scope-span-setter branch from 32ec148 to 5dba74b Compare June 4, 2025 12:05
@sl0thentr0py sl0thentr0py changed the base branch from potel-base to neel/fix-decorator June 4, 2025 12:05
Base automatically changed from neel/fix-decorator to potel-base June 4, 2025 12:25
@sl0thentr0py sl0thentr0py merged commit cfbb8db into potel-base Jun 4, 2025
136 of 138 checks passed
@sl0thentr0py sl0thentr0py deleted the neel/remove-scope-span-setter branch June 4, 2025 12:25
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.

2 participants