File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -357,4 +357,9 @@ export const metrics = new Metrics(() => ({
357357 help : 'The number of addresses in PoR request input parameters' ,
358358 labelNames : [ 'feed_id' ] as const ,
359359 } ) ,
360+ wsConnectionFailoverCount : new client . Gauge ( {
361+ name : 'ws_connection_failover_count' ,
362+ help : 'The number of consecutive unresponsive connection detections (no data for WS_SUBSCRIPTION_UNRESPONSIVE_TTL), used to trigger URL failover' ,
363+ labelNames : [ 'transport_name' ] as const ,
364+ } ) ,
360365} ) )
Original file line number Diff line number Diff line change @@ -414,9 +414,13 @@ export class WebSocketTransport<
414414 // to determine minimum TTL of an open connection given no explicit connection errors.
415415 if ( connectionUnresponsive ) {
416416 this . streamHandlerInvocationsWithNoConnection += 1
417- logger . trace (
418- `The connection is unresponsive, incremented streamHandlerIterationsWithNoConnection = ${ this . streamHandlerInvocationsWithNoConnection } ` ,
417+ logger . info (
418+ `The connection is unresponsive (last message ${ timeSinceLastMessage } ms ago) , incremented failover counter to ${ this . streamHandlerInvocationsWithNoConnection } ` ,
419419 )
420+ metrics
421+ . get ( 'wsConnectionFailoverCount' )
422+ . labels ( { transport_name : this . name } )
423+ . set ( this . streamHandlerInvocationsWithNoConnection )
420424 }
421425
422426 // We want to check if the URL we calculate is different from the one currently connected.
@@ -431,10 +435,9 @@ export class WebSocketTransport<
431435 // Check if we should close the current connection
432436 if ( ! connectionClosed && ( urlChanged || connectionUnresponsive ) ) {
433437 if ( urlChanged ) {
438+ logger . info ( 'Websocket URL has changed, closing connection to reconnect...' )
434439 censorLogs ( ( ) =>
435- logger . debug (
436- `Websocket url has changed from ${ this . currentUrl } to ${ urlFromConfig } , closing connection...` ,
437- ) ,
440+ logger . debug ( `Websocket URL changed from ${ this . currentUrl } to ${ urlFromConfig } ` ) ,
438441 )
439442 } else {
440443 censorLogs ( ( ) =>
You can’t perform that action at this time.
0 commit comments