Skip to content
Closed
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
7 changes: 6 additions & 1 deletion sentry_sdk/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from functools import wraps
from itertools import chain

from opentelemetry.trace import Span as OTelSpan

from sentry_sdk._types import AnnotatedValue
from sentry_sdk.attachments import Attachment
from sentry_sdk.consts import (
Expand Down Expand Up @@ -748,7 +750,10 @@ def span(self):
def span(self, span):
# type: (Optional[Span]) -> None
"""Set current tracing span."""
self._span = span
if isinstance(span, OTelSpan):
self._span = Span(otel_span=span)
else:
self._span = span

@property
def profile(self):
Expand Down
6 changes: 3 additions & 3 deletions sentry_sdk/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from opentelemetry.trace import (
format_trace_id,
format_span_id,
Span as OtelSpan,
Span as OTelSpan,
TraceState,
get_current_span,
INVALID_SPAN,
Expand Down Expand Up @@ -182,7 +182,7 @@ def __init__(
attributes=None, # type: Optional[dict[str, Any]]
only_if_parent=False, # type: bool
parent_span=None, # type: Optional[Span]
otel_span=None, # type: Optional[OtelSpan]
otel_span=None, # type: Optional[OTelSpan]
):
# type: (...) -> None
"""
Expand Down Expand Up @@ -319,7 +319,7 @@ def origin(self, value):
def root_span(self):
# type: () -> Optional[Span]
root_otel_span = cast(
"Optional[OtelSpan]", get_sentry_meta(self._otel_span, "root_span")
"Optional[OTelSpan]", get_sentry_meta(self._otel_span, "root_span")
)
return Span(otel_span=root_otel_span) if root_otel_span else None

Expand Down
Loading