Skip to main content
Metrics are rolling aggregations over traces. TruLayer computes them continuously and surfaces them in the dashboard and via the /v1/metrics endpoint.

Built-in metrics

Query

In the dashboard

The Metrics page shows these metrics as time-series charts. You can:
  • Filter by project, model, or tag
  • Overlay multiple metrics on the same axis
  • Drill from any point into the underlying traces

Project-scoped metrics

GET /v1/projects/{id}/metrics returns a single scalar metric scoped to one project over a fixed window. This endpoint complements the trace-level /v1/metrics endpoint — it answers questions about control-loop behaviour at the project level rather than about individual trace latency or cost.

Supported metrics

Parameters

Response shape

value is always an integer count. The endpoint returns 0 (not null) when no traces match in the window.

Auth

Requires a Clerk session (viewer role or above) or an API key with the query scope.

Example

Use retry_cap_hit alongside your policy’s max_retry_depth setting to tune the escalation threshold: if the count is high, consider raising the depth cap or adjusting the trigger condition to reduce spurious retries.

Cost calculation

TruLayer maintains a per-model price table for major providers (OpenAI, Anthropic, Google, Cohere). Cost is computed at ingest time and stored on the trace so historical reports are stable even when upstream prices change. For custom models or providers, attach metadata.cost_usd to the LLM span and TruLayer will use it instead of the price table.