Installation
Starting in 0.16.0,
phoenix.otel re-exports the OpenInference context managers and semantic conventions, so manual instrumentation no longer requires separately installing openinference-instrumentation or openinference-semantic-conventions. On older versions, import them from openinference.instrumentation and openinference.semconv.trace instead.arize-phoenix-otel is versioned independently of the Phoenix server; the two are not coupled. Any recent SDK version works with any Phoenix server version — there is no version pairing to track. See Version compatibility.Quick Start
register reads the PHOENIX_COLLECTOR_ENDPOINT environment variable. If the variable is not set, register uses http://localhost:6006 and exports over gRPC to localhost:4317.
Configuration
Environment Variables
The SDK automatically reads these environment variables:register() also auto-loads PHOENIX_-prefixed settings from a .env.phoenix file discovered by walking up from the current directory (process environment variables take precedence). Set PHOENIX_DISCOVER_CONFIG=false to opt out. See Environment Variables.Endpoint Configuration
You can also configure the endpoint directly in code:register uses the endpoint argument as given. For HTTP, include the /v1/traces path. For gRPC, include the port, which is 4317 by default.Protocol selection
register, TracerProvider, SimpleSpanProcessor, and BatchSpanProcessor pick the OTLP transport once, from the endpoint as written. The first rule that matches applies:
- If you pass
protocol, the SDK uses it. - A Phoenix Cloud URL uses HTTP.
- A URL with a path, such as
/v1/tracesor/phoenix, uses HTTP. FromPHOENIX_COLLECTOR_ENDPOINT, the SDK keeps the path and appends/v1/tracesif it is missing. The SDK uses anendpointargument as given. - A URL with no path (
scheme://host[:port]) uses gRPC. FromPHOENIX_COLLECTOR_ENDPOINT, the SDK sends to the same host onPHOENIX_GRPC_PORT(default4317). The SDK uses anendpointargument ashost:port, as given.
protocol="http/protobuf".
Register Options
Spans may not be exported if still queued in the processor when your process exits. With
batch=True, call tracer_provider.shutdown() to explicitly flush before exit. Alternatively, use batch=False for immediate export or a context manager (with register(...) as tracer_provider).Manual Instrumentation Helpers
phoenix.otel re-exports the OpenInference context managers and semantic conventions so you can add session, user, metadata, tag, prompt template, and suppression context — plus set OpenInference span attributes — from a single import:
Requires
arize-phoenix-otel>=0.16.0. Lower-level helpers (get_llm_attributes, TraceConfig, Message, Image, …) continue to live in the openinference-instrumentation package.Advanced: OTel Primitives
For granular control, use Phoenix wrappers as drop-in replacements for OpenTelemetry primitives:endpoint argument to automatically infer the appropriate SpanExporter.
More examples
More examples
Using environment variables:Custom resources:Batch processing:Custom gRPC endpoint:
Advanced: TracerProvider Options
Bothregister() and TracerProvider accept standard OpenTelemetry TracerProvider kwargs for advanced features like custom ID generators and sampling:
Reference Documentation
Full API Reference
Complete API documentation for tracing setup, decorators, and OpenTelemetry configuration

