本页还没有译文
本页 23 段还没译成한국어,下面显示的是英文原文。Observability
还没翻译译自英文(tanstack.com)本页 23 段都还没译
Observability
TanStack Workflow emits OpenTelemetry traces from the runtime and core engine.
The packages depend only on @opentelemetry/api; your application owns the OTel
SDK, exporter, collector, and provider setup.
If no OpenTelemetry SDK is configured, tracing is a no-op.
What is traced
The runtime creates spans for:
tanstack.workflow.start_runtanstack.workflow.deliver_signaltanstack.workflow.deliver_approvaltanstack.workflow.sweeptanstack.workflow.drive_run
Store calls made by the runtime are traced as child spans, such as
tanstack.workflow.store.claim_run,
tanstack.workflow.store.append_events, and
tanstack.workflow.store.claim_due_timers.
Fresh ctx.step executions create tanstack.workflow.step spans. Replayed
steps do not create fresh step execution spans because no user step code ran.
Privacy defaults
Workflow tracing intentionally does not record workflow input, workflow output, signal payloads, step results, or arbitrary step metadata as attributes.
Built-in attributes are stable identifiers and counts:
tanstack.workflow.workflow_idtanstack.workflow.workflow_versiontanstack.workflow.run_idtanstack.workflow.operationtanstack.workflow.result_kindtanstack.workflow.step_idtanstack.workflow.signal_nametanstack.workflow.schedule_idtanstack.workflow.bucket_idtanstack.workflow.lease_ownertanstack.workflow.event_counttanstack.workflow.events_truncated
If you want to add safe application attributes, pass telemetry.attributes or
telemetry.mapStepMeta.
Configure tracing
Initialize OpenTelemetry in your app before Workflow code runs. Then create the runtime normally:
import { defineWorkflowRuntime } from '@tanstack/workflow-runtime'
export const workflowRuntime = defineWorkflowRuntime({
store,
workflows,
})Workflow uses the global OpenTelemetry tracer provider by default.
To customize Workflow tracing:
export const workflowRuntime = defineWorkflowRuntime({
store,
workflows,
telemetry: {
spanNamePrefix: 'tanstack.workflow',
attributes: ({ workflowId }) => ({
'app.workflow_id': workflowId ?? 'unknown',
}),
mapStepMeta: (meta) => ({
'app.step_name': String(meta.name),
}),
},
})Only use mapStepMeta for metadata you know is safe to export. Workflow does
not export step metadata by default.
Disable tracing for a runtime:
export const workflowRuntime = defineWorkflowRuntime({
store,
workflows,
telemetry: false,
})Deployment notes
Host adapters do not need separate tracing configuration. Netlify, Vercel,
Cloudflare, and Railway helpers call runtime.sweep(), so they inherit the
runtime spans automatically.
For serverless platforms, initialize the OpenTelemetry SDK in the platform's recommended instrumentation entrypoint. Workflow only emits spans through the OpenTelemetry API; exporter flushing and process lifecycle are app concerns.