Files
vercel__workflow/workbench/example/instrumentation.ts
Pranay Prakash 3859d338e3 Propagate trace context to vercel-workflow.com in workbench instrumentation (#2601)
* Propagate trace context to vercel-workflow.com in workbench instrumentation

@vercel/otel only propagates W3C trace context to Vercel deployment URLs
by default, so outgoing requests to the workflow-server
(vercel-workflow.com) got a client span with no `traceparent` header —
breaking the APM trace link to workflow-server's spans. Add
`instrumentationConfig.fetch.propagateContextUrls` for the workflow-server
domain in every workbench that uses @vercel/otel: example,
nextjs-turbopack, nextjs-webpack, and sveltekit. The Next.js and SvelteKit
apps already declared @vercel/otel but weren't registering it at all; they
now do.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* Also propagate trace context to the Vercel Queue Service (vercel-queue.com)

The workflow-server queue path (@vercel/queue) sends to regional
vercel-queue.com subdomains (e.g. iad1.vercel-queue.com) when not using the
queues proxy, which were missing a `traceparent` header for the same reason
as vercel-workflow.com. Add `/vercel-queue\.com/` to propagateContextUrls in
all four workbench instrumentation configs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 16:13:55 -07:00

19 lines
775 B
TypeScript

import { registerOTel } from '@vercel/otel';
registerOTel({
serviceName: 'example-workflow',
instrumentationConfig: {
fetch: {
// By default @vercel/otel only propagates W3C trace context to Vercel
// deployment URLs, so outgoing requests to the workflow-server
// (vercel-workflow.com) and the Vercel Queue Service
// (*.vercel-queue.com) get a client span with no `traceparent` header —
// which breaks the trace link to those services' spans in APM.
// Explicitly propagate context to both domains so traces stay
// correlated end to end.
// https://vercel.com/docs/tracing/instrumentation#configuring-context-propagation
propagateContextUrls: [/vercel-workflow\.com/, /vercel-queue\.com/],
},
},
});