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

Fix circular imports #3431

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions sentry_sdk/integrations/opentelemetry/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# TODO-neel-potel fix circular imports
# from sentry_sdk.integrations.opentelemetry.span_processor import ( # noqa: F401
# SentrySpanProcessor,
# )
from sentry_sdk.integrations.opentelemetry.span_processor import ( # noqa: F401
SentrySpanProcessor,
)

# from sentry_sdk.integrations.opentelemetry.propagator import ( # noqa: F401
# SentryPropagator,
# )
from sentry_sdk.integrations.opentelemetry.propagator import ( # noqa: F401
SentryPropagator,
)
3 changes: 2 additions & 1 deletion sentry_sdk/integrations/opentelemetry/span_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
INVALID_SPAN_ID,
INVALID_TRACE_ID,
)
from sentry_sdk import get_client, start_transaction
from sentry_sdk.integrations.opentelemetry.consts import (
SENTRY_BAGGAGE_KEY,
SENTRY_TRACE_KEY,
Expand Down Expand Up @@ -106,6 +105,8 @@ def _prune_old_spans(self):

def on_start(self, otel_span, parent_context=None):
# type: (OTelSpan, Optional[context_api.Context]) -> None
from sentry_sdk import get_client, start_transaction

client = get_client()

if not client.dsn:
Expand Down
3 changes: 2 additions & 1 deletion sentry_sdk/integrations/opentelemetry/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from sentry_sdk.tracing import get_span_status_from_http_code
from urllib3.util import parse_url as urlparse

from sentry_sdk import get_client
from sentry_sdk.utils import Dsn

from sentry_sdk._types import TYPE_CHECKING
Expand Down Expand Up @@ -43,6 +42,8 @@ def is_sentry_span(span):
Break infinite loop:
HTTP requests to Sentry are caught by OTel and send again to Sentry.
"""
from sentry_sdk import get_client

if not span.attributes:
return False

Expand Down
Loading