Skip to content

Commit

Permalink
Fix circular imports for sphinx (#3986)
Browse files Browse the repository at this point in the history
  • Loading branch information
sl0thentr0py authored Jan 22, 2025
1 parent 9df9cbf commit 2894963
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import sphinx.ext.autodoc # noqa: F401
import sphinx.ext.intersphinx # noqa: F401
import urllib3.exceptions # noqa: F401
import importlib_metadata # noqa: F401
import opentelemetry.sdk.metrics._internal # noqa: F401

typing.TYPE_CHECKING = True

Expand Down
8 changes: 4 additions & 4 deletions sentry_sdk/integrations/opentelemetry/contextvars_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

if TYPE_CHECKING:
from typing import Optional
from sentry_sdk.integrations.opentelemetry.scope import PotelScope
import sentry_sdk.integrations.opentelemetry.scope as scope


class SentryContextVarsRuntimeContext(ContextVarsRuntimeContext):
Expand All @@ -29,16 +29,16 @@ def attach(self, context):

should_use_isolation_scope = context.pop(SENTRY_USE_ISOLATION_SCOPE_KEY, None)
should_use_isolation_scope = cast(
"Optional[PotelScope]", should_use_isolation_scope
"Optional[scope.PotelScope]", should_use_isolation_scope
)

should_use_current_scope = context.pop(SENTRY_USE_CURRENT_SCOPE_KEY, None)
should_use_current_scope = cast(
"Optional[PotelScope]", should_use_current_scope
"Optional[scope.PotelScope]", should_use_current_scope
)

if scopes:
scopes = cast("tuple[PotelScope, PotelScope]", scopes)
scopes = cast("tuple[scope.PotelScope, scope.PotelScope]", scopes)
(current_scope, isolation_scope) = scopes
else:
current_scope = sentry_sdk.get_current_scope()
Expand Down
4 changes: 2 additions & 2 deletions sentry_sdk/integrations/opentelemetry/propagator.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

if TYPE_CHECKING:
from typing import Optional, Set
from sentry_sdk.integrations.opentelemetry.scope import PotelScope
import sentry_sdk.integrations.opentelemetry.scope as scope


class SentryPropagator(TextMapPropagator):
Expand Down Expand Up @@ -94,7 +94,7 @@ def inject(self, carrier, context=None, setter=default_setter):

scopes = get_value(SENTRY_SCOPES_KEY, context)
if scopes:
scopes = cast("tuple[PotelScope, PotelScope]", scopes)
scopes = cast("tuple[scope.PotelScope, scope.PotelScope]", scopes)
(current_scope, _) = scopes

# TODO-neel-potel check trace_propagation_targets
Expand Down

0 comments on commit 2894963

Please sign in to comment.