Skip to content
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

Use new scopes default integrations. #2856

Merged

Conversation

antonpirker
Copy link
Member

Related to #2817

@antonpirker antonpirker changed the base branch from master to sentry-sdk-2.0 March 19, 2024 15:39
sentry_sdk/tracing_utils.py Outdated Show resolved Hide resolved
sentry_sdk/tracing_utils.py Show resolved Hide resolved
@antonpirker antonpirker marked this pull request as ready for review March 20, 2024 13:58
with hub.configure_scope() as scope:
scope.clear_breadcrumbs()
scope.add_event_processor(_make_request_processor(weak_request))
scope.generate_propagation_context()
Copy link
Member Author

Choose a reason for hiding this comment

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

I know you mentioned this, but why is this necessary again?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if it is, but it's a direct translation to what the configure_scope was doing in the background:

def configure_scope( # noqa
self,
callback=None, # type: Optional[Callable[[Scope], None]]
continue_trace=True, # type: bool
):
# type: (...) -> Optional[ContextManager[Scope]]
"""
.. deprecated:: 2.0.0
This function is deprecated and will be removed in a future release.
Reconfigures the scope.
:param callback: If provided, call the callback with the current scope.
:returns: If no callback is provided, returns a context manager that returns the scope.
"""
scope = Scope.get_isolation_scope()
if continue_trace:
scope.generate_propagation_context()
if callback is not None:
# TODO: used to return None when client is None. Check if this changes behavior.
callback(scope)
return 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.

Got it. Thanks!

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.

Everything but aiohttp (which is what I did) looks good to me.

I'd advocate for adding breaking changes to the migration guide in this PR directly so that we don't forget.

Copy link
Member Author

@antonpirker antonpirker left a comment

Choose a reason for hiding this comment

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

I have one question (see comment) but otherwise looks good

@antonpirker antonpirker merged commit ac90b7e into sentry-sdk-2.0 Mar 20, 2024
111 checks passed
@antonpirker antonpirker deleted the antonpirker/new-scopes-default-integrations branch March 20, 2024 14:22
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