Commit Graph
3 Commits
Author SHA1 Message Date
lukaszraczylo 6d55972b60 fix(metrics): render fleet-wide families from the shared store
The /metrics route runs in its own instance. That instance handles no chat traffic, so its in-memory families stayed empty.

With a limiter store, /metrics now reads the router, decision, latency, prompt-cache, provenance and rejection families from shared counters. Their HELP text uses the store-backed aggregation note. Without a store, or without the stats flag a family needs, the in-memory rendering is unchanged.

The latency counters gain day-window sums in milliseconds and streaming-only bucket counters. The histograms can then emit a real _sum and keep the stream label. Provenance writes use countAsync. The rejection month counter rides the existing rejection batch. A store read failure skips the affected families.
2026-11-26 02:34:38 +00:00
lukaszraczylo cf1ae262d6 refactor(pricing): share one prompt token split 2026-11-26 01:55:17 +00:00
lukaszraczylo d661166eab feat(metrics): count prompt-cache tokens and savings per model
The gateway now counts cache-read, cache-write and uncached prompt tokens
per provider and model as a Prometheus counter. It also writes the read,
write and saved micro-USD totals to the Redis counters.

The admin usage models detail view returns the three totals per model.
Response-cache hits do not count, and free models save nothing.
2026-11-26 01:03:50 +00:00