Associate a workflow run with a user (or other context) in telemetry without passing it to every step
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 42/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- backend-api-design, observability
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- TypeScript
- Stelle
- 2.5k
- Fork
- 401
- Merge medio
- 1g 21h
- PR unite (30g)
- 201
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di vercel/workflow
-
getPortLazy re-runs OS port discovery on every call when it finds no portForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
node-module-esbuild-plugin: getImportedIdentifier only checks the first named import when locating a violationForse già presa @div-cowboy l’ha presa 5 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
vercel/workflow#5057 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
code-transform.mdx §ID Generation omits the package-shipped `name@version` ID formForse già presa @Mohith26 l’ha presa 113 giorni fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di vercel/workflow
Issue simili
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 87/100
I maintainer di solito rispondono entro 1 giorno
-
🛠️ dette technique
Difficoltà 2/5 1-3 ore Idoneità per principianti 61/100
betagouv/mon-entreprise#4752 · 1 commento ·
I maintainer di solito rispondono entro 5 giorni
-
type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
franciscoBSalgueiro/en-croissant#1111 ·
I maintainer di solito rispondono entro 2 giorni
-
area/providers type/feature version/v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
anomalyco/opencode#64845 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno