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
- OpenAI API calls
- LLM interactions
- Tool executions
- Workflow orchestration
- Node operations
Installation
Core Dependencies
Grafi includes the following observability dependencies by default: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 composeEnvironment 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
Thesetup_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 theTracingOptions enum:
1. ARIZE AX - Production Monitoring
Use Arize AX for production environments with enterprise-grade observability:- 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:- 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:- Default collector endpoint (if available)
- Phoenix endpoint from environment variables
- Falls back to in-memory tracing
- Development environments with optional Phoenix
- CI/CD pipelines
- Flexible deployment scenarios
4. IN_MEMORY - Testing
Use in-memory tracing for tests and offline work:- 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: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:-
Ensure Phoenix is running:
-
Check the endpoint and port are correct:
-
Use AUTO mode for graceful fallback:
Issue: Arize AX traces not appearing
Symptom: No traces visible in the Arize AX dashboard Solution:-
Verify environment variables are set:
-
Check the collector endpoint:
- Verify API key has proper permissions
Issue: Connection timeout with Phoenix
Symptom: Slow startup or timeout errors Solution:- The endpoint check has a 0.1s timeout, which is normal
-
Use AUTO mode to automatically fall back:
-
For PHOENIX mode, ensure the endpoint is reachable:
Issue: OpenAI instrumentation not working
Symptom: OpenAI calls not showing in traces Solution:- Ensure OpenAI is instrumented (done automatically by setup_tracing)
- 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

