Skip to content

Commit f752c6f

Browse files
committed
Rx Tx bytes
1 parent 0d37c85 commit f752c6f

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

coderd/database/dbfake/databasefake.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4031,8 +4031,8 @@ func (q *fakeQuerier) GetWorkspaceAgentStatsAndLabels(ctx context.Context, creat
40314031
// Tx, Rx metrics
40324032
for _, agentStat := range agentStatsCreatedAfter {
40334033
stat := statByAgent[agentStat.AgentID]
4034-
stat.WorkspaceRxBytes += agentStat.RxBytes
4035-
stat.WorkspaceTxBytes += agentStat.TxBytes
4034+
stat.RxBytes += agentStat.RxBytes
4035+
stat.TxBytes += agentStat.TxBytes
40364036
statByAgent[agentStat.AgentID] = stat
40374037
}
40384038

coderd/database/queries.sql.go

Lines changed: 7 additions & 7 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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ WITH agent_stats AS (
110110
user_id,
111111
agent_id,
112112
workspace_id,
113-
coalesce(SUM(rx_bytes), 0)::bigint AS workspace_rx_bytes,
114-
coalesce(SUM(tx_bytes), 0)::bigint AS workspace_tx_bytes
113+
coalesce(SUM(rx_bytes), 0)::bigint AS rx_bytes,
114+
coalesce(SUM(tx_bytes), 0)::bigint AS tx_bytes
115115
FROM workspace_agent_stats
116116
WHERE workspace_agent_stats.created_at > $1
117117
GROUP BY user_id, agent_id, workspace_id
@@ -134,7 +134,7 @@ WITH agent_stats AS (
134134
GROUP BY a.user_id, a.agent_id, a.workspace_id
135135
)
136136
SELECT
137-
users.username, workspace_agents.name AS agent_name, workspaces.name AS workspace_name, workspace_rx_bytes, workspace_tx_bytes,
137+
users.username, workspace_agents.name AS agent_name, workspaces.name AS workspace_name, rx_bytes, tx_bytes,
138138
session_count_vscode, session_count_ssh, session_count_jetbrains, session_count_reconnecting_pty,
139139
connection_count, connection_median_latency_ms
140140
FROM

coderd/prometheusmetrics/prometheusmetrics.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,8 @@ func AgentStats(ctx context.Context, logger slog.Logger, registerer prometheus.R
419419
logger.Error(ctx, "can't get agent stats", slog.Error(err))
420420
} else {
421421
for _, agentStat := range stats {
422-
agentStatsRxBytesGauge.WithLabelValues(VectorOperationAdd, float64(agentStat.WorkspaceRxBytes), agentStat.AgentName, agentStat.Username, agentStat.WorkspaceName)
423-
agentStatsTxBytesGauge.WithLabelValues(VectorOperationAdd, float64(agentStat.WorkspaceTxBytes), agentStat.AgentName, agentStat.Username, agentStat.WorkspaceName)
422+
agentStatsRxBytesGauge.WithLabelValues(VectorOperationAdd, float64(agentStat.RxBytes), agentStat.AgentName, agentStat.Username, agentStat.WorkspaceName)
423+
agentStatsTxBytesGauge.WithLabelValues(VectorOperationAdd, float64(agentStat.TxBytes), agentStat.AgentName, agentStat.Username, agentStat.WorkspaceName)
424424

425425
agentStatsConnectionCountGauge.WithLabelValues(VectorOperationSet, float64(agentStat.ConnectionCount), agentStat.AgentName, agentStat.Username, agentStat.WorkspaceName)
426426
agentStatsConnectionMedianLatencyGauge.WithLabelValues(VectorOperationSet, agentStat.ConnectionMedianLatencyMS/1000.0 /* (to seconds) */, agentStat.AgentName, agentStat.Username, agentStat.WorkspaceName)

docs/cli/server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ The bind address to serve prometheus metrics.
563563
| Environment | <code>$CODER_PROMETHEUS_COLLECT_AGENT_STATS</code> |
564564
| YAML | <code>introspection.prometheus.collect_agent_stats</code> |
565565

566-
Collect agent stats (may increase charges for metrics storage) .
566+
Collect agent stats (may increase charges for metrics storage).
567567

568568
### --prometheus-enable
569569

0 commit comments

Comments
 (0)