feat: add telemetry for task lifecycle events (#21922)

Relates to https://github.com/coder/internal/issues/1259

Adds new database queries and telemetry collection functions to gather
task lifecycle events (pause/resume cycles, idle time) for analytics.
    
Task events track pause/resume activity, idle duration before pausing,
paused duration, and time from resume to first app status, filtered to
recent activity based on the telemetry snapshot interval.

🤖 Created with Mux (Opus 4.6).
This commit is contained in:
Cian Johnston
2026-02-24 17:04:42 +00:00
committed by GitHub
parent 974ca3eda6
commit 6336fee3a7
11 changed files with 1158 additions and 26 deletions
@@ -87,3 +87,4 @@ SELECT DISTINCT ON (workspace_id)
FROM workspace_app_statuses
WHERE workspace_id = ANY(@ids :: uuid[])
ORDER BY workspace_id, created_at DESC;