1. Starting Phoenix #
In one command.
Options #
# Docker
docker run -d --name phoenix -p 6006:6006 -p 4317:4317 arizephoenix/phoenix:latest
# ou Python
pip install arize-phoenix
phoenix serve| Port | Usage |
|---|---|
| 6006 | Web interface and OTLP/HTTP (/v1/traces) |
| 4317 | OTLP/gRPC |
Good to know: By default, Phoenix stores data in SQLite, in its working directory: with Docker and no volume, everything disappears when the container is removed. To keep data, mount a volume or use PostgreSQL (PHOENIX_SQL_DATABASE_URL).2. Tracing an application #
OpenAI or a local model.
With a local model (free) #
The openai library can talk to any compatible server, for example Ollama: OpenAI's OpenInference instrumentation then captures these calls too.
ollama pull llama3.2
export OPENAI_BASE_URL=http://localhost:11434/v1
export OPENAI_API_KEY=ollama # valeur quelconque pour Ollama
export MODEL=llama3.2The code #
# app.py
import os
from phoenix.otel import register
register(project_name="support-bot", endpoint="http://localhost:6006/v1/traces", auto_instrument=True)
from openai import OpenAI
client = OpenAI()
model = os.getenv("MODEL", "gpt-4o-mini")
for question in ["Comment réinitialiser mon mot de passe ?", "Quels sont vos horaires ?"]:
r = client.chat.completions.create(
model=model,
messages=[{"role": "system", "content": "Tu es l'assistant du support. Réponds en deux phrases."},
{"role": "user", "content": question}])
print(r.choices[0].message.content)pip install arize-phoenix-otel openinference-instrumentation-openai openai
python app.py3. Reading traces #
What Phoenix shows.
In the interface #
- The
support-botproject lists one trace per call, with latency, status and token count. - The
LLMspan shows the messages (system, user, assistant), the model, the parameters and the tokens. - Filters let you find slow calls, failing calls, or calls containing a word.
- Token columns are used to estimate the cost per request and per user.
Diagnosing #
| Symptom | Likely cause |
|---|---|
| No traces | register() called after the client was created, wrong port, instrumentation not installed |
| Spans without messages | Masking enabled (OPENINFERENCE_HIDE_*) |
| Traces arriving in bursts | Normal: batched export; they appear a few seconds later |
Good practice: Call register() at the very start of the program, before importing and creating the instrumented SDK clients.