fix(tracer,metrics): propagate flush() through to exporter#8
Open
stackbilt-admin wants to merge 1 commit intomainfrom
Open
fix(tracer,metrics): propagate flush() through to exporter#8stackbilt-admin wants to merge 1 commit intomainfrom
stackbilt-admin wants to merge 1 commit intomainfrom
Conversation
Tracer.flush() and MetricsCollector.flush() only drained their own local buffer into options.export.export(...) — they never called options.export.flush() to force the exporter to POST. On Cloudflare Workers the default StackbiltCloudExporter buffers across requests and only POSTs at a 100-item / 50KB threshold; low-volume isolates get evicted long before that trips, so buffered spans die silently. Option B from #7: make the flush chain transitive. Add an optional flush?() to SpanExporter and MetricsExporter interfaces, and call it after export() in both collectors. Exporters without flush() are unaffected (backward-compatible). Verified end-to-end in tarotscript-worker dogfood instance: after applying the same pattern to that worker's consumer-side shim, traces landed on every request instead of only at the 100-span batch boundary. Closes #7. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
`Tracer.flush()` and `MetricsCollector.flush()` only drained their local buffer into `options.export.export(...)` — they never called `options.export.flush()` to force a real POST. On Cloudflare Workers the default `StackbiltCloudExporter` buffers across requests and only POSTs at a 100-item / 50KB threshold; low-volume isolates get evicted long before that trips, so buffered spans die silently.
Option B from the issue: make the flush chain transitive. Added an optional `flush?()` to `SpanExporter` and `MetricsExporter` interfaces, and call it after `export()` in both collectors. Exporters without `flush()` are unaffected (backward-compatible).
Test plan
Dogfood evidence
Verified end-to-end in `tarotscript-worker` (deployed version `9d53b2c3-08a2-415a-8d95-b252e6e6f610`): after applying the same flush-chain pattern to that worker's consumer-side shim, traces landed on every request instead of only at the batch boundary. This PR lifts that workaround into the library.
Closes #7
🤖 Generated with Claude Code