Overview
Chroma provides comprehensive observability through OpenTelemetry integration for distributed tracing, structured logging, and metrics collection. This enables you to monitor performance, debug issues, and understand system behavior in production.OpenTelemetry Integration
Chroma supports OpenTelemetry (OTel) for distributed tracing and observability. OpenTelemetry is a vendor-neutral standard for collecting telemetry data from your applications.Configuration
Configure OpenTelemetry using environment variables or the Settings class:OpenTelemetry Settings
| Setting | Type | Default | Description |
|---|---|---|---|
chroma_otel_collection_endpoint | str | "" | OTLP endpoint (e.g., http://localhost:4317) |
chroma_otel_service_name | str | "chromadb" | Service name for span tagging and aggregation |
chroma_otel_collection_headers | Dict[str, str] | {} | Headers to send with spans (e.g., API keys) |
chroma_otel_granularity | str | None | Tracing granularity level |
Granularity Levels
Control the level of detail in traces with thechroma_otel_granularity setting:
none(default) - No spans emitted, OpenTelemetry disabledoperation- Spans for high-level operations (add, query, get, etc.)operation_and_segment- Operations plus segment-level operationsall- Detailed spans for almost every method call (use for debugging only)
Custom Tracing
You can add custom spans and attributes to the current trace:Decorating Methods with Tracing
Add tracing to your own methods:Local Observability Stack
Chroma provides a complete local observability stack with OpenTelemetry Collector and Zipkin for development and testing.Running the Stack
From the Chroma repository root:- Chroma server with OpenTelemetry enabled
- OpenTelemetry Collector - Receives and processes traces
- Zipkin - Trace visualization UI
Accessing Zipkin UI
Open your browser tohttp://localhost:9411 to view traces in the Zipkin UI.
OpenTelemetry Collector Configuration
The collector configuration (otel-collector-config.yaml):
Logging Configuration
Chroma uses Python’s standard logging with customizable configuration via YAML.Default Logging Configuration
Chroma’s default logging configuration (log_config.yml):
Custom Logging Configuration
Create your ownlog_config.yml:
Log Levels
Configure log levels per logger:Metrics Collection
Chroma emits metrics through OpenTelemetry that can be collected by your observability platform.Key Metrics
Operation Metrics
- Operation duration - Time taken for add, query, get, update, delete operations
- Operation count - Number of operations executed
- Batch size - Size of batches in batch operations
System Metrics
- Memory usage - Memory consumption of segments and indices
- Cache hit rate - LRU cache effectiveness
- Database connections - Active database connection count
Query Metrics
- Query latency - Time to execute queries
- Results returned - Number of results per query
- Index operations - HNSW/SPANN index operation counts
Exporting to Prometheus
Configure the OpenTelemetry Collector to export metrics to Prometheus:Integration Examples
Honeycomb
Datadog
New Relic
Jaeger
http://localhost:16686
Product Telemetry
Chroma collects anonymous usage telemetry to improve the product.Disabling Telemetry
Custom Telemetry Implementation
Best Practices
- Use appropriate granularity - Set to
"operation"for production,"all"only when debugging - Add custom attributes - Include relevant context like user IDs, collection names, batch sizes
- Monitor query latency - Track p50, p95, p99 query latencies
- Set up alerts - Alert on high error rates, slow queries, memory pressure
- Rotate log files - Use
RotatingFileHandlerto prevent disk space issues - Sample traces in high-volume - Configure sampling in the OTel collector for high-traffic deployments
- Secure telemetry endpoints - Use TLS and authentication for production telemetry
- Monitor resource usage - Track memory, CPU, and disk usage alongside application metrics
Troubleshooting
No traces appearing
- Verify
chroma_otel_granularityis not"none" - Check the OTel collector endpoint is reachable
- Verify authentication headers are correct
- Check collector logs for errors
High overhead from tracing
- Reduce granularity from
"all"to"operation" - Enable sampling in the OTel collector
- Use asynchronous span export
Missing log output
- Check log level configuration
- Verify log handlers are configured correctly
- Ensure log directory has write permissions
- Check
disable_existing_loggersisFalse
Next Steps
- Configure Performance Tuning
- Learn about Configuration options
- Set up Migrations