Skip to content

Commit d9874db

Browse files
committed
fix multiple envelopes being sent from the batcher
1 parent 3f985c4 commit d9874db

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

sentry_sdk/_span_batcher.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,15 @@ def _to_transport_format(item: "StreamedSpan") -> "Any":
9191

9292
return res
9393

94-
def _flush(self) -> "Optional[Envelope]":
94+
def _flush(self) -> None:
9595
with self._lock:
9696
if len(self._span_buffer) == 0:
9797
return None
9898

9999
for trace_id, spans in self._span_buffer.items():
100100
if spans:
101+
for span in spans:
102+
print(span.name)
101103
dsc = spans[0].dynamic_sampling_context()
102104
# XXX[span-first]: empty dsc?
103105

@@ -126,7 +128,6 @@ def _flush(self) -> "Optional[Envelope]":
126128
)
127129
)
128130

129-
self._span_buffer.clear()
131+
self._capture_func(envelope)
130132

131-
self._capture_func(envelope)
132-
return envelope
133+
self._span_buffer.clear()

0 commit comments

Comments
 (0)