test(langfuse_otel): drain wire batches per poll instead of accumulating

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
yucheng 2026-09-23 08:33:52 +00:00
parent 7328bb86af
commit bc6d6a516d

View file

@ -79,13 +79,10 @@ def _langfuse_rig(
def _observation_span(collector: Wire, response_id: str) -> dict[str, object]:
batches: Final[list[Request]] = [] # mutable-ok: drain() consumes the queue, so accumulating needs a mutable list
def spans() -> tuple[dict[str, object], ...]:
batches.extend(collector.drain())
return tuple(
attributes
for batch in batches
for batch in collector.drain()
for attributes in _span_attributes(batch.body)
if attributes.get("llm.response.id") == response_id
)