where to find trace analytics
Summary
- Trace analytics lives wherever your traces are queryable: the trace UI's search and filters, a trace query API, SQL over stored trace tables, and the dashboards and natural-language tools built on those tables.
- For LLM and agent traces, open-source MLflow gives you filters in its Traces UI and
mlflow.search_traces(), which returns matching traces as a pandas DataFrame for analysis. - MLflow's search syntax filters on status, execution time, tags, metadata such as user and session, span names and types, linked prompt versions, and feedback or expectations. It joins conditions with AND; OR isn't supported.
- On Databricks, traces stored in Unity Catalog come with SQL views such as
{table_prefix}_trace_unified, so you can aggregate error rates and latency with SQL, chart them in AI/BI Dashboards or ask Genie Code. - Spans from any OpenTelemetry client can be written to the same Unity Catalog tables, so trace analytics isn't limited to MLflow-instrumented apps.
where to find trace analytics
You'll find trace analytics in four places: the search and filter view of a trace UI, a programmatic query API, SQL over trace tables, and dashboards or natural-language tools layered on those tables. For LLM and agent traces, open-source MLflow covers the first two out of the box, with filters in its UI and mlflow.search_traces() in Python. To aggregate across large volumes or join traces with other data, store traces as tables. On Databricks, that means Unity Catalog, where traces are OpenTelemetry-format Delta tables with ready-made SQL views.
What trace analytics answers
Debugging reads one trace. Trace analytics asks questions across many: which requests failed, which step is slow, which prompt version drew bad feedback, which users hit errors most.
| Question | Where to answer it | Example |
|---|---|---|
| Which requests failed recently? | MLflow UI filters or mlflow.search_traces() |
trace.status = 'ERROR' plus a trace.timestamp_ms bound |
| Which requests were slow? | mlflow.search_traces() |
A filter on trace.execution_time_ms |
| Which prompt version drew poor feedback? | mlflow.search_traces() |
prompt = "name/version" with a feedback.<name> filter |
| Which users or sessions see problems? | mlflow.search_traces() |
metadata.`mlflow.trace.user` or metadata.`mlflow.trace.session` |
| How do error rate and latency trend? | SQL on stored trace tables | Group by hour on a trace view |
| What's going wrong, in plain language? | A natural-language assistant over traces | Genie Code on Databricks |
Trace analytics in open-source MLflow
The MLflow UI's trace search filters by trace inputs, attributes such as name, status and execution time, tags and metadata, and assessments. The same SQL-like syntax drives the Python API:
import mlflow
traces = mlflow.search_traces(
filter_string="trace.status = 'ERROR' AND tag.environment = 'production'",
order_by=["timestamp_ms DESC"],
max_results=100,
)
print(traces[["trace_id", "request_time", "execution_duration"]].head())
By default the result is a pandas DataFrame with columns such as trace_id, request_time, execution_duration, inputs, outputs, tags and assessments, so you can group and plot with ordinary pandas code. Pass return_type="list" to get Trace objects instead. Two practical notes from the docs: OR isn't supported in filters, and the local file store has limited search and was deprecated in MLflow 3.6.0, so use a SQL-backed store. Full-text search with trace.text LIKE works only on the SQLAlchemy store.
Trace analytics on Databricks
On Databricks, store traces in Unity Catalog and trace analytics becomes SQL. MLflow keeps span data in OpenTelemetry-compliant tables and creates Databricks SQL views over them. The {table_prefix}_trace_unified view holds one row per trace with columns including request_time, state, execution_duration_ms, spans and assessments:
SELECT
date_trunc('HOUR', request_time) AS trace_hour,
count(*) AS traces,
count_if(state = 'ERROR') AS failed_traces,
avg(execution_duration_ms) AS avg_duration_ms
FROM my_catalog.my_schema.my_prefix_trace_unified
GROUP BY 1
ORDER BY 1
Databricks recommends querying these views (or the SDK) rather than the underlying OpenTelemetry tables, whose schemas can change. For large trace volumes, build a materialized view over them and refresh it incrementally.
- Dashboards. The Databricks OpenTelemetry tracing post describes native MLflow experiment dashboards for trace volume, errors, latency, token usage and cost, plus custom AI/BI Dashboards over the same tables.
- Natural language. Genie Code can compute latency percentiles, track error rates over time and find the spans that consume the most tokens.
- Python at scale.
mlflow.search_traces()accepts Unity Catalogcatalog.schemavalues inlocations, with a SQL warehouse set throughMLFLOW_TRACING_SQL_WAREHOUSE_ID.
FAQs
What's the difference between trace analytics and trace debugging?
Debugging inspects a single trace's span tree to find what went wrong on one request. Trace analytics aggregates many traces to find patterns, such as rising error rates, slow tools or poor feedback tied to a prompt version.
Can I analyze traces that didn't come from MLflow?
Yes. Third-party OpenTelemetry clients can write spans to the Unity Catalog trace tables, and the docs say to search those traces with the span.attributes.* prefix.
Can I query MLflow traces with SQL?
On Databricks, yes, through the Unity Catalog trace views. In open-source MLflow, the documented interface is mlflow.search_traces(), whose DataFrame output you can analyze with pandas or load elsewhere.
Does mlflow.search_traces() support OR conditions?
No. Combine conditions with AND, and run separate searches when you need alternatives.
The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.