Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Normalize workspace agent session counts into a child table #27410

Copy link
Copy link

Description

@EhabY
Issue body actions

Phase 1 of the Scalable Approach for Adding New IDE Session Types RFC. Adding an IDE session type (Cursor, Windsurf, ...) currently requires changing 15+ files across migrations, proto, server, SDK, and UI.

Replace the fixed session_count_* columns on the ephemeral workspace_agent_stats table with a normalized child table keyed by app name, and report session counts from the agent as a dynamic proto map, so new IDEs flow end-to-end with zero schema, proto, or server changes.

Scope

  • New workspace_agent_session_counts (workspace_agent_stats_id, app_name, count) child table with ON DELETE CASCADE; clean-cut migration copies the ~1 day ephemeral buffer, drops the four columns, and trims the insights covering index
  • Proto Stats.session_counts map (field 13, Agent API v2.11); fields 8–11 stay deprecated and the server converts them, so old agents keep reporting without changes
  • Agent: dynamic per-app counters; extractMagicSessionType normalizes instead of classifying against a fixed set; JetBrains process detection and SSH metric labels grouped by family
  • New coderd/idemetadata leaf package: Normalize() (strip null bytes, truncate to 64 runes, lowercase, fold - to _ so reconnecting-pty stays canonical as reconnecting_pty, empty becomes unknown) plus the family map used for grouping
  • Bounded input: a stats report is capped at 64 distinct normalized names, overflow summed into unknown; workspace usage API and coder ssh --usage-app accept arbitrary app names
  • Read paths: latest-row queries aggregate the child table via LEFT JOIN LATERAL; rollup and template insights use plain hash joins (benchmarks in the PR description)
  • External surfaces stay byte-identical: deployment stats API, Prometheus gauge names, and telemetry snapshots are unchanged until phase 2 (Expose per-app session counts in deployment stats, Prometheus, and the UI #27411)

Done when

All phases

  1. This issue (in review: feat: normalize workspace agent session counts into a child table #27179)
  2. Expose per-app session counts in deployment stats, Prometheus, and the UI #27411 — expose per-app counts in deployment stats, Prometheus, UI
  3. Migrate connection_logs.type from ENUM to TEXT #27412connection_logs.type ENUM → TEXT
  4. Merge template_usage_stats *_mins into app_usage_mins JSONB #27413template_usage_stats *_minsapp_usage_mins JSONB
  5. Report the actual IDE (Cursor, Windsurf, ...) for session tracking vscode-coder#1044 — report the actual IDE from the extension (and Send the specific JetBrains IDE name for session tracking jetbrains-coder#599 for JetBrains)

🤖 Created by Coder Agents on behalf of @EhabY.

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

Morty Proxy This is a proxified and sanitized view of the page, visit original site.