# Metrics

> A Prometheus endpoint for platform teams: aggregate request, token and spend numbers for the last 24 hours, with no prompts, model ids or account details.

Source: https://oneaiapikey.com/docs/metrics

`GET /metrics` returns the gateway’s last 24 hours in the [Prometheus text format](https://prometheus.io/docs/instrumenting/exposition_formats/), so a platform team can graph it next to its own services.

The endpoint is **off unless the operator sets a token**, so no deployment publishes spend by accident. Ask support if you need it on your account’s deployment.

## Traces (OTLP)

When the operator sets `OTEL_EXPORTER_OTLP_ENDPOINT`, the gateway exports one OpenTelemetry span per relayed request to `POST <endpoint>/v1/traces` using OTLP/HTTP JSON:

- Attributes are the HTTP method, the path without its query string, the response status, the requested model and whether the reply streamed. Nothing from the prompt, reply, headers or credential is exported.
- Spans are batched up to 100 and flushed every five seconds. A failed export is logged and dropped; it never affects a request.
- `OTEL_EXPORTER_OTLP_HEADERS` sends collector headers (`k=v,k2=v2`), and `OTEL_SERVICE_NAME` sets the resource service name.
- The endpoint must be https; plain http is accepted only on loopback for a local collector.

This is separate from the Prometheus metrics above and stays off until a collector is configured.

## Related

- [Routing and privacy](https://oneaiapikey.com/docs/routing-privacy): what the gateway records per request.
- [Cost control](https://oneaiapikey.com/docs/cost-control): caps and alerts for your own account.
