Skip to content

feat(top): live dashboard with active users (DAU/WAU/MAU), traffic, connectors, quota, armor#59

Merged
acmck merged 2 commits into
mainfrom
feat/top
Jul 7, 2026
Merged

feat(top): live dashboard with active users (DAU/WAU/MAU), traffic, connectors, quota, armor#59
acmck merged 2 commits into
mainfrom
feat/top

Conversation

@acmck

@acmck acmck commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

What

getop top — the command the project name promised. A full-screen, auto-refreshing (Rich Live, alternate screen) dashboard composing existing read-only collectors:

  • Active users — 24h / 7d / 30d counts plus assigned seats
  • Queries & latency — from the stats collectors (--since window per refresh)
  • Connector health — states + last-sync age from the ls collectors
  • Quota — top consumers by percent used, exceeded counts flagged
  • Model Armor hits — per-filter counts from the armor collectors

--interval/-n (min 10s, default 30s), --once for a snapshot, --json for machine-readable output. Panels are isolated: a failing source renders as unavailable with its error shown while the rest keep refreshing.

How DAU/WAU/MAU work (the research question behind this PR)

Gemini Enterprise exposes no active-user metric in Cloud Monitoring, and the console's analytics export API writes aggregates into BigQuery — a mutation, so off-limits for a read-only tool. But UserLicense.lastLoginTime updates on login, and anyone active inside a trailing window necessarily has their last login inside it — so counting licenses with lastLoginTime ≥ now − 24h/7d/30d gives exact trailing DAU/WAU/MAU as of now, with no logging enabled and no IAM beyond what getop already needs. The documented limitation: historical curves can't be reconstructed (each login overwrites the timestamp); true per-day history needs the user-activity log, which requires observability logging.

Verification

  • uv run pytest -q — 145 passed (7 new tests: trailing-window math incl. naive/garbage timestamps, panel-failure isolation via FakeClients' missing monitoring client, render smoke, unavailable-panel rendering; top added to the CLI help guards)
  • Live against a real project (--once and --once --since 24h): active-user tiles populated from license data (and immediately revealed a real adoption gap between assigned seats and monthly actives), quota and latency panels carried real data, connectors rendered with states
  • Read-only: no new API surface at all — every panel calls a collector another command already owns

🤖 Generated with Claude Code

acmck and others added 2 commits July 6, 2026 19:39
…ta, armor

The command the project name promised. getop top renders a full-screen
auto-refreshing view (Rich Live, --interval/-n, --once, --json) composing
the existing read-only collectors: query volume/latency and quota from
stats, connector states from ls, Model Armor hit counts from armor.

Active users (24h/7d/30d) are derived from UserLicense.lastLoginTime:
Gemini Enterprise exposes no active-user metric, and the analytics
export writes to BigQuery (a mutation, off-charter), but anyone active
in a trailing window necessarily has their last login inside it, so
trailing DAU/WAU/MAU counts are exact as of now with no logging or
extra IAM required. Historical curves are documented as out of reach
(each login overwrites the previous timestamp).

Panels are isolated: a failing source renders as unavailable with the
error on the dashboard while the rest keep refreshing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@acmck acmck merged commit 4f6497c into main Jul 7, 2026
3 checks passed
@acmck acmck deleted the feat/top branch July 7, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant