Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 322f7e8

Browse files
committed
minor fixes
1 parent 2b8a9e4 commit 322f7e8

File tree

3 files changed

+47
-10
lines changed

3 files changed

+47
-10
lines changed

coderd/database/queries.sql.go

Lines changed: 22 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/workspaceagentstats.sql

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,25 @@ WITH agent_stats AS (
133133
WHERE a.rn = 1
134134
GROUP BY a.user_id, a.agent_id, a.workspace_id
135135
)
136-
SELECT users.username, workspace_agents.name AS agent_name, workspaces.name AS workspace_name, workspace_rx_bytes, workspace_tx_bytes, session_count_vscode, session_count_ssh, session_count_jetbrains, session_count_reconnecting_pty, connection_count, connection_median_latency_ms
137-
FROM agent_stats JOIN latest_agent_stats ON agent_stats.agent_id = latest_agent_stats.agent_id
138-
JOIN users ON users.id = agent_stats.user_id
139-
JOIN workspace_agents ON workspace_agents.id = agent_stats.agent_id
140-
JOIN workspaces ON workspaces.id = agent_stats.workspace_id;
136+
SELECT
137+
users.username, workspace_agents.name AS agent_name, workspaces.name AS workspace_name, workspace_rx_bytes, workspace_tx_bytes,
138+
session_count_vscode, session_count_ssh, session_count_jetbrains, session_count_reconnecting_pty,
139+
connection_count, connection_median_latency_ms
140+
FROM
141+
agent_stats
142+
JOIN
143+
latest_agent_stats
144+
ON
145+
agent_stats.agent_id = latest_agent_stats.agent_id
146+
JOIN
147+
users
148+
ON
149+
users.id = agent_stats.user_id
150+
JOIN
151+
workspace_agents
152+
ON
153+
workspace_agents.id = agent_stats.agent_id
154+
JOIN
155+
workspaces
156+
ON
157+
workspaces.id = agent_stats.workspace_id;

coderd/prometheusmetrics/prometheusmetrics.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ func Agents(ctx context.Context, logger slog.Logger, registerer prometheus.Regis
286286
done:
287287
logger.Debug(ctx, "Agent metrics collection is done")
288288
metricsCollectorAgents.Observe(timer.ObserveDuration().Seconds())
289+
290+
ticker.Reset(duration)
289291
}
290292
}()
291293
return cancelFunc, nil
@@ -451,6 +453,7 @@ func AgentStats(ctx context.Context, logger slog.Logger, registerer prometheus.R
451453
metricsCollectorAgentStats.Observe(timer.ObserveDuration().Seconds())
452454

453455
createdAfter = checkpoint
456+
ticker.Reset(duration)
454457
}
455458
}()
456459
return cancelFunc, nil

0 commit comments

Comments
 (0)