feat: add connection_errors_total metric tracking

Added recordConnectionError() function and integrated it into socket.ts
to track connection errors by type:
- connection_closed
- connection_lost
- connection_replaced
- timed_out
- logged_out
- bad_session
- restart_required
- multidevice_mismatch
- error_{code} for other status codes
This commit is contained in:
Claude
2026-01-22 13:43:31 +00:00
parent 6412286c73
commit 8d0c03cc2a
2 changed files with 48 additions and 0 deletions
+12
View File
@@ -1922,6 +1922,18 @@ export function recordBufferOverflow(): void {
}
}
/**
* Record a connection error
* Used by socket.ts when connection fails
*/
export function recordConnectionError(errorType: string): void {
try {
metrics.connectionErrors?.inc({ error_type: errorType })
} catch {
// Metrics not initialized, ignore silently
}
}
// ============================================
// Global Instance
// ============================================