Setup Phoenix tracing in Python with arize-phoenix-otel.
| Attribute | Value |
|---|---|
| Priority | Critical - required for all tracing |
| Setup Time | <5 min |
from phoenix.otel import register
register(project_name="my-app", auto_instrument=True)Connects to http://localhost:6006, auto-instruments all supported libraries.
pip install arize-phoenix-otelSupported: Python 3.10-3.13
export PHOENIX_API_KEY="your-api-key" # Required for Phoenix Cloud
export PHOENIX_COLLECTOR_ENDPOINT="http://localhost:6006" # Or Cloud URL
export PHOENIX_PROJECT_NAME="my-app" # Optionalfrom phoenix.otel import register
tracer_provider = register(
project_name="my-app", # Project name
endpoint="http://localhost:6006", # Phoenix endpoint
auto_instrument=True, # Auto-instrument supported libs
batch=True, # Batch processing (default: True)
)Parameters:
project_name: Project name (overridesPHOENIX_PROJECT_NAME)endpoint: Phoenix URL (overridesPHOENIX_COLLECTOR_ENDPOINT)auto_instrument: Enable auto-instrumentation (default: False)batch: Use BatchSpanProcessor (default: True, production-recommended)protocol:"http/protobuf"(default) or"grpc"
Install instrumentors for your frameworks:
pip install openinference-instrumentation-openai # OpenAI SDK
pip install openinference-instrumentation-langchain # LangChain
pip install openinference-instrumentation-llama-index # LlamaIndex
# ... install others as neededThen enable auto-instrumentation:
register(project_name="my-app", auto_instrument=True)Phoenix discovers and instruments all installed OpenInference packages automatically.
Enabled by default. Configure via environment variables:
export OTEL_BSP_SCHEDULE_DELAY=5000 # Batch every 5s
export OTEL_BSP_MAX_QUEUE_SIZE=2048 # Queue 2048 spans
export OTEL_BSP_MAX_EXPORT_BATCH_SIZE=512 # Send 512 spans/batchLink: https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/
- Open Phoenix UI:
http://localhost:6006 - Navigate to your project
- Run your application
- Check for traces (appear within batch delay)
No traces:
- Verify
PHOENIX_COLLECTOR_ENDPOINTmatches Phoenix server - Set
PHOENIX_API_KEYfor Phoenix Cloud - Confirm instrumentors installed
Missing attributes:
- Check span kind (see rules/ directory)
- Verify attribute names (see rules/ directory)
from phoenix.otel import register
from openai import OpenAI
# Enable tracing with auto-instrumentation
register(project_name="my-chatbot", auto_instrument=True)
# OpenAI automatically instrumented
client = OpenAI()
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Hello!"}]
)