Skip to main content
PyPI Version Provides a lightweight wrapper around OpenTelemetry primitives with Phoenix-aware defaults. Also includes tracing decorators for common GenAI patterns.

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.

Quick Start

That’s it! By default, register reads the PHOENIX_COLLECTOR_ENDPOINT environment variable, falling back to http://localhost:4317 using gRPC if the variable is not set.

Configuration

Environment Variables

The SDK automatically reads these environment variables:

Endpoint Configuration

You can also configure the endpoint directly in code:
When using the endpoint argument, you must specify the fully qualified URL. HTTP uses /v1/traces, while gRPC uses port 4317 by default.

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.
See Using Tracing Helpers for a full walkthrough of manual instrumentation.

Advanced: OTel Primitives

For granular control, use Phoenix wrappers as drop-in replacements for OpenTelemetry primitives:
These wrappers accept an endpoint argument to automatically infer the appropriate SpanExporter.
Using environment variables:
Custom resources:
Batch processing:
Custom gRPC endpoint:

Advanced: TracerProvider Options

Both register() 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