Skip to main content
This notebook demonstrates split-stream OpenTelemetry tracing for agents running on Databricks: the same spans are exported to Arize AX for real-time observability and to Unity Catalog Delta tables for governed storage.
This notebook will only run in a Databricks workspace environment.

Link to Notebook Tutorial

In this notebook you learn to:
  • Configure a single OpenTelemetry TracerProvider with two span processors — one exporting to Arize AX and one exporting to Databricks Unity Catalog
  • Stream OTLP spans to Arize AX for real-time trace exploration, evaluation, and monitoring
  • Stream the same OTLP spans into Unity Catalog Delta tables for retention, governance, and SQL analytics
  • Instrument an external-style OpenAI + LangChain tool-calling agent with OpenInference auto-instrumentation
  • Bind an MLflow experiment to Unity Catalog so traces are queryable via Databricks SQL
  • Verify ingest on both streams — SQL against the UC spans table and the trace explorer in Arize AX

Prerequisites

  • Databricks account and Unity Catalog workspace with the OpenTelemetry on Databricks preview enabled (Sign up for free)
  • Arize AX account (Sign up for free)
  • UC permissions: USE CATALOG, USE SCHEMA, CREATE SCHEMA (if needed), and MODIFY + SELECT on the OTel tables
  • A SQL warehouse ID with CAN USE
  • An OpenAI API key

Install dependencies

Access Arize AX and Databricks keys from Databricks Secrets

Create an Arize AX API key and Space ID for the items below. Use Databricks Secrets for secure access of keys, then map them to environment variables. Run this configuration section after the install cell restarts Python. Set the widgets below or map secrets to environment variables in your cluster policy:

Bind the MLflow experiment to Unity Catalog

This creates the {prefix}_otel_spans table (and related tables) and links the MLflow experiment for optional trace UI browsing. The full table name is used later as the export target for the Databricks span processor.

Configure dual OTLP export

This is the core of the pattern: a single OpenTelemetry TracerProvider with two span processors. Spans are produced once by the instrumented agent and fanned out to both destinations. Stream 1 — Arize AX. The Arize exporter ships OTLP spans over gRPC by default for sub-second ingest. The arize-otel package provides the exporter, endpoint, and transport helpers. The arize_project_name is set as a resource attribute and is required for spans to land in the correct project. Stream 2 — Databricks Unity Catalog. A standard OTLP exporter posts the same spans to the Databricks OTel collector endpoint (/api/2.0/otel/v1/traces). The X-Databricks-UC-Table-Name header routes spans into the Unity Catalog Delta table created above.

Instrument and run the demo agent

With the dual-export TracerProvider in place, a single line of OpenInference auto-instrumentation captures every LLM call and tool invocation as OTLP spans — which the two processors then fan out to Arize AX and Unity Catalog. The demo workload is an OpenAI + LangChain tool-calling agent with a simple policy-lookup tool.

Flush spans

Force the OTLP batches to be delivered before verification. This is required for short notebook runs where the batch processors may not flush on their own before the cell finishes.

Verify Unity Catalog ingest with Databricks SQL

Spans should appear in {catalog}.{schema}.{prefix}_otel_spans within a short delay after export. Query the governed Delta table directly with Spark SQL.

Verify traces in Arize AX

Open your Arize project (the arize_project_name widget value) in the AX UI. In the Arize AX platform you can see agent execution details, tool invocations, latency breakdown by component, token usage and costs, and metadata captured for each span. From here you can layer on online evaluations, dashboards, and monitors.

Optional: MLflow Experiment UI

In the workspace Experiments page, open {experiment_name}Traces tab (select your SQL warehouse). This is optional — SQL on the UC spans table is the primary governed-store proof.

Lakebase consumption pattern

Use Databricks SQL on the Unity Catalog span tables for analytics. For operational apps, treat Unity Catalog as the system of record and expose a permissioned read path via Lakebase if sub-second app reads are needed.

Next steps

With spans flowing into both Arize AX and Unity Catalog, you have one telemetry source feeding real-time observability and governed long-term storage. From here, set up online evaluations in Arize AX to score your agent’s quality continuously, build custom metrics from trace attributes, and run SQL analytics over the governed UC tables.

Resources

Databricks Resources

Store OpenTelemetry Traces in Unity Catalog

Databricks Secrets