---
title: OpenTelemetry Export | Databricks on AWS
source: https://docs.databricks.com/aws/en/mlflow3/genai/tracing/integrations/open-telemetry
ingestedAt: "2026-06-18T08:17:33.214Z"
---

Traces generated by MLflow are compatible with the [OpenTelemetry trace specs](https://opentelemetry.io/docs/specs/otel/trace/api/#span). Therefore, MLflow traces can be exported to various observability solutions that support OpenTelemetry.

## Export modes[​](#export-modes "Direct link to Export modes")

MLflow supports three export modes for traces:

1.  **MLflow tracking only (Default)**: Traces are sent only to the MLflow Tracking Server.
2.  **OpenTelemetry only**: Traces are sent only to an OpenTelemetry Collector.
3.  **Dual export**: Traces are sent to both MLflow Tracking and an OpenTelemetry Collector.

## OpenTelemetry export[​](#opentelemetry-export-1 "Direct link to OpenTelemetry export")

By default, MLflow exports traces to the MLflow Tracking Server. To export traces _only_ to an OpenTelemetry Collector instead, set the `OTEL_EXPORTER_OTLP_ENDPOINT` environment variable (or `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT`) to the target URL of the OpenTelemetry Collector _before starting any trace_.

Python

    import mlflowimport os# Set the endpoint of the OpenTelemetry Collectoros.environ["OTEL_EXPORTER_OTLP_TRACES_ENDPOINT"] = "http://localhost:4317/v1/traces"# Optionally, set the service name to group tracesos.environ["OTEL_SERVICE_NAME"] = "<your-service-name>"# Trace will be exported ONLY to the OTel collector at http://localhost:4317/v1/traceswith mlflow.start_span(name="foo") as span:    span.set_inputs({"a": 1})    span.set_outputs({"b": 2})

## Dual export (MLflow + OpenTelemetry)[​](#dual-export-mlflow--opentelemetry "Direct link to Dual export (MLflow + OpenTelemetry)")

To export traces to _both_ Databricks MLflow and another OpenTelemetry service simultaneously, use MLflow's dual export configuration. This enables sending the same trace data to multiple destinations without having to choose between MLflow's tracking capabilities and your existing observability infrastructure.

### Enable dual export[​](#enable-dual-export "Direct link to Enable dual export")

Set the `MLFLOW_ENABLE_DUAL_EXPORT` environment variable along with your OpenTelemetry configuration:

Python

    import mlflowimport os# Enable dual export modeos.environ["MLFLOW_ENABLE_DUAL_EXPORT"] = "true"# Configure OpenTelemetry Collector endpointos.environ["OTEL_EXPORTER_OTLP_TRACES_ENDPOINT"] = "http://localhost:4317/v1/traces"os.environ["OTEL_SERVICE_NAME"] = "my-ml-service"# Configure MLflow tracking URI to Databricksmlflow.set_tracking_uri("databricks")# Traces will be exported to BOTH MLflow and the OTel collectorwith mlflow.start_span(name="dual_export_example") as span:    span.set_inputs({"model": "gpt-4", "prompt": "Hello world"})    # Your ML workflow here    result = "Generated response"    span.set_outputs({"response": result})    span.set_attributes({"token_count": 15})

## Metrics export[​](#metrics-export "Direct link to Metrics export")

MLflow can export OpenTelemetry metrics when a metrics endpoint is configured. This allows you to monitor span durations and other trace-related metrics in compatible monitoring systems.

For a complete list of metrics that MLflow exports, see [MLflow's exported metrics documentation](https://mlflow.org/docs/latest/genai/tracing/prod-tracing/#exported-metrics).

### Enable metrics export[​](#enable-metrics-export "Direct link to Enable metrics export")

To export metrics to OpenTelemetry Collector, set the following environment variables:

Python

    import os# Enable metrics exportos.environ["OTEL_METRICS_EXPORTER"] = "otlp"os.environ["OTEL_EXPORTER_OTLP_METRICS_ENDPOINT"] = "http://localhost:4317"# Optional: Configure metric export interval (in milliseconds)os.environ["OTEL_METRIC_EXPORT_INTERVAL"] = "60000"  # Export every 60 seconds

## OpenTelemetry Collectors[​](#opentelemetry-collectors "Direct link to OpenTelemetry Collectors")

Click the following links to learn more about how to set up an OpenTelemetry Collector for your specific observability platform:

### Configurations[​](#configurations "Direct link to Configurations")

MLflow uses the standard OTLP Exporter for exporting traces to OpenTelemetry Collector instances. Thereby, you can use [all of the configurations](https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/) supported by OpenTelemetry. The following example configures the OTLP Exporter to use HTTP protocol instead of the default gRPC and sets custom headers:

Bash

    export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="http://localhost:4317/v1/traces"export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL="http/protobuf"export OTEL_EXPORTER_OTLP_TRACES_HEADERS="api_key=12345"

## Next steps[​](#next-steps "Direct link to Next steps")

*   [Understand tracing concepts](https://docs.databricks.com/aws/en/mlflow3/genai/tracing/tracing-101) - Learn how MLflow's OpenTelemetry-compatible traces are structured
*   [Instrument your app with tracing](https://docs.databricks.com/aws/en/mlflow3/genai/tracing/app-instrumentation/) - Add custom spans to enrich your OpenTelemetry exports
*   [Debug production issues](https://docs.databricks.com/aws/en/mlflow3/genai/tracing/prod-tracing) - Use exported traces to monitor production applications
