mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
fix: introduce dedicated queries for workspaces and workspace agents metrics (#19786)
aid in differentiation between sources of calls to `GetWorkspaces` but introducing new queries for metrics specific use cases --------- Signed-off-by: Callum Styan <callumstyan@gmail.com>
This commit is contained in:
@@ -983,3 +983,23 @@ WHERE
|
||||
AND fsb.initiator_id != 'c42fdf75-3097-471c-8c33-fb52454d81c0'::uuid
|
||||
GROUP BY t.name, COALESCE(tvp.name, ''), o.name
|
||||
ORDER BY t.name, preset_name, o.name;
|
||||
|
||||
-- name: GetWorkspacesForWorkspaceMetrics :many
|
||||
SELECT
|
||||
u.username as owner_username,
|
||||
t.name as template_name,
|
||||
tv.name as template_version_name,
|
||||
pj.job_status as latest_build_status,
|
||||
wb.transition as latest_build_transition
|
||||
FROM workspaces w
|
||||
JOIN users u ON w.owner_id = u.id
|
||||
JOIN templates t ON w.template_id = t.id
|
||||
JOIN workspace_builds wb ON w.id = wb.workspace_id
|
||||
JOIN provisioner_jobs pj ON wb.job_id = pj.id
|
||||
LEFT JOIN template_versions tv ON wb.template_version_id = tv.id
|
||||
WHERE w.deleted = false
|
||||
AND wb.build_number = (
|
||||
SELECT MAX(wb2.build_number)
|
||||
FROM workspace_builds wb2
|
||||
WHERE wb2.workspace_id = w.id
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user