Skip to content

Commit 0e4755b

Browse files
authored
Fix circular imports (#3431)
1 parent 01835ed commit 0e4755b

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
# TODO-neel-potel fix circular imports
2-
# from sentry_sdk.integrations.opentelemetry.span_processor import ( # noqa: F401
3-
# SentrySpanProcessor,
4-
# )
1+
from sentry_sdk.integrations.opentelemetry.span_processor import ( # noqa: F401
2+
SentrySpanProcessor,
3+
)
54

6-
# from sentry_sdk.integrations.opentelemetry.propagator import ( # noqa: F401
7-
# SentryPropagator,
8-
# )
5+
from sentry_sdk.integrations.opentelemetry.propagator import ( # noqa: F401
6+
SentryPropagator,
7+
)

sentry_sdk/integrations/opentelemetry/span_processor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
INVALID_SPAN_ID,
1414
INVALID_TRACE_ID,
1515
)
16-
from sentry_sdk import get_client, start_transaction
1716
from sentry_sdk.integrations.opentelemetry.consts import (
1817
SENTRY_BAGGAGE_KEY,
1918
SENTRY_TRACE_KEY,
@@ -106,6 +105,8 @@ def _prune_old_spans(self):
106105

107106
def on_start(self, otel_span, parent_context=None):
108107
# type: (OTelSpan, Optional[context_api.Context]) -> None
108+
from sentry_sdk import get_client, start_transaction
109+
109110
client = get_client()
110111

111112
if not client.dsn:

sentry_sdk/integrations/opentelemetry/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from sentry_sdk.tracing import get_span_status_from_http_code
99
from urllib3.util import parse_url as urlparse
1010

11-
from sentry_sdk import get_client
1211
from sentry_sdk.utils import Dsn
1312

1413
from sentry_sdk._types import TYPE_CHECKING
@@ -43,6 +42,8 @@ def is_sentry_span(span):
4342
Break infinite loop:
4443
HTTP requests to Sentry are caught by OTel and send again to Sentry.
4544
"""
45+
from sentry_sdk import get_client
46+
4647
if not span.attributes:
4748
return False
4849

0 commit comments

Comments
 (0)