Repository navigation
Description
Existing issues
- I searched open and closed issues and did not find a duplicate.
Problem or use case
I want to monitor Win-CodexBar quota state from Prometheus across Windows machines. The existing serve command exposes authenticated JSON endpoints, but Prometheus users currently need a separate adapter such as json_exporter and must duplicate field mapping, error semantics, and cache handling outside Win-CodexBar.
Proposed solution
Add an opt-in Prometheus endpoint to the existing CLI server:
codexbar serve --metrics
The proposed behavior is:
/metricsis disabled by default and returns 404 unless--metricsis set.- It reuses the existing
serveHost validation, Bearer-token gate, dashboard snapshot cache, and single-flight refresh path. - It exposes Prometheus text format for exporter health, provider collection state, quota used/remaining percentages, reset timestamps, and other stable numeric fields already present in the dashboard snapshot.
- It does not expose account email, plan text, display labels, credential material, or free-form provider error messages.
- It does not invoke an AI model or consume Codex/ChatGPT inference quota; it only reads the same usage data already collected by Win-CodexBar.
I have a working Windows prototype and can submit a focused PR containing only the CLI flag, endpoint, renderer, tests, and minimal documentation after the preferred metric scope and naming are confirmed.
Questions for maintainers:
- Should the endpoint expose every enabled provider, or initially limit the contract to Codex?
- Is reusing the dashboard snapshot contract/cache the preferred source, or should metrics have a smaller dedicated snapshot type?
- Should stable local account identifiers be omitted entirely from metric labels in the first version?
Affected area
- CLI
- Startup / background behavior
- Documentation
- Provider-specific behavior for the initial core endpoint
Alternatives considered
- Configure Prometheus
json_exporteragainst/dashboard/v1/snapshot. - Run a separate local exporter that calls Win-CodexBar JSON endpoints.
Both work, but they duplicate authentication, cache/error interpretation, metric naming, and privacy filtering. Keeping the renderer beside the existing cached snapshot makes the exported contract testable with the same source data and avoids another credential-bearing process.
Additional context
The first PR can deliberately exclude Grafana dashboards, alert rules, reset-credit-specific behavior, installers, and release workflow changes so the core endpoint remains small and reviewable.
Activity
Finesssee commentedon Sep 15, 2026
Thanks for the feature request, I will think about it.
Finesssee commentedon Sep 15, 2026
Thanks for the proposal. The direction looks good, and a native endpoint is preferable to a separate exporter if V1 remains a thin projection of the existing authenticated serve path.
For the first PR, please use this contract:
codexbar serve --metricsenables authenticatedGET /metrics; without the flag,/metricsreturns 404.Please keep the PR limited to the CLI flag, endpoint, renderer, focused tests, and minimal documentation. Tests should cover the disabled 404, Host/authentication gates, privacy filtering, metric units, partial failures, cache/single-flight behavior, and no-inference behavior. Open it as a draft PR when ready so we can review the concrete metric contract.
le-shi commentedon Sep 17, 2026
PR #511 is ready for review, and CodeRabbit has completed successfully with no actionable comments. The current head is
b6b29dc.The remaining required check,
ci/circleci: pr-check, stays atExpected - Waiting for status to be reported. I verified that no CircleCI pipeline is created for this fork branch, while same-repository PRs runpr-checknormally. The project uses CircleCI's GitHub App integration, for which CircleCI currently lists "Build Pull Requests From Forked Repositories" as unsupported: https://circleci.com/docs/guides/integration/version-control-system-integration-overview/#feature-support-for-each-pipeline-typeDo I need to take any further action on PR #511, or would you prefer to mirror the branch into
nesszer/Win-CodexBarso the required CircleCI check can run? I can also provide any additional validation or make further changes if needed.