Stop writing an empty trace payload from the tail exporter - #272
Stop writing an empty trace payload from the tail exporter#272ayaangazali wants to merge 1 commit into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthrough
Merge Risk: ⚪ Minimal · up to The PR prevents empty trace payloads from being emitted while preserving successful empty exports and non-empty span delivery; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Your free Security trial is over. An organization admin can activate billing to continue. Comment |
|
Seven days, so a status note rather than a new question. Still reproduces on Green, no conflicts, drift 0 on the two files it touches, and CodeRabbit approved it on the 25th. Worth restating one thing from the body, since it is the part I would push back on if I were reviewing: restoring Happy to close this if the Cloudflare packages are parked for now. I would rather that than have it sit in your queue. Built this with Claude Code's help and reviewed the diff myself. |
TailWorkerExporter.shutdown()callssendSpans([]), which serializes a batch of zero spans and logs the result.JsonTraceSerializer.serializeRequest([])returns{"resourceSpans":[]}, so every shutdown writes an empty export into the tail stream.That matters because of how the payload is picked up.
exportTailEventsToLogfireforwards the first logged object that has aresourceSpanskey, and an empty one qualifies. On4691011, with the empty payload logged before the real one in the same batch:The request goes out empty and
real-spanis never sent.The fix returns early from
sendSpanswhen the batch is empty, which coversexport([])as well, and drops thesendSpans([])call fromshutdownsince emitting that payload was its only effect. The exporter has nothing to flush anyway: each batch is written as it arrives.Two regressions, in a new test file next to the exporter: an empty export plus a shutdown write nothing and still report success, and a batch with a span still writes its payload. The first fails without the guard, the second fails if the guard returns unconditionally.
Built this with Claude Code's help and reviewed the diff myself.