1
1
-- name: GetUserLatencyInsights :many
2
+ -- GetUserLatencyInsights returns the median and 95th percentile connection
3
+ -- latency that users have experienced. The result can be filtered on
4
+ -- template_ids, meaning only user data from workspaces based on those templates
5
+ -- will be included.
2
6
SELECT
3
7
workspace_agent_stats .user_id ,
4
8
users .username ,
@@ -17,7 +21,7 @@ GROUP BY workspace_agent_stats.user_id, users.username
17
21
ORDER BY user_id ASC ;
18
22
19
23
-- name: GetTemplateInsights :one
20
- -- GetTemplateInsights has a garnularity of 5 minutes where if a session/app was
24
+ -- GetTemplateInsights has a granularity of 5 minutes where if a session/app was
21
25
-- in use, we will add 5 minutes to the total usage for that session (per user).
22
26
WITH d AS (
23
27
SELECT generate_series(@start_time::timestamptz , @end_time::timestamptz , ' 5 minute' ::interval) AS d
@@ -61,6 +65,10 @@ SELECT
61
65
FROM usage_by_user;
62
66
63
67
-- name: GetTemplateDailyInsights :many
68
+ -- GetTemplateDailyInsights returns all daily intervals between start and end
69
+ -- time, if end time is a partial day, it will be included in the results and
70
+ -- that interval will be less than 24 hours. If there is no data for a selected
71
+ -- interval/template, it will be included in the results with 0 active users.
64
72
WITH d AS (
65
73
-- sqlc workaround, use SELECT generate_series instead of SELECT * FROM generate_series.
66
74
SELECT generate_series(@start_time::timestamptz , @end_time::timestamptz , ' 1 day' ::interval) AS d
0 commit comments