@@ -22,17 +22,17 @@ GROUP BY workspace_agent_stats.user_id, users.username, users.avatar_url
22
22
ORDER BY user_id ASC ;
23
23
24
24
-- name: GetTemplateInsights :one
25
- -- GetTemplateInsights has a granularity of 5 minutes where if a session/app was
26
- -- in use during a minute, we will add 5 minutes to the total usage for that
25
+ -- GetTemplateInsights has a granularity of 1 minute where if a session/app was
26
+ -- in use during a minute, we will add 1 minute to the total usage for that
27
27
-- session/app (per user).
28
28
WITH ts AS (
29
29
SELECT
30
30
d::timestamptz AS from_,
31
- (d::timestamptz + ' 5 minute' ::interval) AS to_,
32
- EXTRACT(epoch FROM ' 5 minute' ::interval) AS seconds
31
+ (d::timestamptz + ' 1 minute' ::interval) AS to_,
32
+ EXTRACT(epoch FROM ' 1 minute' ::interval) AS seconds
33
33
FROM
34
34
-- Subtract 1 second from end_time to avoid including the next interval in the results.
35
- generate_series(@start_time::timestamptz , (@end_time::timestamptz ) - ' 1 second' ::interval, ' 5 minute' ::interval) d
35
+ generate_series(@start_time::timestamptz , (@end_time::timestamptz ) - ' 1 second' ::interval, ' 1 minute' ::interval) d
36
36
), agent_stats_by_interval_and_user AS (
37
37
SELECT
38
38
ts .from_ ,
@@ -79,11 +79,11 @@ FROM agent_stats_by_interval_and_user;
79
79
WITH ts AS (
80
80
SELECT
81
81
d::timestamptz AS from_,
82
- (d::timestamptz + ' 5 minute' ::interval) AS to_,
83
- EXTRACT(epoch FROM ' 5 minute' ::interval) AS seconds
82
+ (d::timestamptz + ' 1 minute' ::interval) AS to_,
83
+ EXTRACT(epoch FROM ' 1 minute' ::interval) AS seconds
84
84
FROM
85
85
-- Subtract 1 second from end_time to avoid including the next interval in the results.
86
- generate_series(@start_time::timestamptz , (@end_time::timestamptz ) - ' 1 second' ::interval, ' 5 minute' ::interval) d
86
+ generate_series(@start_time::timestamptz , (@end_time::timestamptz ) - ' 1 second' ::interval, ' 1 minute' ::interval) d
87
87
), app_stats_by_user_and_agent AS (
88
88
SELECT
89
89
ts .from_ ,
0 commit comments