RousselTMLEARNING

Observability

Installing Phoenix and tracing your first LLM application

Install Arize Phoenix (pip, Docker), send your first OpenInference traces from an OpenAI application or a local Ollama model, and read the traces: messages, tokens, latency.

1. Starting Phoenix #

In one command.

Options #

Phoenix running locally
# Docker
docker run -d --name phoenix -p 6006:6006 -p 4317:4317 arizephoenix/phoenix:latest

# ou Python
pip install arize-phoenix
phoenix serve
PortUsage
6006Web interface and OTLP/HTTP (/v1/traces)
4317OTLP/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.2

The 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.py

3. Reading traces #

What Phoenix shows.

In the interface #

  • The support-bot project lists one trace per call, with latency, status and token count.
  • The LLM span 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 #

SymptomLikely cause
No tracesregister() called after the client was created, wrong port, instrumentation not installed
Spans without messagesMasking enabled (OPENINFERENCE_HIDE_*)
Traces arriving in burstsNormal: 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.

Related articles

Arize AI: observability and evaluation of LLM applications and agents

Understand Arize AI: Phoenix (open source) and Arize AX (platform), OpenInference traces, LLM-as-a-judge eval…

OpenInference: the OpenTelemetry conventions for tracing AI applications

Detailed guide to OpenInference: OpenTelemetry semantic conventions and instrumentations for LLMs, RAG and ag…

Tracing a RAG and an agent with OpenInference and Phoenix

Instrument a RAG application and an agent: RETRIEVER, RERANKER, TOOL and AGENT spans, conversation sessions, …

Keep learning

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!