Trace analytics is the practice of searching, aggregating, and mining the traces your LLM application or agent produces to find slow, expensive, failing, or low-quality requests. MLflow provides it in one open-source platform: trace search, an LLM trace dashboard for latency, errors, tokens, and cost, session grouping, quality assessments, and automatic issue detection.
Last updated: 2026-11-26
A single trace shows you what happened in one request. Analytics shows you what is happening across all of them. Once an agent handles thousands of requests a day, you cannot read traces one by one, so you need to filter them, aggregate them, and let tools point you at the patterns worth reading.
Quick Navigation:
A trace is the record of one request through your application: the user input, each LLM call, tool call, and retrieval step as nested spans, plus timing, token counts, errors, and any tags or feedback attached to it. Trace analytics treats the collection of traces as a dataset you can query.
It sits between two related practices. AI observability is the broader goal of seeing what your system does; trace analytics is the part that answers questions across many traces. Evaluation scores quality on a fixed test set; trace analytics works on real production traffic and can feed failures back into that test set.
Most teams start with a handful of recurring questions. Each one maps to a feature in MLflow:
| Question | Where to look in MLflow |
|---|---|
| Which requests are slow or failing? | Filter on trace status and execution time in the Traces tab, or chart latency percentiles and error rate on the Dashboard. |
| Where do tokens and cost go? | Token usage and cost charts on the Dashboard, and per-span token counts in the trace viewer. |
| Which tools does my agent call, and do they work? | The Tool calls tab shows call counts, latency, and error rate for each tool. |
| How do multi-turn conversations go? | Session and User columns in the Traces tab, and mlflow.search_sessions() in Python. |
| Which responses are low quality? | Judge scores, code checks, and human feedback attached to traces as assessments, charted on the Quality tab. |
| What are the recurring failure patterns? | Automatic issue detection groups related failures into named issues with evidence. |
The Traces tab in the MLflow UI lists every trace in an experiment with its input, output, duration, state, token count, session, and assessment results. The filter bar uses the same SQL-like syntax as the Python API. You can filter on trace status, execution time, trace name, tags, metadata, span name and type, linked prompt versions, feedback, and expectations, and combine conditions with AND.
import mlflowmlflow.set_experiment("my-agent")# Slow production failures, newest firsttraces = mlflow.search_traces(filter_string="""tag.environment = 'production'AND trace.status = 'ERROR'AND trace.execution_time_ms > 500""",order_by=["timestamp_ms DESC"],max_results=100,)
mlflow.search_traces() returns a pandas DataFrame by default, or a list of Trace objects with return_type="list". The DataFrame has columns such as state, execution_duration, inputs, outputs, tags, and assessments, so ordinary pandas code gives you custom analytics:
df = mlflow.search_traces(max_results=1000)print(df["state"].value_counts())print(df["execution_duration"].quantile([0.5, 0.95, 0.99]))
See the search traces documentation for the full list of fields and operators.
The experiment Dashboard aggregates traces over a time range you choose, with a selectable time unit. It has three tabs:
Token usage and cost are recorded automatically for supported LLM providers, so the charts fill in without extra instrumentation. The dashboard needs a SQL-backed tracking store (SQLite, PostgreSQL, or MySQL); the default file store does not render the charts. See the dashboard documentation and the token usage and cost guide.
Chat applications and agents handle conversations, not isolated requests. Tag each trace with a session ID and a user ID and MLflow groups them, so you can look at a whole conversation, filter by user, and analyze multi-turn behavior.
import mlflow@mlflow.tracedef chat(message: str, user_id: str, session_id: str):mlflow.update_current_trace(session_id=session_id, user=user_id)return my_agent(message)# Or wrap auto-instrumented codewith mlflow.tracing.context(session_id="session-123", user="user-456"):agent.invoke("What is the capital of France?")# Retrieve complete multi-turn sessionssessions = mlflow.search_sessions(max_results=50)
The session_id and user arguments need MLflow 3.11.0 or later. On older versions, set the mlflow.trace.session and mlflow.trace.user metadata keys instead. Details are in the user and session tracking guide.
Latency and errors tell you whether a request ran. They do not tell you whether the answer was good. MLflow stores quality signals on the trace itself as assessments: feedback from LLM judges, code-based checks, or human reviewers, and expectations that record ground truth. Once attached, assessments are searchable and chartable like any other trace field.
from mlflow.entities import AssessmentSource, AssessmentSourceTypemlflow.log_feedback(trace_id=trace_id,name="rating",value="positive",rationale="Answer matched the retrieved policy document.",source=AssessmentSource(source_type=AssessmentSourceType.HUMAN,source_id="reviewer@example.com",),)# Later: find every trace a reviewer rated positivelygood = mlflow.search_traces(filter_string="feedback.rating = 'positive'")
LLM judges can score traces automatically, and review queues let you route traces to human reviewers. Read more in the feedback collection guide.
Filters and charts help when you know what to look for. Automatic issue detection helps when you do not. It analyzes a selection of traces with an LLM, groups related failures into named issues such as incorrect information or ungrounded claims, and attaches the traces and span-level evidence behind each one. You review an issue list instead of thousands of traces, and each issue links back to the traces that support it.
Issue detection runs from the Traces tab and uses the model you choose, so it incurs LLM calls. See the automatic issue detection guide and AI issue discovery.
Many tools offer GenAI observability and LLM monitoring. When you compare platforms for LLM trace analytics, these criteria matter most, and they are where an open-source platform like MLflow is designed to help:
| Criterion | What to check | In MLflow |
|---|---|---|
| Ownership of data | Can you self-host and keep traces in your own database? | Open source under Apache 2.0, self-hosted on SQLite, PostgreSQL, or MySQL. |
| Framework coverage | Does tracing work across the LLM providers and agent frameworks you use? | Automatic tracing integrations plus manual tracing for any Python code. |
| Search depth | Can you filter on spans, tags, sessions, and quality scores as well as time? | SQL-like filters on status, duration, spans, tags, metadata, feedback, and expectations. |
| Quality signals | Do judge scores and human feedback live next to the trace? | Assessments attach to traces and chart on the Quality tab. |
| Evaluation loop | Can production failures become test cases? | Traces feed MLflow evaluation datasets and scorers in the same platform. |
For a side-by-side look at specific tools, see top agent observability tools.
Trace analytics needs traces first. Enable tracing with one line for your framework, then open the experiment in the MLflow UI:
import mlflowmlflow.set_tracking_uri("sqlite:///mlflow.db") # SQL store for the Dashboardmlflow.set_experiment("my-agent")mlflow.openai.autolog() # or langchain, anthropic, and other integrations# Run your application, then start the UI:# mlflow server --backend-store-uri sqlite:///mlflow.db
Open the experiment, then use Traces to search, Dashboard for trends, and Issues to review detected problems. The tracing quickstart walks through the setup, and production tracing covers sampling and deployment.