feat: add stale connection stats tracking and varz exposure
This commit is contained in:
@@ -75,6 +75,27 @@ public class ServerStatsTests : IAsyncLifetime
|
||||
client.StartTime.ShouldNotBe(default);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void StaleConnection_stats_incremented_on_mark_closed()
|
||||
{
|
||||
var stats = new ServerStats();
|
||||
stats.StaleConnectionClients.ShouldBe(0);
|
||||
|
||||
Interlocked.Increment(ref stats.StaleConnectionClients);
|
||||
stats.StaleConnectionClients.ShouldBe(1);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void StaleConnection_stats_all_fields_default_to_zero()
|
||||
{
|
||||
var stats = new ServerStats();
|
||||
stats.StaleConnections.ShouldBe(0);
|
||||
stats.StaleConnectionClients.ShouldBe(0);
|
||||
stats.StaleConnectionRoutes.ShouldBe(0);
|
||||
stats.StaleConnectionLeafs.ShouldBe(0);
|
||||
stats.StaleConnectionGateways.ShouldBe(0);
|
||||
}
|
||||
|
||||
private static int GetFreePort()
|
||||
{
|
||||
using var sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
|
||||
Reference in New Issue
Block a user