namespace ZB.MOM.WW.OtOpcUa.Configuration.Entities;
///
/// Runtime resilience counters the CapabilityInvoker + MemoryTracking + MemoryRecycle
/// surfaces for each (DriverInstanceId, HostName) pair. Separate from
/// (which owns per-host connectivity state) so a
/// host that's Running but has tripped its breaker or is approaching its memory ceiling
/// shows up distinctly on Admin /hosts.
///
///
/// Per docs/v2/implementation/phase-6-1-resilience-and-observability.md §Stream E.1.
/// The Admin UI left-joins this table on DriverHostStatus for display; rows are written
/// by the runtime via a HostedService that samples the tracker at a configurable
/// interval (default 5 s) — writes are non-critical, a missed sample is tolerated.
///
public sealed class DriverInstanceResilienceStatus
{
public required string DriverInstanceId { get; set; }
public required string HostName { get; set; }
/// Most recent time the circuit breaker for this (instance, host) opened; null if never.
public DateTime? LastCircuitBreakerOpenUtc { get; set; }
/// Rolling count of consecutive Polly pipeline failures for this (instance, host).
public int ConsecutiveFailures { get; set; }
/// Current Polly bulkhead depth (in-flight calls) for this (instance, host).
public int CurrentBulkheadDepth { get; set; }
/// Most recent process recycle time (Tier C only; null for in-process tiers).
public DateTime? LastRecycleUtc { get; set; }
///
/// Post-init memory baseline captured by MemoryTracking (median of first
/// BaselineWindow samples). Zero while still warming up.
///
public long BaselineFootprintBytes { get; set; }
/// Most recent footprint sample the tracker saw (steady-state read).
public long CurrentFootprintBytes { get; set; }
/// Row last-write timestamp — advances on every sampling tick.
public DateTime LastSampledUtc { get; set; }
}