Skip to main content

Module github_counters

Module github_counters 

Source
Expand description

A DaemonService that periodically logs a summary of omni-dev’s GitHub API-call counters (#1387), and surfaces them in daemon status.

The counters themselves are recorded by crate::github_metrics::run_gh at every gh call site (across the daemon and one-shot CLI processes) as kind: "gh" request-log records. This service just reads them back and emits a tracing summary at three points, so there is a periodic footprint in the log and a clean before/after marker across restarts without anyone running a command:

  • ~5s after startup — a baseline once the pollers have come up.
  • every 10 minutes thereafter — a background task on a private CancellationToken, mirroring the worktrees poller shape.
  • once on shutdown — from shutdown, the deterministic, awaited flush that registry.shutdown_all() drives after the accept loop drains. That single hook covers SIGTERM / SIGINT / SIGHUP and the built-in shutdown op, since all of them funnel through the one shared token that ends the accept loop.

Every emission is best-effort and bounded (a small local log read, no network), so it never delays shutdown.

Structs§

GithubCountersService
Periodically logs, and reports on demand, the GitHub API-call counters.