feat: add coderd_api_websocket_probes_total metric (#25012)

Relates to CODAGT-115

Adds metric `coderd_api_websocket_probes_total`. Every successful
heartbeat for a given path will increment the metric.

Comparing this with `coderd_api_concurrent_websockets` will give an
indication of how many websocket connections are open but in a 'wedged'
state (when heartbeats stopped versus when we closed the connection).
This commit is contained in:
Cian Johnston
2026-06-03 10:46:07 +01:00
committed by GitHub
parent 7703e7a26e
commit 8b058dc949
22 changed files with 596 additions and 171 deletions
+9 -1
View File
@@ -134,6 +134,7 @@ func runWatchChatGitWorkspaceLookupTest(t *testing.T, workspaceErr error, wantSt
Authorizer: &mockAuthorizer{},
Logger: logger,
},
wsWatcher: httpapi.NewWSWatcher(quartz.NewReal(), nil),
}
)
@@ -190,6 +191,7 @@ func TestWatchChatGit(t *testing.T) {
Logger: logger,
DeploymentValues: &codersdk.DeploymentValues{},
},
wsWatcher: httpapi.NewWSWatcher(quartz.NewReal(), nil),
}
)
@@ -264,6 +266,7 @@ func TestWatchChatGit(t *testing.T) {
Logger: logger,
DeploymentValues: &codersdk.DeploymentValues{},
},
wsWatcher: httpapi.NewWSWatcher(quartz.NewReal(), nil),
}
)
@@ -424,6 +427,7 @@ func TestWatchChatGit(t *testing.T) {
Authorizer: &mockAuthorizer{},
Logger: logger,
},
wsWatcher: httpapi.NewWSWatcher(quartz.NewReal(), nil),
}
)
@@ -602,6 +606,7 @@ func TestWatchChatGit(t *testing.T) {
Authorizer: &mockAuthorizer{},
Logger: logger,
},
wsWatcher: httpapi.NewWSWatcher(quartz.NewReal(), nil),
}
)
@@ -773,10 +778,12 @@ func TestWatchAgentContainers(t *testing.T) {
DeploymentValues: &codersdk.DeploymentValues{},
TailnetCoordinator: tailnettest.NewFakeCoordinator(),
},
wsWatcher: httpapi.NewWSWatcher(mClock, nil),
}
)
trap := mClock.Trap().NewTicker("HeartbeatClose")
trap := mClock.Trap().NewTicker("WSWatcher")
defer trap.Close()
var tailnetCoordinator tailnet.Coordinator = mCoordinator
@@ -897,6 +904,7 @@ func TestWatchAgentContainers(t *testing.T) {
DeploymentValues: &codersdk.DeploymentValues{},
TailnetCoordinator: tailnettest.NewFakeCoordinator(),
},
wsWatcher: httpapi.NewWSWatcher(quartz.NewReal(), nil),
}
)