Skip to content

Let TailStreamWriter remap exception stacks before delivery - #8116

Draft
WalshyDev wants to merge 1 commit into
cloudflare:mainfrom
WalshyDev:walshy/tail-stream-stack-remapper
Draft

WalshyDev wants to merge 1 commit into
cloudflare:mainfrom
WalshyDev:walshy/tail-stream-stack-remapper

Conversation

@WalshyDev

Copy link
Copy Markdown
Member

Buffered tail workers get exception stacks rewritten (e.g. by applying
source maps) before the traces are dispatched, but streaming tail
workers receive events as soon as they are reported, so there was no
place for an embedder to do the same.

Add an optional TailStreamWriter::StackRemapper that the writer
applies to each batch of queued events just before sending it. It is
only invoked when a remapper was supplied and the batch actually
contains an exception with a stack, so streams without one only pay
for an O(1) queue swap. A failed remap leaves the original stacks in
place rather than stopping the stream.

@WalshyDev
WalshyDev force-pushed the walshy/tail-stream-stack-remapper branch 2 times, most recently from f7eaf59 to c79bf87 Compare October 31, 2026 03:54
@WalshyDev
WalshyDev force-pushed the walshy/tail-stream-stack-remapper branch 2 times, most recently from dc79648 to 08b37a3 Compare November 3, 2026 21:35
Buffered tail workers get exception stacks rewritten (e.g. by applying
source maps) before the traces are dispatched, but streaming tail
workers receive events as soon as they are reported, so there was no
place for an embedder to do the same.

Add an optional TailStreamWriter::StackRemapper that the writer
applies to each batch of queued events just before sending it. It is
only invoked when a remapper was supplied and the batch actually
contains an exception with a stack, so streams without one only pay
for an O(1) queue swap. A failed remap leaves the original stacks in
place rather than stopping the stream.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant