Agent metrics and analytics
Langfuse metrics are aggregations over observability traces and evaluation scores. You use them to see whether cost, latency, volume, or quality is getting better or worse โ and for which users, models, prompts, or releases.
This page is for teams that already have traces (and optionally scores) and need to monitor the system, not a single request. To decide which metrics are worth tracking, read Monitoring in the Langfuse Academy and error analysis.
What you can do with metrics
Teams use Langfuse metrics to:
- Watch model spend and latency by user, feature, or release
- Compare quality scores after a prompt or model change
- Alert when cost, latency, or a quality score crosses a threshold
- Pull the same aggregations into a warehouse or BI tool via the Metrics API
Metrics and dimensions
Metrics:
- Quality โ user feedback, model-based scoring, human-in-the-loop samples, or custom scores via SDKs and API (see scores). Quality is assessed over time and across prompt versions, LLMs, and users.
- Cost and latency โ measured from traces and broken down by user, session, geography, feature, model, and prompt version.
- Volume โ ingested traces and tokens used.
Dimensions:
- Trace name โ differentiate use cases and features by adding a
namefield to your traces. - User โ add a
userIdto traces (user tracking). - Tags โ filter use cases and features with tags.
- Release and version โ see how a change affected the metrics.
For the exact query model, see the Metrics API. You do not need evaluation set up for cost, latency, and volume; quality charts appear once you attach scores.
Features
FAQ
What agent metrics should I track?
Start with cost, latency, volume, and quality. Cost and latency come from traces. Volume is request and token count. Quality comes from evaluation scores and user feedback. Slice those metrics by user, session, trace name, tag, release, and prompt version.
How do Langfuse metrics relate to traces?
Metrics are aggregations over observability traces and evaluation scores. Every dashboard widget and Metrics API query reads the same underlying events you already ingest, so you do not maintain a separate analytics pipeline.
Can I export metrics to other tools?
Yes. Use the Metrics API for custom reporting, export dashboards, or send data to PostHog and Mixpanel. You can also alert when a metric crosses a threshold.
Do I need evals set up before metrics are useful?
No. Cost, latency, and volume work from traces alone. Quality metrics become available once you attach scores โ via LLM-as-a-Judge, code evaluators, user feedback, or manual annotation.
Last edited