Issues / #3053
#3053 serve: lifetime token totals + a Codex-style daily activity heatmap in the monitor
open · @wangzc1997 · 0 コメント · GitHub で見る
Setup & installServer & APIModels & quantsWindows
本文
The monitor is genuinely lovely. Two small additions around it would let it answer the question I keep getting asked: "how much have I been using this machine?" They share one mechanism — persistent per-day counters — so filing them together.
**1. Lifetime token totals (across restarts)**
The monitor already shows a per-session line under the request list ("Since <boot>: N requests · X prompt tokens read (Y reused) · Z written"), and `/metrics` `totals` matches it — but both restart from zero every time `serve` starts. For a machine that runs Strata 24/7 across many restarts, the number I actually want is the lifetime total: how many tokens this install has served so far.
Suggestion:
- Persist counters in a small JSON in the instance's state directory (prompt_tokens, output_tokens, reused_tokens, requests, plus per-day buckets), merged at startup.
- Expose as `totals_lifetime` in `/metrics` next to the existing session totals; current fields unchanged.
- Show a "Total since install" line in the monitor.
The increment site already exists where `totals` is maintained; the new work is mainly flushing the counters on shutdown / SIGTERM (including Windows terminate).
**2. A Codex-style daily activity heatmap**
The Codex CLI shows a token activity grid: one square per day, weeks as columns, shaded by that day's token count, with 每天 / 每周 / 累计总量 (daily / weekly / cumulative) toggles. It makes usage patterns obvious at a glance, and with the per-day buckets from (1) the data is already there.

**Context**
Until now I reconstruct both by parsing "[strata] done: N tokens" and "prompt N tokens = ..." log lines — workable, but older logs omit the prompt field for small prompts, so those can only be estimated. A first-class counter would be far more reliable, and the heatmap would make the monitor even better than it already is.
Environment: v0.1.44.1, Windows 11.
関連リンク
インストール・モデル・リリースへの站内リンク。