Skip to main content
After this page you can send every workflow and step run to the tracing backend your team already uses, and add your own spans that nest under the step that created them. Set OUTPUT_OTEL_ENABLED=true and the worker exports Temporal’s OpenTelemetry spans over OTLP: a span for every workflow run, every step call, and every step attempt, with errors and timing. Leave it unset and nothing changes. This is separate from Output’s tracing. Trace files record what each step received and returned, the LLM prompts and results, token usage, and cost. OpenTelemetry spans record the shape and timing of a run, in the same backend as the rest of your services, and carry no step inputs or outputs. The two run side by side, so turning one on doesn’t affect the other.

Quick Start

Start your project with output dev, then run Jaeger on the same Docker network as the worker:
(output-sdk_main is the network output dev creates. If you set DOCKER_SERVICE_NAME, it is <DOCKER_SERVICE_NAME>_main.) Point the worker at it:
.env
Restart output dev so the worker picks up the variables. With OpenTelemetry off, the startup log says so:
Run a workflow:
Open http://localhost:16686, pick blog-evaluator-worker in the service list, and open the trace.

What Gets Exported

Each workflow run is one trace. A real run looks like this:
Temporal names the spans, and Output keeps its names: Output’s internal activities, such as __internal#getTraceDestinations, appear alongside your steps. Errors. A failed attempt marks its RunActivity span as an error and records the ApplicationFailure Temporal built from what your step threw, with its message and type. When the last attempt fails, StartActivity records an ActivityFailure wrapping it, and so does RunWorkflow if the failure ends the run. Replays. Temporal replays workflow code to rebuild its state, for example after a worker restart. Spans are only exported for new work, so a replay doesn’t send duplicates.
Every span created in workflow code (RunWorkflow, StartActivity, StartChildWorkflow) carries the full workflowInfo() as attributes: the workflow’s memo, search attributes, and the result or failure of the previous run. Don’t put anything in search attributes that your tracing backend shouldn’t store.

Configuration

Output reads two variables of its own: Everything else is a standard OTEL_* variable, read by the OpenTelemetry packages themselves, not by Output. The ones you’ll usually set: The exporter also reads OTEL_EXPORTER_OTLP_TIMEOUT, OTEL_EXPORTER_OTLP_COMPRESSION and the certificate variables, each with a _TRACES_ variant. Spans are sent as OTLP over HTTP with protobuf payloads (http/protobuf), the protocol the OpenTelemetry specification recommends as the default. gRPC isn’t supported, so point the endpoint at the collector’s HTTP port (4318 by default).

Variables Output Doesn’t Honor

The OpenTelemetry specification defines more variables than the packages Output uses read. These have no effect: To send spans straight to Honeycomb:
.env

Adding Your Own Spans

You create spans with the OpenTelemetry API, and Output places them in the trace based on where your code runs: Install the OpenTelemetry API in your project:
Keep @opentelemetry/api on 1.9.x, the version Output sets up the tracer with. A newer minor version can’t use that setup and returns a tracer that does nothing, so your spans disappear without an error.

In Steps

Start spans from a tracer:
The trace now shows company_lookup under RunActivity:lead_enrichment#lookup_company, once per attempt. The name you pass to trace.getTracer(), lead-enrichment here, labels the code that created the spans. OpenTelemetry calls it the instrumentation scope, and backends show it on each span (as otel.scope.name or the library name), so you can filter by it. It doesn’t change where the spans nest or which service they belong to; that’s OTEL_SERVICE_NAME. Use your project’s or module’s name. LLM calls through @outputai/core/llm don’t emit OpenTelemetry spans. Their prompts, results, token usage, and cost are in Output’s trace files. If a step calls the AI SDK directly, its experimental_telemetry option emits spans that nest under the step like your own.

In Hooks

Hooks that react to a step run inside that step’s context, so their spans nest under its RunActivity span. They run after the event, so their spans can end after the step’s span does, and backends still show them under it:
audit_step shows up under each step’s RunActivity span. audit_workflow starts its own trace: workflow hooks run on the worker after Temporal processes the workflow’s progress, outside any span. To find it next to the workflow’s trace, set the workflow ID as temporalWorkflowId, the attribute Temporal puts on its RunActivity spans, and search your backend by it.

Output Owns the Tracer Setup

OpenTelemetry has one global tracer provider per process, and the first one registered wins. Output registers its own before it loads your hooks and steps, so leave the setup to Output and only call trace.getTracer() in your code. If something else registers a provider first, such as an APM agent preloaded with NODE_OPTIONS=--import, the worker warns at startup:
The trace is then split in two: step spans and your own spans go to that provider, and workflow spans go to the OTLP endpoint. A provider registered after Output’s is refused, and OpenTelemetry’s error about the duplicate registration shows up in the worker logs. In both cases, remove the other setup. If your project installs a second copy of @opentelemetry/api that Temporal resolves instead of Output’s, Temporal can’t see Output’s setup and step spans are dropped. The worker warns at startup:
Align your project’s @opentelemetry/api with the version @outputai/core depends on, so a single copy is installed. OpenTelemetry’s own warnings and errors are logged under the OTEL namespace, at the levels set by OUTPUT_LOG_LEVEL.

Delivery and Volume

Spans are batched in memory and exported every 5 seconds, 512 at a time. The queue holds 2048 spans, and spans that arrive when it is full are dropped. Tune it with the standard variables: A failed export is logged as an error under the OTEL namespace and its spans are dropped. Workflows and steps keep running, so a collector outage costs spans, not runs. Leave OTEL_TRACES_SAMPLER unset and sample in your collector, where it can keep or drop whole traces. Workflow spans are always recorded, and OTEL_TRACES_SAMPLER applies only to step spans: On shutdown, the worker exports the spans still queued, in parallel with the hook flush, for up to OUTPUT_OTEL_FLUSH_TIMEOUT_MS (5000), whatever the exporter’s own timeout. Spans not exported by then are dropped with a warning. Spans that hook callbacks create during the flush aren’t included. See Worker Shutdown for how it fits the shutdown budget.

Rolling It Out

Turning OpenTelemetry on or off changes the worker’s workflow bundle, so its build ID changes too. Output doesn’t use Temporal’s worker versioning, so the build ID doesn’t affect routing. Workflows already running when you deploy keep running on the new worker. A run started before OpenTelemetry was on exports only the spans for the work done after the switch, so its trace is partial.

Next Steps

Tracing

Output’s trace files, with step inputs, outputs, LLM calls, and cost.

Worker Shutdown

Size the shutdown settings and read the shutdown logs.

Deployment

Deploy workers to Render, Railway, or your own platform.