Skip to content

Commit 21ad3ca

Browse files
committed
.
1 parent a98293d commit 21ad3ca

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

sentry_sdk/scope.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,18 +1852,17 @@ def apply_to_telemetry(self, telemetry: "Union[Log, Metric, StreamedSpan]") -> N
18521852
# span_id should only be populated if there's an active span. We can't
18531853
# use the trace_context here because it synthesizes a span_id if there
18541854
# isn't one
1855-
if (
1856-
telemetry.get("span_id") is None
1857-
and self._span is not None
1858-
and not isinstance(self._span, NoOpStreamedSpan)
1859-
):
1860-
telemetry["span_id"] = self._span.span_id
1861-
else:
1862-
external_propagation_context = get_external_propagation_context()
1863-
if external_propagation_context:
1864-
_, span_id = external_propagation_context
1865-
if span_id is not None:
1866-
telemetry["span_id"] = span_id
1855+
if telemetry.get("span_id") is None:
1856+
if self._span is not None and not isinstance(
1857+
self._span, NoOpStreamedSpan
1858+
):
1859+
telemetry["span_id"] = self._span.span_id
1860+
else:
1861+
external_propagation_context = get_external_propagation_context()
1862+
if external_propagation_context:
1863+
_, span_id = external_propagation_context
1864+
if span_id is not None:
1865+
telemetry["span_id"] = span_id
18671866

18681867
self._apply_scope_attributes_to_telemetry(telemetry)
18691868
self._apply_user_attributes_to_telemetry(telemetry)

0 commit comments

Comments
 (0)