KPI dashboard: Grafana on clconsole fed by read-only /api/kpi routes #184
No reviewers
Labels
No labels
area:docs
area:identity
area:ops
area:plugin
area:server
channel:community
channel:direct
channel:owned
channel:press
channel:social
e2ee-constrained
gate:at-ga
gate:pre-ga
marketing
parity
relay:absent
relay:planned
relay:requested
relay:supported
risk:additive
risk:contract
risk:none
usability
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Nectenda/nectenda!184
Loading…
Reference in a new issue
No description provided.
Delete branch "worktree-kpi-dashboard"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Task: NEC-122
A private KPI dashboard: Grafana on clconsole, fed every 15 minutes by a collector that reads new read-only
GET /api/kpiroutes on the identity service and each shard.What changes on the fleet
GET /api/kpi, guarded by a new optionalKPI_TOKEN. Leave it unset and the route answers 404, so this ships inert until the token is set on the hosts. The route refusesADMIN_TOKEN, the directory token and user sessions. Both routes only read existing tables: no schema change and no new retention./api/admin/users?id=now resolves a dashboard id to a person, using the admin token.docs/security-model.mdgains a "Usage metrics, which we keep internally" bullet.Two things that weren't obvious
auth_flows.method.completeFlowalready wrote it, but nothing read it. A finished flow is kept for about an hour after it expires, so the collector polls every 15 minutes. A flow counts as a sign-up only when it is the user's first flow and the user was created while it was open, because a second sign-in within 10 minutes of signing up would otherwise count as one too. Sign-ups from before collection are inferred: a provider counts as the sign-up method if it was linked within 5 s of the account's creation.seqsummed per folder, not the number ofdoc_updatesrows. Snapshots delete the updates they absorb, so a row count undercounts.seqis max+1 across the log and the snapshot, so it counts every update ever made. A test compacts, then checks the total.deploy/clconsole/kpi
Postgres 18 with Grafana 13.0.2 (OSS, pinned by digest), a run-to-completion collector container, systemd user timers, and a nightly
pg_dumpkept for 30 days. Every metric is defined as a view incollector/schema.sql. The dashboard JSON is generated bygrafana/build-dashboard.mjs, and a test fails if the committed file drifts from what the generator produces. Install steps are indeploy/clconsole/README.md.Verified locally
pnpm test,pnpm -r typecheck,pnpm lintandbuild-mirror --checkall pass.doc_name, counting rows instead ofseq, and dating active days by the run instead of by last-seen.Changelog
NONE
🤖 Generated with Claude Code
https://claude.ai/code/session_01MY63BZ4UVtMHFcADNr1jFg