Report template insights session usage per app instead of five fixed
family rows, with registry names and icons.
- Add per-app rows for reported session apps (VS Code, Cursor, GoLand,
Zed, etc.); unused apps are omitted
- Replace `type` (`builtin`/`app`) with `method` (`ssh`,
`reconnecting_pty`, `port_forwarding`, `workspace_app`); session
methods are derived from the app name until #31012 stores them
- Add `usage_total_seconds` to count each user's active minutes once,
and use it as the UI bar denominator so overlapping apps can exceed
100%
- Merge template apps sharing a slug into one row across templates,
using the newest display name and icon
- Rename Web Terminal slug from `reconnecting-pty` to
`reconnecting_pty`
- Cap the response at the 64 busiest unregistered apps and fold the
rest into "Other apps", flagged with `seconds_is_upper_bound`
("Up to" in the UI)
- Add `unknown` and `overflow` accounting rows with explanatory
tooltips, and a fallback icon for apps without one
- Remove the unused `codersdk.UnionByFamily` helper from the Go SDK
BREAKING CHANGE: `report.apps_usage` in `GET /api/v2/insights/templates`
no longer returns the fixed five rows, family slugs, or previous display
names. Consumers must update.
Part of CLIENT-642
Prometheus metrics handled separately in #29906
Closes#20399
To summarize the original commit messages:
- Do not log stats to the database.
- Return errors on the insight endpoints.
- Update the frontend to show those errors.
- Also fixes an issue with getting the user status count via codersdk,
since I added a test to ensure it was not disabled by this flag and it
was sending the wrong payload.
This PR updates the tests in `insights_test.go` to enable commented-out scenarios. This behavior was fixed by previous PRs in this stack. Note that the updated golden files are correct since they are "second template only" meaning that the newly introduced data is considered as expected. In other golden files there is no change since "only count once" is applied.