Skip to main content

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:
Or using environment variables:

OpenTelemetry Settings

Granularity Levels

Control the level of detail in traces with the chroma_otel_granularity setting:
  • none (default) - No spans emitted, OpenTelemetry disabled
  • operation - Spans for high-level operations (add, query, get, etc.)
  • operation_and_segment - Operations plus segment-level operations
  • all - 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:
The decorator automatically handles both sync and async methods and adds the pod name attribute.

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:
This starts:
  • Chroma server with OpenTelemetry enabled
  • OpenTelemetry Collector - Receives and processes traces
  • Zipkin - Trace visualization UI

Accessing Zipkin UI

Open your browser to http://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 own log_config.yml:
Load your custom configuration:

Log Levels

Configure log levels per logger:
Or via environment variables:

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

Configure the Datadog Agent to receive OTLP:

New Relic

Jaeger

View traces at http://localhost:16686

Product Telemetry

Chroma collects anonymous usage telemetry to improve the product.

Disabling Telemetry

Or via environment variable:

Custom Telemetry Implementation

Best Practices

  1. Use appropriate granularity - Set to "operation" for production, "all" only when debugging
  2. Add custom attributes - Include relevant context like user IDs, collection names, batch sizes
  3. Monitor query latency - Track p50, p95, p99 query latencies
  4. Set up alerts - Alert on high error rates, slow queries, memory pressure
  5. Rotate log files - Use RotatingFileHandler to prevent disk space issues
  6. Sample traces in high-volume - Configure sampling in the OTel collector for high-traffic deployments
  7. Secure telemetry endpoints - Use TLS and authentication for production telemetry
  8. Monitor resource usage - Track memory, CPU, and disk usage alongside application metrics

Troubleshooting

No traces appearing

  1. Verify chroma_otel_granularity is not "none"
  2. Check the OTel collector endpoint is reachable
  3. Verify authentication headers are correct
  4. Check collector logs for errors

High overhead from tracing

  1. Reduce granularity from "all" to "operation"
  2. Enable sampling in the OTel collector
  3. Use asynchronous span export

Missing log output

  1. Check log level configuration
  2. Verify log handlers are configured correctly
  3. Ensure log directory has write permissions
  4. Check disable_existing_loggers is False

Next Steps