Skip to content

Add preview metadata to buffered tail traces#6375

Open
Ankcorn wants to merge 1 commit intocloudflare:mainfrom
Ankcorn:tankcorn/preview-observability
Open

Add preview metadata to buffered tail traces#6375
Ankcorn wants to merge 1 commit intocloudflare:mainfrom
Ankcorn:tankcorn/preview-observability

Conversation

@Ankcorn
Copy link

@Ankcorn Ankcorn commented Mar 20, 2026

Summary

Add preview metadata to buffered tail traces.

This exposes:

  trace.preview = { id, slug, name }

to classic/buffered tail workers.

Why Why

edgeworker needs to surface pipeline-level preview identity in classic tail worker
observability.

That requires workerd to support carrying preview metadata through the buffered trace path;
otherwise classic tail workers only receive traces without any preview context.

Changes

  • add top-level preview field to rpc::Trace
  • add in-memory TracePreview
  • serialize / deserialize it through io/trace.*
  • expose it on the JS buffered tail trace API as trace.preview
  • add a focused round-trip trace test

Notes

This only adds the workerd support layer. The corresponding edgeworker change is what populates
this field from pipeline preview metadata.

@Ankcorn Ankcorn requested review from a team as code owners March 20, 2026 17:18
@github-actions
Copy link


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.


TraceEventInfo::TraceItem::TraceItem(rpc::Trace::TraceEventInfo::TraceItem::Reader reader)
: scriptName(kj::str(reader.getScriptName())) {}
: scriptName(reader.hasScriptName() ? kj::Maybe<kj::String>(kj::str(reader.getScriptName()))
Copy link
Author

@Ankcorn Ankcorn Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opencode drive by changed this because it thinks the old implementation has a bug...

IMO seems suss and I'm going to revert this line but hello @danlapid I just wanted to flag it to you incase opencode smarter than me

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