Skip to content

Add Durable Object ID to Trace events#4939

Merged
anna-cf merged 1 commit intomainfrom
anna/trace-do-id
Sep 2, 2025
Merged

Add Durable Object ID to Trace events#4939
anna-cf merged 1 commit intomainfrom
anna/trace-do-id

Conversation

@anna-cf
Copy link
Copy Markdown
Contributor

@anna-cf anna-cf commented Aug 29, 2025

No description provided.

@anna-cf anna-cf requested review from fhanau and mar-cf August 29, 2025 14:55
@github-actions
Copy link
Copy Markdown

github-actions bot commented Aug 29, 2025

The generated output of @cloudflare/workers-types matches the snapshot in types/generated-snapshot 🎉

Copy link
Copy Markdown
Contributor

@fhanau fhanau left a comment

Choose a reason for hiding this comment

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

LGTM. This should also be supported in Streaming Tail Worker, but that can be done in a follow-up PR.

@danlapid
Copy link
Copy Markdown
Collaborator

danlapid commented Sep 1, 2025

LGTM. This should also be supported in Streaming Tail Worker, but that can be done in a follow-up PR.

@fhanau can you add some notes on what's required to make that happen?

@anna-cf anna-cf marked this pull request as ready for review September 2, 2025 10:47
@anna-cf anna-cf requested review from a team as code owners September 2, 2025 10:47
@anna-cf
Copy link
Copy Markdown
Contributor Author

anna-cf commented Sep 2, 2025

CI told me to run just generate-types to generate a snapshot, and that requires a review from @cloudflare/wrangler apparently. Pls take a look 🙇‍♀️

@fhanau
Copy link
Copy Markdown
Contributor

fhanau commented Sep 2, 2025

LGTM. This should also be supported in Streaming Tail Worker, but that can be done in a follow-up PR.

@fhanau can you add some notes on what's required to make that happen?

I pointed Anna to #4847 as an example for that, but the steps needed to add something to the STW API look like this:

  • Add the new field to the right STW event type (i.e. tracing::Onset::Onset, including constructor and clone() method)
  • To support the event being sent via RPC, add it to the capnp definition in src/workerd/io/worker-interface.capnp and update the event copyTo() method and the RPC-based constructor.
  • Emit the event in the right ToJs function in trace-stream.c++ (in this case ToJs(jsg::Lock& js, const tracing::Onset& onset, StringCache& cache))
  • Unlike most JSG APIs, we can't auto-generate types for the STW JS API since we use the ToJs mechanism. Accordingly, add the new field in types/defines/trace.d.ts and then update the generated types snapshot.
  • Update any affected tests – that would be src/workerd/api/tail-worker-test.js and some more downstream tests.

As mentioned, this is not needed in this PR.

@anna-cf anna-cf merged commit 42fd00f into main Sep 2, 2025
21 of 22 checks passed
@anna-cf anna-cf deleted the anna/trace-do-id branch September 2, 2025 16:56
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.

4 participants