using ZB.MOM.WW.ScadaBridge.AuditLog.Payload;
using ZB.MOM.WW.ScadaBridge.HealthMonitoring;
namespace ZB.MOM.WW.ScadaBridge.AuditLog.Site;
///
/// Bridges
/// (incremented by
/// every time
/// a header / body / SQL parameter redactor stage throws and the redactor has
/// to over-redact the offending field) into
/// so the count surfaces in the site health report payload as
/// SiteHealthReport.AuditRedactionFailure.
///
///
///
/// Registered by ;
/// callers must register AddHealthMonitoring() first so
/// resolves. The default
/// registration keeps for nodes
/// where Site Health Monitoring is not wired (the silent-sink contract —
/// redaction failures must NEVER abort the user-facing action, alog.md §7).
///
///
/// Mirrors the
/// shape one-for-one so the two health-metric bridges age together.
///
///
/// Site-side only: the redaction filter also runs on the central
/// writers (CentralAuditWriter + AuditLogIngestActor); the central
/// health-metric surface exposing AuditRedactionFailure is bridged
/// separately by CentralAuditRedactionFailureCounter, which the
/// central composition root registers in place of the NoOp default.
///
///
public sealed class HealthMetricsAuditRedactionFailureCounter : IAuditRedactionFailureCounter
{
private readonly ISiteHealthCollector _collector;
/// Initializes the counter with the site health collector it bridges into.
/// The site health collector that receives the incremented redaction-failure count.
public HealthMetricsAuditRedactionFailureCounter(ISiteHealthCollector collector)
{
_collector = collector ?? throw new ArgumentNullException(nameof(collector));
}
///
public void Increment() => _collector.IncrementAuditRedactionFailure();
}