Skip to content

DeprecationWarning: sentry_sdk.configure_scope is deprecated  #94

Closed
@williamjamir

Description

@williamjamir

Hi,

Looks like the sentry_sdk is deprecating the configure_scope used here: https://github.com/snok/asgi-correlation-id/blob/main/asgi_correlation_id/extensions/sentry.py#L27

https://docs.sentry.io/platforms/python/migration/1.x-to-2.x#scope-configuring

Should this lib use the get_current_scope , or should it be a transaction thing, and should we use get_isolation_scope?
I'm seeing the following logs:

/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/asgi_correlation_id/extensions/sentry.py:27: in set_transaction_id
    with configure_scope() as scope:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

callback = None

    def configure_scope(  # noqa: F811
        callback=None,  # type: Optional[Callable[[Scope], None]]
    ):
        # type: (...) -> Optional[ContextManager[Scope]]
        """
        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.
        """
>       warnings.warn(
            "sentry_sdk.configure_scope is deprecated and will be removed in the next major version. "
            "Please consult our migration guide to learn how to migrate to the new API: "
            "https://docs.sentry.io/platforms/python/migration/1.x-to-2.x#scope-configuring",
            DeprecationWarning,
            stacklevel=2,
        )
E       DeprecationWarning: sentry_sdk.configure_scope is deprecated and will be removed in the next major version. Please consult our migration guide to learn how to migrate to the new API: https://docs.sentry.io/platforms/python/migration/1.x-to-2.x#scope-configuring

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions