metrics(alarms): expose provider-switch count in snapshot, bound the reason tag
B1: add AlarmProviderSwitchCount to GatewayMetricsSnapshot so the switch total is readable without scraping the OTEL counter. B2: replace the free-text reason tag on mxgateway.alarms.provider_switches with a bounded AlarmProviderSwitchReason enum (failover/failback/unknown); the human-readable reason stays in the structured log.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
namespace ZB.MOM.WW.MxGateway.Server.Metrics;
|
||||
|
||||
/// <summary>
|
||||
/// Bounded classification of an alarm-provider switch, used as the low-cardinality
|
||||
/// <c>reason</c> tag on the <c>mxgateway.alarms.provider_switches</c> counter. The
|
||||
/// worker supplies a free-text reason (e.g. <c>"primary PollOnce failed"</c>) that
|
||||
/// stays in the structured log; only this bounded value reaches the metric tag so the
|
||||
/// time series cannot fan out on operation-specific text.
|
||||
/// </summary>
|
||||
public enum AlarmProviderSwitchReason
|
||||
{
|
||||
/// <summary>The switch direction could not be classified.</summary>
|
||||
Unknown = 0,
|
||||
|
||||
/// <summary>Switched from the primary (alarmmgr) provider to the subtag standby — degraded.</summary>
|
||||
Failover = 1,
|
||||
|
||||
/// <summary>Switched back from the subtag standby to the primary (alarmmgr) provider — recovered.</summary>
|
||||
Failback = 2,
|
||||
}
|
||||
Reference in New Issue
Block a user