GeezerVison is showing github.com — feat!: report template insights session usage per app by EhabY · Pull Request #29796 · coder/coder
Conversation
EhabY
commented
Sep 23, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
Report template insights session usage per app instead of five fixed family rows. Apps with usage use registry names and icons (VS Code, Cursor, GoLand, Zed, etc.). Rows carry no app family. Template-defined workspace apps retain their existing accounting and report method: workspace_app.
The API adds usage_total_seconds, counting each user's active minutes once. UI bars use that total rather than summed app time, so overlapping apps can add up to more than 100%. Missing icons have a fallback; accounting rows have explanatory tooltips.
Implements the API/UI portion of the Completing Scalable IDE Session Tracking RFC. No migrations or ingestion changes. Prometheus metrics are handled separately in #29906. Targets main; #30497 is merged. Part of CLIENT-642.
Breaking changes
For GET /api/v2/insights/templates (report.apps_usage):
- Built-in rows identify individual reported apps, not families; unused apps are omitted. Display names and icons come from the registry.
type (builtin/app) is replaced by method (connection_log_method values): ssh, reconnecting_pty, or port_forwarding for session apps, workspace_app for template apps. Session methods are derived from the app name until Record the connection method for session app usage #31012 stores them.
- Template apps sharing a slug merge into one row across templates, shown with the newest app's display name and icon. Previously, differing names or icons split them.
- Web Terminal's slug changes from
reconnecting-pty to reconnecting_pty.
- Accounting rows may appear as
unknown or overflow ("Other apps").
- The Go SDK removes the unused
codersdk.UnionByFamily helper.
Consumers relying on the fixed five rows, family slugs, or previous display names must update.
Before/after JSON example
Same usage in both responses: one user is active for 10 minutes, using VS Code for 10 minutes, Cursor for 5 minutes, and Web Terminal for 1 minute. Cursor and Web Terminal overlap with VS Code. These are response excerpts; unchanged report/app metadata and interval reports are omitted.
Before: Cursor is included in the VS Code family total, and unused built-ins are still returned.
{
"report": {
"active_users": 1,
"apps_usage": [
{ "slug": "vscode", "display_name": "Visual Studio Code", "seconds": 900 },
{ "slug": "jetbrains", "display_name": "JetBrains", "seconds": 0 },
{ "slug": "reconnecting-pty", "display_name": "Web Terminal", "seconds": 60 },
{ "slug": "ssh", "display_name": "SSH", "seconds": 0 },
{ "slug": "sftp", "display_name": "SFTP", "seconds": 0 }
]
}
}
After: Each used app has its own row; the active-time total remains 600 seconds despite overlapping app usage.
{
"report": {
"active_users": 1,
"usage_total_seconds": 600,
"apps_usage": [
{ "slug": "cursor", "method": "ssh", "display_name": "Cursor", "seconds": 300 },
{ "slug": "reconnecting_pty", "method": "reconnecting_pty", "display_name": "Web Terminal", "seconds": 60 },
{ "slug": "vscode", "method": "ssh", "display_name": "VS Code", "seconds": 600 }
]
}
}
Response cap
Registered apps with usage and accounting rows are exempt from the response limit. The 64 busiest unregistered names are listed individually; the rest fold into "Other apps". Folded minutes are summed per user and half hour, then capped at that user's active minutes. Because app overlap is not stored, folded overflow sets seconds_is_upper_bound and the UI labels it "Up to". Stored overflow remains exact when no apps fold. The cap shapes only the response, not storage or scans.
Refactoring plan and verification evidence
The approved cleanup preserves behavior and the optimized single-/multi-template aggregation:
- Select excess apps directly with deterministic ordering and consolidate seconds/template-ID response assembly, keeping overflow accounting and the no-fold fast path.
- Use explicit registry, accounting-label, and fallback presentation paths in Go; shorten comments while retaining non-obvious rationale.
- Flatten frontend accounting descriptions and prepare labels before JSX; preserve keys, icons, tooltips, and the active-time denominator.
- Preserve regression coverage and add cap-boundary, filtered-template, normalized-name, and irregular-bucket cases.
- Regenerate affected SQL, SDK, API-reference, and TypeScript outputs.
The final query matched the original PR query in 2,412 deterministic/randomized cases. Database/SDK suites passed 2,846 tests; targeted backend suites passed 46 tests. Frontend utility tests, five Storybook stories, generation, repository lint, and type checks passed.
PostgreSQL 18.6 synthetic benchmarks, seven alternating rounds, median EXPLAIN ANALYZE execution time:
| Workload |
Session rows |
Original PR |
Refactored |
Change |
| Single-template buckets |
522,101 |
551.01 ms |
589.83 ms |
+7.0% |
| Multi-template, no folding |
593,020 |
827.13 ms |
826.98 ms |
~0.0% |
| Multi-template, with folding |
599,070 |
991.80 ms |
982.58 ms |
-0.9% |
Scan counts, buffer hits, and spill sizes did not increase; no-fold overflow scans executed zero times. Timing was noisy: the single-template uninstrumented wall-time median was 522.08 → 518.56 ms. These measurements are query benchmarks, not endpoint latency or a production-performance guarantee.
Generated with Coder Agents on behalf of @EhabY.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Sep 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Been trying it out and it is looking good!
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
code-asher
left a comment
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can think of something to do with type/method (whether here or in a followup) but otherwise looks good to me!
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Remove the family field and AppFamilyWorkspaceApp from TemplateAppUsage,
rename the session and template app variables in
convertTemplateInsightsApps, and simplify the accounting row tooltips.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Labels
release/breaking
This label is applied to PRs to detect breaking changes as part of the release process
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|