File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,7 @@ def __init__(
149
149
self ._listeners = self ._settings ._pool_options ._event_listeners
150
150
self ._publish = self ._listeners is not None and self ._listeners .enabled_for_server_heartbeat
151
151
self ._cancel_context : Optional [_CancellationContext ] = None
152
+ self ._conn_id : Optional [int ] = None
152
153
self ._rtt_monitor = _RttMonitor (
153
154
topology ,
154
155
topology_settings ,
@@ -243,6 +244,7 @@ async def _check_server(self) -> ServerDescription:
243
244
244
245
Returns a ServerDescription.
245
246
"""
247
+ self ._conn_id = None
246
248
start = time .monotonic ()
247
249
try :
248
250
try :
@@ -272,6 +274,7 @@ async def _check_server(self) -> ServerDescription:
272
274
awaited = awaited ,
273
275
durationMS = duration * 1000 ,
274
276
failure = error ,
277
+ driverConnectionId = self ._conn_id ,
275
278
message = _SDAMStatusMessage .HEARTBEAT_FAIL ,
276
279
)
277
280
await self ._reset_connection ()
@@ -314,6 +317,8 @@ async def _check_once(self) -> ServerDescription:
314
317
)
315
318
316
319
self ._cancel_context = conn .cancel_context
320
+ # Record the connection id so we can later attach it to the failed log message.
321
+ self ._conn_id = conn .id
317
322
response , round_trip_time = await self ._check_with_socket (conn )
318
323
if not response .awaitable :
319
324
self ._rtt_monitor .add_sample (round_trip_time )
Original file line number Diff line number Diff line change @@ -149,6 +149,7 @@ def __init__(
149
149
self ._listeners = self ._settings ._pool_options ._event_listeners
150
150
self ._publish = self ._listeners is not None and self ._listeners .enabled_for_server_heartbeat
151
151
self ._cancel_context : Optional [_CancellationContext ] = None
152
+ self ._conn_id : Optional [int ] = None
152
153
self ._rtt_monitor = _RttMonitor (
153
154
topology ,
154
155
topology_settings ,
@@ -243,6 +244,7 @@ def _check_server(self) -> ServerDescription:
243
244
244
245
Returns a ServerDescription.
245
246
"""
247
+ self ._conn_id = None
246
248
start = time .monotonic ()
247
249
try :
248
250
try :
@@ -272,6 +274,7 @@ def _check_server(self) -> ServerDescription:
272
274
awaited = awaited ,
273
275
durationMS = duration * 1000 ,
274
276
failure = error ,
277
+ driverConnectionId = self ._conn_id ,
275
278
message = _SDAMStatusMessage .HEARTBEAT_FAIL ,
276
279
)
277
280
self ._reset_connection ()
@@ -314,6 +317,8 @@ def _check_once(self) -> ServerDescription:
314
317
)
315
318
316
319
self ._cancel_context = conn .cancel_context
320
+ # Record the connection id so we can later attach it to the failed log message.
321
+ self ._conn_id = conn .id
317
322
response , round_trip_time = self ._check_with_socket (conn )
318
323
if not response .awaitable :
319
324
self ._rtt_monitor .add_sample (round_trip_time )
You can’t perform that action at this time.
0 commit comments