Skip to content

Commit 06c2a40

Browse files
fix item_count
1 parent 7c3da4f commit 06c2a40

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

sentry_sdk/client.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,23 +1126,21 @@ def capture_event(
11261126
event_opt["spans"] = non_gen_ai_spans
11271127
envelope.add_transaction(event_opt)
11281128

1129+
converted_gen_ai_spans = [
1130+
_serialized_v1_span_to_serialized_v2_span(span, event)
1131+
for span in gen_ai_spans
1132+
if isinstance(span, dict)
1133+
]
1134+
11291135
envelope.add_item(
11301136
Item(
11311137
type=SpanBatcher.TYPE,
11321138
content_type=SpanBatcher.CONTENT_TYPE,
11331139
headers={
1134-
"item_count": len(gen_ai_spans),
1140+
"item_count": len(converted_gen_ai_spans),
11351141
},
11361142
payload=PayloadRef(
1137-
json={
1138-
"items": [
1139-
_serialized_v1_span_to_serialized_v2_span(
1140-
span, event
1141-
)
1142-
for span in gen_ai_spans
1143-
if isinstance(span, dict)
1144-
]
1145-
},
1143+
json={"items": converted_gen_ai_spans},
11461144
),
11471145
)
11481146
)

0 commit comments

Comments
 (0)