D1: surface AlarmProviderSwitchCount on dashboard metric list
This commit is contained in:
@@ -195,6 +195,7 @@ public sealed class DashboardSnapshotService : IDashboardSnapshotService
|
||||
new("mxgateway.workers.exited", snapshot.WorkerExits),
|
||||
new("mxgateway.heartbeats.failed", snapshot.HeartbeatFailures),
|
||||
new("mxgateway.grpc.streams.disconnected", snapshot.StreamDisconnects),
|
||||
new("mxgateway.alarms.provider_switches", snapshot.AlarmProviderSwitchCount),
|
||||
];
|
||||
|
||||
metrics.AddRange(snapshot.CommandFailuresByMethod
|
||||
|
||||
@@ -94,6 +94,24 @@ public sealed class DashboardSnapshotServiceTests
|
||||
Assert.Equal("worker pipe disconnected", fault.Message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies snapshot metrics include the cumulative alarm provider switch count.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void GetSnapshot_IncludesAlarmProviderSwitchCountMetric()
|
||||
{
|
||||
SessionRegistry registry = new();
|
||||
using GatewayMetrics metrics = new();
|
||||
metrics.AlarmProviderSwitched(1, 2, AlarmProviderSwitchReason.Failover);
|
||||
DashboardSnapshotService service = CreateService(registry, metrics);
|
||||
|
||||
DashboardSnapshot snapshot = service.GetSnapshot();
|
||||
|
||||
Assert.Contains(
|
||||
snapshot.Metrics,
|
||||
metric => metric.Name == "mxgateway.alarms.provider_switches" && metric.Value == 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies snapshot redacts sensitive values from client identity, session name, and fault messages.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user