@arizeai/phoenix-otel is the Phoenix-focused OpenTelemetry package for Node.js. It wraps provider setup, span export, instrumentation registration, and a few convenience utilities for Phoenix-specific tracing workflows.
Install
Install the package and any OpenTelemetry instrumentations you want to use with it.Recommended — Add OpenInference Core
@arizeai/openinference-core provides tracing helpers (withSpan, traceChain, traceAgent, traceTool), decorators (@observe), and context setters (setSession, setUser, setMetadata, setTag) that work on top of the provider registered by phoenix-otel. Install it alongside phoenix-otel for the best tracing experience.
Add Instrumentations
Typical Pairings
@arizeai/phoenix-otelplus@arizeai/openinference-corefor manual tracing with span-kind helpers and context propagation@arizeai/phoenix-otelplus OpenTelemetry instrumentations for automatic framework tracing@arizeai/phoenix-otelplus@arizeai/phoenix-clientfor experiment workflows@arizeai/phoenix-otelplus framework-specific OpenInference instrumentors (e.g.@arizeai/openinference-instrumentation-openai)
Quick Start
Docs And Source In node_modules
After install, a coding agent can inspect the installed package directly:
Configuration
register() can use explicit options, environment variables, or both. If you pass a Phoenix base URL, the package normalizes it to the OTLP collector endpoint at /v1/traces.
Environment-Driven Setup
Explicit Setup
Key Options
| Option | Description |
|---|---|
projectName | Phoenix project name attached to exported spans. Defaults to default. |
url | Phoenix base URL or full collector endpoint. The package appends /v1/traces when needed. |
apiKey | API key sent as a bearer token. Falls back to PHOENIX_API_KEY. |
headers | Additional OTLP headers merged with the auth header. |
batch | true for batched export, false for immediate export during debugging. |
instrumentations | OpenTelemetry instrumentations to register with the provider. |
spanProcessors | Custom span processors. When provided, these replace the default Phoenix exporter setup. |
global | Whether to attach the provider to the global OpenTelemetry APIs automatically. |
diagLogLevel | OpenTelemetry diagnostic logging level. |
Environment Variables
| Variable | Use |
|---|---|
PHOENIX_COLLECTOR_ENDPOINT | Base Phoenix collector URL or full OTLP trace endpoint. |
PHOENIX_API_KEY | API key used when you do not pass apiKey explicitly. |
Instrumentation
Pass OpenTelemetry instrumentations toregister() to capture framework and library activity automatically.
- the package also re-exports
registerInstrumentations - auto-instrumentation setups often work best when they are initialized very early in process startup
- for custom providers, you can pass your own
spanProcessors
Production
Enable Batch Processing
Always setbatch: true (the default) in production. The batch span processor groups spans before export, improving compression and reducing the number of outgoing network requests. Disable batching only during local debugging when you need spans to appear immediately.
Provider Lifecycle
In production you must flush and shut down the provider before your process exits, otherwise in-flight batches are lost.shutdown() at the end of your work:
Custom Span Processors
If you need full control over export (for example, sending spans to a secondary backend), pass your ownspanProcessors. This replaces the default Phoenix exporter setup entirely.
Troubleshooting
When traces do not show up in Phoenix, check these common issues:- confirm
projectNameis the project you are inspecting - confirm
urlorPHOENIX_COLLECTOR_ENDPOINTpoints at the collector - confirm
PHOENIX_API_KEYis present for authenticated environments - confirm registration happens before the instrumented work starts
- call
await provider.shutdown()before process exit when using batched export
Enable Diagnostic Logging
Package Surface
register()creates aNodeTracerProviderand Phoenix exporter setuptrace,SpanStatusCode, and other OpenTelemetry re-exports support manual tracingregisterInstrumentations()wires automatic instrumentation into the same providerobjectAsAttributes()converts JSON-like objects into OpenTelemetry attribute maps
Where To Start
- Manual spans for tracing with
@arizeai/openinference-corehelpers and raw OTel spans
Source Map
src/index.tssrc/register.tssrc/config.tssrc/utils.tssrc/createNoOpProvider.ts

