@@ -61,6 +61,9 @@ func (e exporter) ExportMetrics(ctx context.Context, m *metrics.Metrics) error {
6161
6262 m .RecordEndpointAvailability (e .chainID , e .referenceNode , true )
6363 m .RecordReferenceBlockHeight (e .chainID , e .referenceNode , refHeight )
64+ // Also update time since last block metric when we see new blocks via polling
65+ // This ensures the metric stays accurate even if WebSocket subscription fails
66+ m .UpdateLastBlockTime (e .chainID , time .Now ())
6467 e .logger .Info ().Uint64 ("height" , refHeight ).Str ("endpoint" , e .referenceNode ).Msg ("recorded reference node height" )
6568
6669 // get each full node height and calculate drift
@@ -77,6 +80,10 @@ func (e exporter) ExportMetrics(ctx context.Context, m *metrics.Metrics) error {
7780 m .RecordCurrentBlockHeight (e .chainID , fullNode , currentHeight )
7881 m .RecordBlockHeightDrift (e .chainID , fullNode , refHeight , currentHeight )
7982
83+ // Also update time since last block metric when we see new blocks via polling
84+ // This ensures the metric stays accurate even if WebSocket subscription fails
85+ m .UpdateLastBlockTime (e .chainID , time .Now ())
86+
8087 drift := int64 (refHeight ) - int64 (currentHeight )
8188 e .logger .Info ().
8289 Uint64 ("ref_height" , refHeight ).
0 commit comments