Skip to content

Commit 5beb69b

Browse files
authored
add websocket connection attempt metric (#380)
1 parent 945c7bb commit 5beb69b

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/metrics/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,10 @@ export const metrics = new Metrics(() => ({
304304
help: 'The number of cache warmers running',
305305
labelNames: ['isBatched'] as const,
306306
}),
307+
wsConnectionAttempt: new client.Counter({
308+
name: 'ws_connection_attempt',
309+
help: 'The number of open connection attempts',
310+
}),
307311
wsConnectionActive: new client.Gauge({
308312
name: 'ws_connection_active',
309313
help: 'The number of active connections',

src/transports/websocket.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ export class WebSocketTransport<
244244
)
245245

246246
// Attempt to establish the connection
247+
metrics.get('wsConnectionAttempt').inc()
247248
try {
248249
await timeoutPromise(
249250
'WS Open Handler',

0 commit comments

Comments
 (0)