Skip to main content
This document provides comprehensive guidance on integrating Graphite with Arize AX and Phoenix for distributed tracing and observability.

Table of Contents

Overview

Graphite integrates with OpenTelemetry to provide distributed tracing through multiple backends:
  • Arize AX: Production-grade monitoring and observability platform for AI applications
  • Phoenix: Local/remote tracing solution ideal for development and debugging
  • Auto: Automatic detection of available tracing endpoints
  • In-Memory: Testing mode without external dependencies
The integration is built on top of OpenTelemetry and automatically instruments:
  • OpenAI API calls
  • LLM interactions
  • Tool executions
  • Workflow orchestration
  • Node operations

Installation

Core Dependencies

Grafi includes the following observability dependencies by default:
These are automatically installed when you install Grafi:

Optional Development Dependencies

For local Phoenix tracing during development:

Configuration

Docker Compose

To run Phoenix you can run it on your local machine via docker compose

Environment Variables

Arize AX Configuration

Set these environment variables when using Arize AX:

Phoenix Configuration

Set these environment variables to override default Phoenix settings:

Setup Function Parameters

The setup_tracing() function accepts the following parameters:
  • tracing_options: Backend to use (ARIZE, PHOENIX, AUTO, IN_MEMORY)
  • collector_endpoint: Hostname of the collector (default: “localhost”)
  • collector_port: Port number of the collector (default: 4317)
  • project_name: Name for the tracing project (default: “grafi-trace”)

Tracing Options

Grafi provides four tracing backend options through the TracingOptions enum:

1. ARIZE AX - Production Monitoring

Use Arize AX for production environments with enterprise-grade observability:
When to use:
  • Production deployments
  • Need for team collaboration and sharing
  • Require advanced analytics and monitoring
  • Enterprise compliance requirements

2. PHOENIX - Local/Remote Development

Use Phoenix for development and debugging:
When to use:
  • Local development and debugging
  • Quick iteration and testing
  • Learning and experimentation
  • Running Phoenix locally or on a remote server

3. AUTO - Automatic Detection

Let Grafi automatically detect available tracing endpoints:
Detection priority:
  1. Default collector endpoint (if available)
  2. Phoenix endpoint from environment variables
  3. Falls back to in-memory tracing
When to use:
  • Development environments with optional Phoenix
  • CI/CD pipelines
  • Flexible deployment scenarios

4. IN_MEMORY - Testing

Use in-memory tracing for tests and offline work:
When to use:
  • Unit and integration tests
  • CI/CD without external dependencies
  • Offline development
  • Minimal overhead scenarios

Usage Examples

Example 1: Basic Setup with AUTO Detection

Example 2: Production Setup with Arize AX

Example 3: Development with Local Phoenix

First, start Phoenix locally:
Then in your code:
Visit http://localhost:6006 to view the Phoenix UI.

Example 4: Testing with In-Memory Tracing

Example 5: Remote Phoenix Instance

Example 6: Complete Assistant with Tracing

Best Practices

1. Environment-Specific Configuration

Use different tracing backends for different environments:

2. Early Initialization

Set up tracing early in your application lifecycle, before creating assistants:

3. Project Naming Conventions

Use descriptive project names to organize traces:

4. Secure Credential Management

Never hardcode API keys. Use environment variables or secret management:

5. Graceful Degradation with AUTO Mode

Use AUTO mode to gracefully degrade when tracing endpoints are unavailable:

6. Testing Isolation

Use IN_MEMORY mode in tests to avoid external dependencies:

Troubleshooting

Issue: “Phoenix endpoint is not available”

Symptom: ValueError when using PHOENIX tracing option Solution:
  1. Ensure Phoenix is running:
  2. Check the endpoint and port are correct:
  3. Use AUTO mode for graceful fallback:

Issue: Arize AX traces not appearing

Symptom: No traces visible in the Arize AX dashboard Solution:
  1. Verify environment variables are set:
  2. Check the collector endpoint:
  3. Verify API key has proper permissions

Issue: Connection timeout with Phoenix

Symptom: Slow startup or timeout errors Solution:
  1. The endpoint check has a 0.1s timeout, which is normal
  2. Use AUTO mode to automatically fall back:
  3. For PHOENIX mode, ensure the endpoint is reachable:

Issue: OpenAI instrumentation not working

Symptom: OpenAI calls not showing in traces Solution:
  1. Ensure OpenAI is instrumented (done automatically by setup_tracing)
  2. Verify tracer is registered before creating assistants:

Issue: Traces showing in wrong project

Symptom: Traces appear in unexpected project Solution: Specify project name explicitly:

Debug Logging

Enable debug logging to troubleshoot tracing issues:

Additional Resources

Arize AX Resources

Phoenix Resources

Grafi Resources

Support

For issues related to:
  • Graphite tracing integration: Open an issue on the Grafi repository
  • Arize AX platform: Contact Arize AX support or consult their documentation
  • Phoenix: Check the Phoenix GitHub issues or documentation