Skip to content

Commit 9ecbc02

Browse files
committed
.
1 parent 1b18531 commit 9ecbc02

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

sentry_sdk/integrations/opentelemetry/span_processor.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from opentelemetry.sdk.trace import Span, ReadableSpan, SpanProcessor
1313

1414
import sentry_sdk
15-
from sentry_sdk._types import AnnotatedValue
1615
from sentry_sdk.consts import SPANDATA
1716
from sentry_sdk.tracing import DEFAULT_SPAN_ORIGIN
1817
from sentry_sdk.utils import get_current_thread_meta
@@ -152,12 +151,10 @@ def _flush_root_span(self, span):
152151
if span_json:
153152
spans.append(span_json)
154153

155-
if dropped_spans == 0:
156-
transaction_event["spans"] = spans
157-
else:
158-
transaction_event["spans"] = AnnotatedValue(
159-
spans, {"len": len(spans) + dropped_spans}
160-
)
154+
transaction_event["spans"] = spans
155+
if dropped_spans > 0:
156+
transaction_event["_dropped_spans"] = dropped_spans
157+
161158
# TODO-neel-potel sort and cutoff max spans
162159

163160
sentry_sdk.capture_event(transaction_event)

tests/tracing/test_misc.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def test_span_trimming(sentry_init, capture_events):
1515

1616
with start_span(name="hi"):
1717
for i in range(10):
18-
with start_span(op="foo{}".format(i)):
18+
with start_span(op=f"foo{i}"):
1919
pass
2020

2121
(event,) = events
@@ -29,7 +29,6 @@ def test_span_trimming(sentry_init, capture_events):
2929

3030
assert event["_meta"]["spans"][""]["len"] == 10
3131
assert "_dropped_spans" not in event
32-
assert "dropped_spans" not in event
3332

3433

3534
def test_span_data_scrubbing_and_trimming(sentry_init, capture_events):
@@ -42,7 +41,7 @@ def test_span_data_scrubbing_and_trimming(sentry_init, capture_events):
4241
span.set_data("datafoo", "databar")
4342

4443
for i in range(10):
45-
with start_span(op="foo{}".format(i)):
44+
with start_span(op=f"foo{i}"):
4645
pass
4746

4847
(event,) = events

0 commit comments

Comments
 (0)