Skip to content

Expose Codex reset-credit metrics and provide monitoring examples #622

Description

@le-shi

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions