Evaluation metrics and the Quality view
Last updated: 2026-11-27T07:51:36-03:00 (UTC-3)
With features.evaluation_metrics on, every evaluation result is also a metric. The gateway counts it on /metrics and in the OTLP metrics push, the analytics query answers questions such as “pass rate per evaluator per model”, and the Usage screen gains a Quality tab. The flag is an operator control, off by default, and requires evaluation_results. To be told when a number crosses a threshold, see evaluation monitors.
Turn it on
Section titled “Turn it on”features: evaluation_results: true evaluation_metrics: trueevaluation: metrics: max_evaluations: 200 max_value_labels: 32 team_label: false max_teams: 50The evaluation.metrics block is optional and is read at startup: restart the gateway to apply a change. GET /api/v1/admin/evaluation/settings and the Settings line of the Quality tab show the values in effect. The console shows the flag under Feature flags; the bounds are set in YAML.
| Setting | Default | What it does |
|---|---|---|
evaluation.metrics.max_evaluations |
200 (1 to 2000) | How many evaluation names one replica gives their own evaluation label value. Any further name is counted as evaluation="other". |
evaluation.metrics.max_value_labels |
32 (0 to 64) | The most labels a boolean or categorical evaluation may have and still carry the value label. An evaluation that declares or shows more gets no value label. 0 never adds it. |
evaluation.metrics.team_label |
false | Adds the team label to the evaluation series. Meant for small deployments. |
evaluation.metrics.max_teams |
50 (1 to 500) | With team_label, how many teams get their own label value. Any further team is team="other". |
The series
Section titled “The series”The replica that first writes a result counts it, so each result is counted once across replicas. /metrics and the OTLP metrics push (features.otlp_metrics) carry the same series.
| Series | Type | Labels |
|---|---|---|
gateway_evaluations_total |
counter | evaluation, assessment (pass, fail, none), value, source (llm, code, human, api, feedback), version, metric_type (boolean, score, categorical, json, text), is_feedback (true, false), scope (span, trace, session), model, and team with team_label |
gateway_evaluation_score |
histogram | evaluation, source, version, model; buckets 0.1 to 1.0 |
gateway_evaluation_runs_total |
counter | evaluation, status (ok, error, skipped), reason, origin (app, experiment) |
gateway_evaluation_judge_cost_usd_total |
counter | evaluation, model (the judge’s model alias) |
gateway_evaluation_pending |
gauge | scope |
gateway_evaluation_label_overflow_total |
counter | label (evaluation, team, value, reason, series) |
What each label holds:
evaluationis the result’s name: an evaluator’s name, or the name an API client or end-user feedback sent.assessmentis the normalized verdict. A result with no pass criteria isnoneand stays out of every pass rate.valueexists only for boolean and categorical results. It is lower case with every run of other characters turned into one underscore:FAIL(OFF_TOPIC)isfail_off_topicandExcellent - All Goals Completeisexcellent_all_goals_complete. Score, JSON and text results have novaluelabel.versionis the evaluator version that produced the result. The published version and the one before keep their number; any older one isolder. Results with no evaluator version have noversionlabel.modelis the model alias of the request that was judged, never the judge’s. Like every other series, it holds configured aliases only; anything else isother.is_feedbackistruefor results whose source isfeedback.
What is counted where:
gateway_evaluations_totalandgateway_evaluation_scorecount production results with statusok. Results of experiment runs and failed or skipped runs are left out.gateway_evaluation_runs_totalcounts every run, experiments and failures included, with the reason code of a failure.gateway_evaluation_scoreholds score results normalized to 0–1 with the evaluator’s range (or the score config’s range for a result without an evaluator). A score with no known range is counted ingateway_evaluations_totalonly.gateway_evaluation_judge_cost_usd_totaladds the judge cost the ledger knows. A run whose cost is unknown adds nothing: unknown is never zero. The cost of a run whose evaluator no longer exists is counted undermodel="unknown".gateway_evaluation_pendingis the number of evaluation jobs waiting to run. It is read from the database, so it is the same on every replica: aggregate it withmax, notsum.- A result is counted when it is first written, or when a failed or skipped run of the same ID first succeeds. Any other replay of the same ID and a later edit or withdrawal are not counted again. The counters say what was judged; the analytics query, which reads the rows, says what the results are now.
No request, trace, session, key or end user is ever a label. gateway_evaluation_label_overflow_total counts the results whose label value was past a bound, so you can tell when to raise one.
Two teams with the same evaluation name
Section titled “Two teams with the same evaluation name”The evaluation label is the name alone. Two teams, or two organizations, that both call an evaluator helpfulness share one label value unless team_label is on. /metrics is the operator’s endpoint; a tenant never reads it. A tenant reads its own numbers through the analytics query and the Quality tab, which are bound to its teams.
Pass rate
Section titled “Pass rate”pass_rate = pass / (pass + fail), over results with status ok, production only. Results with assessment none are in neither side.
sum by (evaluation) (increase(gateway_evaluations_total{assessment="pass"}[1h]))/sum by (evaluation) (increase(gateway_evaluations_total{assessment=~"pass|fail"}[1h]))The analytics query’s pass_rate and the monitors use the same formula over the rows. For one replica’s counters and the rows written in the same period, the two agree.
Use increase over a range, as above. Where no result was written the division has no value and a panel shows a gap; do not fill gaps with a previous value or with zero, because a window with no results has no pass rate.
An evaluator that samples its traffic gives the pass rate of its sample. Read every rate beside the count it stands on.
More queries:
# Results per label of a categorical evaluationsum by (value) (increase(gateway_evaluations_total{evaluation="tone"}[1d]))
# Thumbs-up rate from end-user feedbacksum(increase(gateway_evaluations_total{is_feedback="true",assessment="pass"}[1d]))/sum(increase(gateway_evaluations_total{is_feedback="true",assessment=~"pass|fail"}[1d]))
# Feedback count, and results without feedbacksum(increase(gateway_evaluations_total{is_feedback="true"}[1d]))sum(increase(gateway_evaluations_total{is_feedback="false"}[1d]))
# 90th percentile of a score, on the 0-1 scalehistogram_quantile(0.9, sum by (le) (rate(gateway_evaluation_score_bucket{evaluation="quality"}[1h])))
# Share of runs that failed, per evaluatorsum by (evaluation) (increase(gateway_evaluation_runs_total{status="error"}[1h]))/sum by (evaluation) (increase(gateway_evaluation_runs_total[1h]))
# Judge spend per evaluator per daysum by (evaluation) (increase(gateway_evaluation_judge_cost_usd_total[1d]))The model label is the same alias the traffic series use (gateway_upstream_attempts_total, gateway_provider_latency_seconds), so a pass rate and a latency can share a panel by model.
Retention
Section titled “Retention”The series live in your metrics backend and follow its retention. Stored spans follow spans.retention_days and results follow the gateway’s own retention. A dashboard can therefore show the pass rate of last year for traffic whose traces are long gone.
Renamed and removed series
Section titled “Renamed and removed series”A series or label that is renamed keeps its old name beside the new one for one minor version, marked deprecated on this page. None is deprecated today.
Evaluation results in the analytics query
Section titled “Evaluation results in the analytics query”GET /api/v1/admin/analytics/query answers over evaluation results when the query names an evaluation metric or an evaluation dimension. Authorization, team scope, range and parameters are those of the usage query; it needs analytics:read, and for a team-scoped session the team’s plan must include evaluation_results.
| Metric | Meaning |
|---|---|
evaluations |
Results with status ok |
evaluation_pass, evaluation_fail |
Those with assessment pass, or fail |
pass_rate |
pass / (pass + fail), a fraction from 0 to 1; null when no result has a pass or fail assessment |
mean_score |
Mean of the numeric values, on the evaluator’s own scale; null without one |
feedback_count |
Results whose source is feedback |
judge_cost_usd |
The judge cost the ledger knows, an exact decimal string; judge_cost_incomplete in the answer counts the runs it does not cover |
evaluation_errors, evaluation_skipped |
Results with status error, or skipped |
| Dimension | Values |
|---|---|
evaluation |
The result’s name |
evaluator_id |
The evaluator that produced it; empty for API results and feedback |
assessment |
pass, fail, none |
evaluation_value |
The label of a boolean or categorical result; empty for a score |
evaluation_source |
llm, code, human, api, feedback |
evaluator_version |
The evaluator version |
evaluation_scope |
span, trace, session, run_item, run |
metric_type |
boolean, score, categorical, json, text |
origin |
app or experiment: the result’s own origin |
experiment_run |
The experiment run a result belongs to; empty for a result of live traffic. Grouping or filtering by it keeps experiment results in the query, as origin does |
Every dimension of the usage query also works, and then means the judged request’s: team, organization, model, requested_model (the route the client asked for), provider, key_id, principal, operation, status, error_code, guardrail, end_user, session_id, owner and tag:<name>. The join is made in the store, so one call answers “pass rate by route and by customer tag”:
curl -sG "$GATEWAY/api/v1/admin/analytics/query" -b "$COOKIE" \ --data-urlencode "metrics=pass_rate,mean_score,judge_cost_usd" \ --data-urlencode "group_by=evaluation,model,requested_model" \ --data-urlencode "from=2026-11-18T00:00:00Z" --data-urlencode "to=2026-11-25T00:00:00Z"Rules of the answer:
- Experiment results are left out unless the query groups or filters by
origin. - A withdrawn result is not counted.
evaluationsis always returned besidepass_rateandmean_score.- With
bucket, a series ordered by bucket has every bucket of its range: an empty one has zero counts and anullrate (zero_filled: true).unitsin the answer says what each column holds. - Evaluation metrics and usage metrics cannot be mixed in one query (400): results and requests are counted from different rows.
- A usage dimension is empty for a result whose request has no log row. For a team-scoped reader it is also empty when the request was recorded under another organization (the team has moved since).
- The
organizationdimension is the organization the result was recorded in; a result written before organizations were on falls back to its team’s current organization in the database and is empty in the analytics store. - With
spans.engine: analytics_store, the results the analytics store holds are added to those in the database before a rate is divided (read_storesaysdatabase+analytics_store). There the judged request is read from the copied request log (analytics_store_usage), which does not keepcache_kindandauto_route: grouping by those answers 400. Withanalytics_store_usageoff there is no copy to read: the gateway lists the requests the selected results judged, reads their rows from the request log in PostgreSQL and sends them with the query, so the answer is the one the copy would give. Nothing else needs to be turned on. The read is bounded: past 200,000 judged requests in the selection the query answers 422query_too_costly(narrow the range or filters, or turn the copy on), and a failed request log read answers 503storage_unavailable.
m7 ai uses the same query, so “what is the pass rate of helpfulness per model this week?” is answered with the same numbers.
The Quality tab
Section titled “The Quality tab”Usage → Quality shows, for the range and filters of the Usage screen:
- Traffic and the previous period (with
quality_kpi_cards): requests, average duration, error rate and, withusage_valuation, cost of the selection, each beside its value in the period of equal length just before the range and how it moved (below). - Tiles: the overall pass rate with the counts it stands on, the number of results, the feedback count and the evaluation spend (with the number of runs whose cost is not complete).
- Pass rate per evaluator: one row per evaluation with its pass rate and
n, results, mean score, feedback, errors and judge spend. An evaluator that was renamed is one row under its current name. A score evaluation shows its mean; a rate nothing stands on is a dash, never 0%. - One evaluation in detail: its pass rate over time (a bucket without assessed results is a gap), or the mean over time for a score evaluation that has no pass criteria; by model, by route, and the label distribution of a boolean or categorical evaluation. The full distribution of a score is on Evals → Analytics.
- Spend by origin: a link to the Cost estimates tab, where evaluation, experiment and playground traffic are their own lines.
- Monitors: with evaluation monitors, how many are in alert, in warning and OK.
The tab and the range are in the address (#/analytics?tab=Quality&range=7d, or from= and to= for a custom range), so a link reproduces the view. At phone width the tables become cards.
Every figure on the tab is an answer of the analytics query above, so the screen, the API and m7 ai never disagree.
KPI cards with the previous period
Section titled “KPI cards with the previous period”quality_kpi_cards (an operator flag, off by default; requires evaluation_metrics) adds four cards at the top of the tab: Requests, Average duration, Error rate and Cost, the last with usage_valuation. Each shows the selection’s figure, the figure of the period of equal length just before it (a 7-day range is compared with the 7 days before), and the change in percent, with (worse) or (better) for duration, error rate and cost. A period without requests shows a dash rather than a zero, and a change from zero is not computed. Cost sums the requests with a known cost: when a period has requests without one, its cost reads at least that amount, the card says how many were left out, and no change is computed for cost. The cards count client requests as the Usage screen does (helper calls and fallback attempts left out) under the screen’s filters.
They are one call of the analytics query with compare=previous:
GET /api/v1/admin/analytics/query?from=2026-11-18T00:00:00Z&to=2026-11-25T00:00:00Z&metrics=requests,avg_latency_ms,error_rate,cost_usd&compare=previousThe answer has the usual columns and rows, and previous with from, to, columns, rows, total_groups and truncated for the earlier period, computed by the same query over it, grouping and filters included. With group_by and limit, each period is ranked on its own, so its rows need not be the same groups in the same order: match them by their dimension values. compare takes previous only; it needs the flag (feature_disabled otherwise) and answers a query over requests, not over evaluation results (invalid_compare).
Correlation with traces
Section titled “Correlation with traces”With otlp_traces on, each result is also exported as a span event on the span it judged (evaluation results), with the trace and span IDs. Gateway spans, logs and metrics carry the same service.name resource attribute (ai-gateway), and the evaluation series carry the same model label as the traffic series.