mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
chore: refactor agent stats streaming (#5112)
This commit is contained in:
@ -16,16 +16,17 @@ VALUES
|
||||
SELECT * FROM agent_stats WHERE agent_id = $1 ORDER BY created_at DESC LIMIT 1;
|
||||
|
||||
-- name: GetTemplateDAUs :many
|
||||
select
|
||||
SELECT
|
||||
(created_at at TIME ZONE 'UTC')::date as date,
|
||||
user_id
|
||||
from
|
||||
FROM
|
||||
agent_stats
|
||||
where template_id = $1
|
||||
group by
|
||||
WHERE
|
||||
template_id = $1
|
||||
GROUP BY
|
||||
date, user_id
|
||||
order by
|
||||
date asc;
|
||||
ORDER BY
|
||||
date ASC;
|
||||
|
||||
-- name: DeleteOldAgentStats :exec
|
||||
DELETE FROM AGENT_STATS WHERE created_at < now() - interval '30 days';
|
||||
DELETE FROM agent_stats WHERE created_at < NOW() - INTERVAL '30 days';
|
||||
|
Reference in New Issue
Block a user