Files
vercel__workflow/.changeset/nest-linked-invocations-under-delivery.md
Karthik Kalyan de91f20f68 otel: nest linked-mode invocations under the delivery context (route + execution in one trace) (#2527)
* otel: nest linked-mode invocations under the delivery context

Follow-up to the linked-trace mode shipped in #2363. In linked mode the
queue-delivered workflow.execute / step.execute spans were created as new
trace roots (root: true) with span links to both the delivery context and
the run-origin context. That split a single local invocation across two
traces: the framework route/server span and the workflow execution span
ended up in different traces connected only by a link.

This nests each invocation under its local delivery context instead:

- Drop `root: true` on the queue-delivered workflow.execute / step.execute
  spans so they become children of the active context — the framework
  route/server span when one exists, otherwise a clean root. One invocation
  (route handler, replay, inline steps, event writes) is now a single
  bounded trace.
- buildInvocationSpanLinks in linked mode now returns only the run-origin
  link; the delivery context is the parent, so it is no longer also a link.

The run-origin context remains a link (never a parent) and re-enqueues still
forward the original carrier unchanged, so a long-running run is still never
stitched into one giant trace across invocations. continuous mode is
unchanged. Everything remains a no-op when no OpenTelemetry SDK is
registered, and there is no dependency on any particular framework: with no
route/server span active, the invocation span is a clean root rather than an
orphan.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Update .changeset/nest-linked-invocations-under-delivery.md

Co-authored-by: Peter Wielander <mittgfu@gmail.com>
Signed-off-by: Karthik Kalyan <105607645+karthikscale3@users.noreply.github.com>

---------

Signed-off-by: Karthik Kalyan <105607645+karthikscale3@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Peter Wielander <mittgfu@gmail.com>
2026-06-18 16:04:02 -07:00

225 B

@workflow/core
@workflow/core
patch

Refine WORKFLOW_TRACE_MODE=linked (the default) so each queue-delivered workflow.execute / step.execute span nests under its local delivery context instead of starting a new trace root.