Skip to main content

Prerequisites

  • Java 11 or higher
  • (Optional) Phoenix API key if using auth

Add Dependencies

Add the dependencies to your build.gradle:

Setup Phoenix

No uv? pip install arize-phoenix && phoenix serve does the same thing. See Terminal setup for customization.
Phoenix serves its UI and OTLP HTTP on port 6006, and OTLP gRPC on port 4317. For a local instance that’s http://localhost:6006 — leave it running while you work.
If your Phoenix instance isn’t running on localhost, adjust the endpoint in the code below as needed. If it has authentication enabled, also set PHOENIX_API_KEY to an API key from its Settings page.

Configuration for Phoenix Tracing

Run LangChain4j

By instrumenting your application, spans will be created whenever it is run and will be sent to the Phoenix server for collection.

Observe

Once configured, your traces will be automatically sent to Phoenix where you can:
  • Monitor Performance: Track latency, throughput, and error rates
  • Analyze Usage: View token usage, model performance, and cost metrics
  • Debug Issues: Trace request flows and identify bottlenecks
  • Evaluate Quality: Run evaluations on your LLM outputs

Resources

Full Example

OpenInference package