Context
The optional authenticated /metrics endpoint is in main, and Codex already fetches /wham/rate-limit-reset-credits for its informational UI window. Today the reset-credit request runs on each successful usage fetch, the count and expiry are absent from Prometheus, and the repository has no importable Chinese Grafana dashboard or Prometheus alert examples.
Requested behavior
- Expose
codexbar_reset_credits_available{provider="codex"} with nonnegative counts (0 means exhausted) and -1 when unavailable or in PAT mode.
- Expose
codexbar_reset_credits_next_expiry_timestamp_seconds{provider="codex"} only for the earliest future expiry among available credits. Do not expose credit IDs or unbounded labels.
- Cache both successful and unavailable reset-credit observations for 10 minutes, scoped by account, credential, and API base URL. Keep independent observations for suspicious weekly-reset confirmation.
- Provide an importable Chinese Grafana dashboard (weekly by default, single/all-node selection) and sample authenticated Prometheus scrape and alert rules using the current fixed ratio metric names.
- Document the metric semantics, especially
-1 versus 0, and verify the metrics and cache behavior with tests.
The existing dashboard snapshot and non-blocking /metrics collection architecture should remain intact.
Context
The optional authenticated
/metricsendpoint is inmain, and Codex already fetches/wham/rate-limit-reset-creditsfor its informational UI window. Today the reset-credit request runs on each successful usage fetch, the count and expiry are absent from Prometheus, and the repository has no importable Chinese Grafana dashboard or Prometheus alert examples.Requested behavior
codexbar_reset_credits_available{provider="codex"}with nonnegative counts (0means exhausted) and-1when unavailable or in PAT mode.codexbar_reset_credits_next_expiry_timestamp_seconds{provider="codex"}only for the earliest future expiry among available credits. Do not expose credit IDs or unbounded labels.-1versus0, and verify the metrics and cache behavior with tests.The existing dashboard snapshot and non-blocking
/metricscollection architecture should remain intact.