feat: add stale connection stats tracking and varz exposure

This commit is contained in:
Joseph Doherty
2026-02-23 00:38:43 -05:00
parent eb25d52ed5
commit cd4ae3cce6
5 changed files with 64 additions and 0 deletions

View File

@@ -682,6 +682,12 @@ public sealed class NatsClient : IDisposable
break;
}
if (reason == ClientClosedReason.StaleConnection)
{
Interlocked.Increment(ref _serverStats.StaleConnections);
Interlocked.Increment(ref _serverStats.StaleConnectionClients);
}
_logger.LogDebug("Client {ClientId} connection closed: {CloseReason}", Id, reason);
}