Associate a workflow run with a user (or other context) in telemetry without passing it to every step
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 42/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- typescript
- Domain
- backend-api-design, observability
Research direction
Read the related issues #1933, #132, and #3456, then trace how run attributes, invocation baggage, and runContext move through start(), step dispatch, and child runs. The issue offers multiple possible designs, so first determine which approach fits the existing runtime and telemetry APIs. Done means run context is available synchronously to spans across queued steps and child runs without adding user IDs to outgoing HTTP baggage headers.
Written by the indexing model from the issue text.
Description
Problem
We want every span a run produces to carry who it's for, such as user.id or a tenant ID. Most telemetry backends attribute data per span, so the value has to be available synchronously wherever a span starts, which includes every step. Today the only way is to pass it as an argument to every step, which is tedious and easy to get wrong, because nested steps that don't receive it lose attribution silently.
Nothing in the SDK carries it for us:
- Attributes are write-only inside a run. start({ attributes }) works, but there's no read API. getWorkflowMetadata() doesn't include them.
- Queued steps don't load the run. Since #3456, the dispatch message's runContext doesn't carry attributes.
- Baggage is replaced. withWorkflowBaggage replaces any application baggage with just workflow.run_id and workflow.name.
- Linked mode restores nothing from start(). The start() context is only a span link.
- Child runs don't inherit attributes. They get only $parentRunId and $rootRunId.
- Our workaround: a span processor stamps workflow.run_id from the baggage onto spans, and an exporter wrapper calls world.runs.get() (cached, following $rootRunId for child runs) to add the user at export time. It costs a network call per run per instance and only works for exporters we wrap.
Proposal (either one)
A. Read a run's own attributes synchronously in steps, as #1933 already plans:
const { attributes } = getWorkflowMetadata();
Carry them on the step dispatch runContext next to rootRunId so queued steps still don't fetch the run. They're bounded at 64 × 256 bytes.
B. Propagated telemetry context, settable at start() or from "use workflow" / "use step":
await start(wf, args, { telemetry: { baggage: { "user.id": userId } } });
await setTelemetryBaggage({ "user.id": userId }); // recorded in the event log, like setAttributes
The runtime would merge these into the invocation baggage instead of replacing it, carry them on dispatch messages, and pass them to child runs. It should keep them off outgoing HTTP baggage headers so user IDs don't leak to third parties.
Both could also share one mechanism: attributes marked for propagation (start(wf, args, { attributes, propagateAttributes: ["userId"] })).
Related: #1933, #132, #3456. Versions: workflow 5.2.0, @vercel/otel, default linked trace mode.
- Dominant language
- TypeScript
- Stars
- 2.5k
- Forks
- 401
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 201
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from vercel/workflow
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
node-module-esbuild-plugin: getImportedIdentifier only checks the first named import when locating a violationPossibly taken @div-cowboy claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
vercel/workflow#5057 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
code-transform.mdx §ID Generation omits the package-shipped `name@version` ID formPossibly taken @Mohith26 claimed this 113 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day
Similar issues
-
db-d1-sqlite: upsert is aliased to updateOne, so payload.kv.set never inserts new keysPossibly taken @pcbeingused333 claimed this today. OpenBug db: d1-sqlite Payload OSS
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
payloadcms/payload#19766 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
device-management-toolkit/sample-web-ui#3711 ·
Maintainers usually reply within 1 day
-
bug impact:low Team: SecuritySolution Team:Defend Workflows v9.6.0
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
elastic/kibana#306401 · 3 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
agentes-chat/agentes-chat#927 ·
Maintainers usually reply within 1 day
-
Closing a pinned tab jumps to the Tabs section instead of the next open pinned tabPossibly taken @seenimohamed claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ardia-browser/ardia#2769 ·
Maintainers usually reply within 1 day