Judge calls as linked, labelled traffic
Last updated: 2026-11-26T03:21:52-03:00 (UTC-3)
A judge is a model call the gateway makes for you. With evaluation tracing on, that call stops being an anonymous request among your application’s:
- every request log row says how the request entered the gateway (its origin): your application, the console Playground, a judge, an experiment, an evaluator test, one of the gateway’s own feature calls (a helper call, with its sub-kind) or a shadow copy;
- every judge run is its own trace, with a judge span linked both ways to the span it judged, in the stored spans and over OTLP;
- every evaluation result carries the judge trace, the judge request and what the judgement cost, read from the ledger;
- every evaluator reports its health (ok, degraded, blocked) and its cost over the last 7 days;
- Cost and Usage split spend and volume by origin, so evaluation, Playground and helper spend are their own lines, each billed to the team and organization that caused it;
- each client request counts once: helper calls and fallback attempts are linked to the request they were made for and stay out of request, success and latency counts, while their tokens and cost are counted.
The trace of the request that was judged is never touched: its duration, its spans and its cost stay its own. Nothing is added to the request path beyond naming the origin on the row the request already writes.
Turn it on
Section titled “Turn it on”features: evals: true evaluation_results: true # the judge fields live on evaluation results evaluation_tracing: true span_store: true # recommended: stores the judge spans and the links| Flag | Default | What it turns on |
|---|---|---|
evaluation_tracing |
false |
Everything on this page. Requires evaluation_results (the gateway refuses to start otherwise). A tenant action: with feature_plan_entitlements a team’s plan must include it for its judge runs to be traced and for its readers to see the judge links, health and cost. Changeable at runtime from Settings → Features or PUT /api/v1/admin/features/evaluation_tracing; a console override wins over YAML and can be reverted. |
What each neighbouring flag adds:
| With | You also get |
|---|---|
span_store |
The judge span and the judge’s request and attempt spans are stored, so View judge trace opens a trace. Without it the result still carries the judge trace ID and cost, the request log still shows the judge request with its origin and what it judged, and OTLP still receives the spans. |
| An OTLP trace exporter (observability) | The judge span and both links reach your OpenTelemetry backend. |
usage_valuation and the analytics:read permission |
Judge cost on results, evaluator cost, and spend by origin. Without them the links and the health are shown, never the amounts. |
alert_channels |
The evaluator_health_changed alert. |
With the flag off the gateway behaves exactly as before: a judgement writes the result it wrote before, no judge span exists, request log rows carry no origin, and the origin filter is refused.
What happens when you turn it on
Section titled “What happens when you turn it on”- New request log rows are stamped with their origin as they are written.
- A background pass gives older rows an origin (see older rows). It runs a batch at a time, can be interrupted and resumes where it stopped.
- From the next judgement on, each judge run is traced and its result carries the judge fields. Results written before keep empty judge fields; nothing is rewritten.
The origin of a request
Section titled “The origin of a request”| Origin | The request is |
|---|---|
app |
A client’s request made with a key: your application, an SDK, a batch line (it keeps the submitter’s identity and names its batch), the console Playground with a typed key |
playground |
A console Playground request sent with your console session (see the session Playground), or an evaluator test (Test on the evaluator editor) |
evaluation |
A judge’s model call, of an evaluator on live traffic or of an experiment |
experiment |
An experiment item’s model call |
helper |
One of the gateway’s own feature calls, with a sub-kind (see helper calls) |
shadow |
A shadow copy of a request |
replay |
A stored request an operator sent again with request replay (flag request_replay); it runs as the operator and names the request it replays |
The gateway decides the origin from its own call path: only a call the gateway makes to itself in process, or a request the console’s session route made for an authenticated console user, can be anything but app. No header, body field, key name, token name or X-Request-Id a client sends is read for it (an X-Gateway-Origin header or a metadata.origin field is ignored), so a client cannot label its traffic as a judge’s or the Playground’s, or hide a judge’s among its own.
Fallback attempts and batch lines
Section titled “Fallback attempts and batch lines”A request-level fallback (a semantic fallback after a context-window or content-policy refusal, or a customer allowance fallback) is a second request the gateway makes for the client’s. That attempt:
- keeps the caller’s origin (
appfor an application,playgroundfor the Playground, and so on) and the caller’s identity; - names the request it was made for in
parent_request_id, a stored field (not a suffix of its request ID); - is counted in cost: whatever the provider billed for it is in Cost, also when a later attempt is the one that answered;
- is not a request of its own: it stays out of request, success, error and latency counts, so the client’s request counts once, with the status and latency the client saw.
A batch line is the submitter’s own request: origin app, the submitter’s key, team and organization, batch_id naming its batch, and counted as a request. Lines are priced at the model’s standard rate: a provider’s batch discount is not modelled.
Helper calls
Section titled “Helper calls”helper is only for the gateway’s own feature calls. Each carries a closed sub-kind (helper_kind), set by the gateway:
| Sub-kind | The call |
|---|---|
guardrail |
A moderation guardrail’s check of a request or of its answer |
classifier |
The router’s classification: the complexity classifier’s call, and the embeddings of a semantic auto-route (the route index the first request builds, and each query) |
summary |
A context-overflow summary of the turns it replaces |
ask_ai |
A model call of m7 ai (the console’s assistant; ask_ai is its machine identifier) |
cache_embedding |
The embedding of a semantic cache lookup |
tool_search |
The embeddings of an MCP tool search |
vector_store |
A vector store’s embeddings (file ingestion, search) and OCR |
model_test |
An administrator’s model connection test (Test on a model); it has no team and is a gateway-level cost |
Every helper call:
- is billed to the team and organization that caused it: it runs as the caller’s key (narrowed to the helper’s model), so its cost line is the caller’s team’s, under the same organization isolation as the request. m7 ai’s calls are billed to the team the asker chose (
teamin the request, among the teams the asker may use as in the session Playground) or, when the asker has exactly one team, to that team; an asker with several teams and no choice, or none, pays at the gateway level (no team), and so does an administrator’s model test; - names the request it was made for in
parent_request_id(m7 ai: the console request that asked); - stays out of the client’s request counts, and appears in Cost as its own line by sub-kind.
How requests are counted
Section titled “How requests are counted”Usage’s requests, successes, errors, average and p95 latency, the daily rollups and the structured query’s requests, success, errors, error_rate and latency metrics count client requests: every row except a helper call or a row with a parent_request_id. Token sums and cost count every row. The By origin ranking and the calls metric count calls (every row), so a helper sub-kind and an origin’s fallback attempts show what they did. Rows written before this release, or with the flag off, have neither field and are counted as before.
The session Playground
Section titled “The session Playground”With playground and evaluation_tracing on, the console Playground offers Send with: My console session (the default) or Typed key:
- My console session sends the request to
POST /api/v1/admin/playground/<v1|v1beta>/<route>with your session cookie, the CSRF token and the team you chose (X-Gateway-Playground-Team). The gateway checks the session as for any console write, then runs the request as you in that team (its key ID isplayground:<team>:<your user>, so nothing bound to a key, such as a key-scoped semantic cache entry or a stored response, crosses from one team to another): principal and owner are your console user, the team and organization are the chosen team’s, and the models and routes are what the team’s policy and its organization’s ceiling allow. It then goes through the ordinary inference route: team policy, plan, attribution requirements, concurrency, rate limits, budgets, guardrails, capture, logs, metrics, ledger and cost apply as for any request, and the row isplayground. Playground traffic is real traffic: it has its log, its request count, its latency, TTFT and tokens like any other request. - Typed key sends with the key you paste, to the bearer routes, as before; its requests are
app.
Which teams you may choose: a team you are a member of; for an organization admin, any team of its organization; for the global administrator role (without a custom role), any stored team. Operators and other roles choose among their own teams. Viewers, team viewers, customer credentials and the admin bearer token cannot send with the session (403 role_forbidden); any other team, or a team that is missing, deleted or disabled, answers 403 team_forbidden. The models and providers are the ones configured in the gateway, called with the gateway’s own provider credentials.
The session route serves one request, one answer: chat/completions, responses, messages, embeddings, images/generations, audio/speech, audio/transcriptions, decisions, systemone, moderations and rerank (and v1beta/decisions). Features bound to a key’s stored objects (realtime, published prompts, MCP tools and code, vector store context, files and batches) still need a typed key; with the session the Playground says so.
Where you read it
Section titled “Where you read it”- Request log: an origin tag on rows that are not
app(a helper row readshelper · guardrail), For … or Attempt of … naming the parent request, an Origin filter with each helper sub-kind, andorigin,helper_kind,parent_request_idandbatch_idon each row ofGET /api/v1/admin/logs(?origin=helper&helper_kind=guardrail). - Usage: an Origin filter and a By origin panel with the helper sub-kinds under
helper(by_originandby_helper_kindonGET /api/v1/admin/analytics, counted in calls). - Cost: Spend by origin (
by_originandby_helper_kindonGET /api/v1/admin/valuation,?origin=,&helper_kind=): evaluation, experiment, playground and helper spend beside the application’s, each helper sub-kind its own line, each with its known amount. The amounts add up to the ledger total of the selection. - What guardrails and judges cost: the spend of model-backed checks is its own line, never mixed into the application’s. A guardrail check that calls a model is the
guardrailline underhelper(by_helper_kind;?origin=helper&helper_kind=guardrailreads it alone), and an evaluator’s judge calls are theevaluationline (by_origin). A moderation call has no price model, so a moderation check reads as unknown in that line’s coverage, never as zero. - Structured queries:
originandhelper_kindare dimensions and filters ofGET /api/v1/admin/analytics/query(group_by=origin,helper_kind&metrics=requests,calls,cost_usd). - Spans: every stored span has had its request’s origin since the span store.
A row with no origin reads as app everywhere, and so does a row of a team whose plan does not include the feature (on the request log and the journey alike). The origin filter accepts one value of the table; anything else, or the filter with the flag off, answers 400 invalid_origin. helper_kind needs origin=helper and one sub-kind of the table, else 400 invalid_helper_kind. The filter and the rankings follow the gateway’s flag and count every team you may read; a team whose plan lacks the feature still has its rows classified there, though its rows and journeys show no origin. While an origin filter is set, daily rollups are not used (they are not split by origin) and the report reads the request log directly.
Older rows
Section titled “Older rows”Rows written before the flag was on have no origin. The background pass classifies the gateway’s own evaluation traffic among them, and only from the pair of identifiers the gateway mints for its own calls: the in-process caller (eval:rule:<rule>, eval:<run>, evaltest:<id>) together with the request ID it gave the call (evalrule.…, eval.<run>.<item>, ….judge…). A client request that happens to use a similar request ID keeps no origin and reads as app. Helper and shadow calls of before cannot be told apart from their rows and also stay app.
GET /api/v1/admin/usage/origin-backfill (a global role) reports the progress:
{"cursor": 184220, "target": 184220, "started_at": "2026-11-23T14:02:11Z", "finished_at": "2026-11-23T14:02:19Z", "classified": 3120, "batches": 10, "done": true}It covers 20,000 request log rows per pass, up to 25 passes every 2 seconds, and stops at the newest row that existed when the flag came on (later rows are stamped as they are written). If the flag is turned off and on again, it resumes from its stored position.
Judge traces
Section titled “Judge traces”Each run of an evaluator on one target is a trace of its own:
judge helpfulness v3 judge span (root) ── evaluates ──▶ the judged span└─ POST /v1/chat/completions the judge's request, origin evaluation └─ provider.chat gpt-4o-mini provider attempt, with its cost- The judge span is the root. It has no cost of its own: the cost is on the judge’s request and attempt spans, as for any request. A judge that retries (an invalid answer, a provider error) has one request span per call, all in the same trace. A code evaluator, which calls no model, is a judge span alone.
- The judge span carries a stored link
{trace_id, span_id, relation: "evaluates"}to the span it judged. When the judged request’s span is not stored (span store off for it, sampled out), the stored link names the trace only, and no OTLP link is exported (an OTLP link needs a span). - The judged span shows the other side,
relation: "evaluated_by", pointing at the judge span. It is derived from the result when the trace is read; a stored span is never rewritten. - The judge span’s ID is the first 16 characters of the judge trace ID, so a result’s
judge_trace_idis enough to address it. - Judge traces are always kept by the span store’s sampling: a result never links to a trace that was sampled out.
- A failed run that the worker will retry leaves no result, but it leaves its judge span (status
error), because it was traffic and may have cost money. - An experiment judge links to its item’s request span. The item and its judges are separate traces.
The judge span holds identifiers, status and numbers, never the prompt, the judged content or the reasoning:
| Attribute | Meaning |
|---|---|
gen_ai.evaluation.name |
The evaluator’s name |
gateway.evaluation.evaluator.id, .version, .type |
The evaluator, the exact version that ran, and llm_judge, decision or code |
gateway.evaluation.id, .status, .status_reason, .assessment, .scope |
The result the run produced |
gateway.evaluation.target.trace_id, .span_id, .request_id, .session_id |
What was judged |
gateway.evaluation.run_id |
The experiment run, for an experiment judge |
gateway.evaluation.judge.request_id, .requests, .cost_usd, .cost_state |
The judge’s own requests and what they cost |
gen_ai.request.model, gen_ai.usage.input_tokens, gen_ai.usage.output_tokens |
The judge alias and the tokens of all its calls |
gen_ai.evaluation.score.value or .label |
A numeric, boolean or categorical verdict; text and JSON values stay on the result |
Like every span it also carries the key (the judge’s internal principal), the team and the organization.
Over OTLP
Section titled “Over OTLP”With a trace exporter configured, the judge span is exported as the root of its trace with an OTLP span link to the judged span, and the exported result span (a child of the judged span) carries a span link back to the judge span. Each link has the attribute gateway.link.relation (evaluates or evaluated_by). The judge’s request and attempt spans are exported as its children with their usual GenAI attributes. No content leaves.
In the console
Section titled “In the console”- A result on a trace or a session has View judge trace, and shows the judge cost.
- A judge trace says Judge of … with View evaluated trace and the evaluator and version, and its type reads Judge trace.
- The judged span lists Evaluated by under Links; the judge span lists Evaluates.
- In the request log, a judge’s own request has the
evaluationtag and, under its ID, Judge of … naming the request (or trace or session) it judged; its journey says the same with the evaluator and a way to open what it judged. A failed run that will be retried has no result yet, so its row names nothing until it does.
GET /api/v1/admin/traces/{trace_id} returns judge_of on a judge trace, and GET /api/v1/admin/requests/{id}/journey returns it on a judge’s request:
{"judge_of": {"evaluation_id": "rule_5f0c…", "evaluator_id": "ev_19ab…", "evaluator_name": "helpfulness", "evaluator_version": 3, "scope": "span", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736", "span_id": "00f067aa0ba902b7", "request_id": "req-42", "status": "ok"}}The judge fields of a result
Section titled “The judge fields of a result”| Field | Meaning |
|---|---|
judge_trace_id |
The trace of the judge run that produced the result |
judge_request_id |
The judge request that produced the verdict; for an error result, the last one the judge tried |
judge_cost_usd |
The exact known cost of every request of the run’s trace, summed from the ledger: retries, and any call a judge request makes itself (a fallback, a guardrail). Absent when unknown |
judge_cost_state |
known (every call is valued), partial (some amount is known) or unknown. A call with no ledger row (usage writes off or failed) makes the run partial or unknown, never a complete amount. Unknown is never zero |
GET /api/v1/admin/evaluations?judge_trace_id=<id> lists the results a judge run produced; it takes up to 200 comma-separated trace IDs (the request log reads a page’s judge rows in one call), and any value that is not a 32-character hex trace ID answers 400. A result whose judge fields are hidden from you (its team’s plan lacks the feature) is not returned by this filter. The amounts are shown only to readers who may see costs.
Evaluator health and cost
Section titled “Evaluator health and cost”GET /api/v1/admin/evals/evaluators returns health, by evaluator ID, and the Evaluators list shows it:
{"health": {"ev_19ab…": {"state": "degraded", "reason": "judge_errors", "window_hours": 24, "results": 28, "errors": 2, "skipped": 0, "error_rate": 0.0667, "cost_window_days": 7, "results_7d": 196, "errors_7d": 2, "skipped_7d": 3, "cost_7d": {"state": "known", "known_usd": "0.004312", "requests": 201, "unvalued_requests": 0}, "cost_per_result_usd": "0.000021777777"}}}| State | When | What to do |
|---|---|---|
ok |
None of the below | Nothing |
degraded |
In the last 24 hours, at least 5% of the judged results (ok and error; a skipped target was not judged) ended as an error | Open the error results: the reason says whether the judge model failed or its answer could not be read |
blocked |
The worker paused the evaluator by itself: the judge was refused (model not allowed, budget or quota exhausted), its definition is no longer valid (its judge alias was removed) or its daily cost ceiling was reached; reason says which |
Fix the cause, then resume the evaluator |
The 7-day cost is the ledger cost of the evaluator’s judge requests (live runs and experiment judges, retries and failed runs included), with the tokens and the cost per judged result. It is read from the ledger each time, so it is current as soon as a job completes, and it does not depend on span retention: expired judge spans leave the spend where it is. cost_7d and the token counts are returned only to readers who may see costs, and the judge span’s own cost attributes follow the same rule. An evaluator that calls a model and judged in the window but has no ledger rows (usage writes off or failed) reads unknown, never zero; cost_per_result_usd is given only when the amount is complete (known).
Subscribe a channel to evaluator_health_changed to be told when a judge run leaves an evaluator blocked or degraded. The alert names the team, the evaluator, the state and the reason (for a block, the worker’s pause reason; for degraded, the error code); one per evaluator and state per clock hour. Never content.
Both span engines
Section titled “Both span engines”Everything here works with spans.engine database and analytics_store: the judge span is written by the same writer to the same engine as every other span, and the health counts read results from wherever they are. The request log and the ledger stay in the transactional database; the analytics store copy of the request log carries origin, helper_kind, parent_request_id and batch_id (the columns are added to an existing table on start; rows copied before read as app and counted, until the backfill updates them and the copy follows), and its reports count requests and calls by the same rule.
Who sees what
Section titled “Who sees what”- The judge span, the judge’s requests and the results belong to the evaluator’s team; every read is filtered by the reader’s teams and organization, as for any trace. A reader of another team or organization gets 404 on the judge trace and on the judge’s request, and no
evaluated_bylink on spans they can see in a shared trace. - A team whose plan lacks
evaluation_tracinghas no traced runs, and its readers see no judge link, health or cost.
Limits and notes
Section titled “Limits and notes”- One judge span per run; at most 8 links on a span.
- A result that is judged again (a retried job, a re-run experiment item) names its latest judge run and that run’s cost; the earlier runs keep their traces and their ledger rows.
- The judge’s request IDs are built from the judged request’s ID (
evalrule.<rule>.<request id>.<attempt>,eval.<run>.<item>.judge.<evaluator>.<attempt>). A request ID is at most 128 characters: when the built ID would be longer the gateway gives the judge request a random ID instead. The result’s judge trace and judge cost are unaffected (they follow the trace), butjudge_request_idthen names no request, and that request is missing from the evaluator’s 7-day cost and from the origin backfill. Keep your own request IDs under 80 characters and dataset item IDs under 50 to stay clear of it. - The 7-day cost counts experiment judges of runs created in the last 37 days. A judge’s calls are recognised by how they were made, not by their request ID; older rows (before the flag) are recognised by the request ID’s end (
.judge.<evaluator>.<attempt>), so a dataset item ID that itself ends that way can be misread there. Avoid.judge.in dataset item IDs. - While several replicas run the background pass, its
finished_atcan read empty for a moment after one replica finished its share;donesettles once the newest target is reached. - The judge span is written by the span writer’s bounded queue: when it is full the span is dropped and counted (
gateway_span_store_spans_total{kind="judge"}, a series that appears with the first judge span). The result and its judge fields do not depend on it. - Migration 203 adds
gateway_usage_events.originand the backfill’s state table; migration 204 addshelper_kind,parent_request_idandbatch_id. Neither rewrites or scans the request log. Rows written before either keep no sub-kind and no link: older helper rows read asapp(the backfill cannot tell them apart) and older fallback attempts are counted as requests. - A judge’s own retries (a decision judge retried after a 429 or 5xx) are separate
evaluationcalls of the judge, not fallback attempts. - Daily rollups built before migration 204 counted every row as a request; days rebuilt afterwards use the rule above.