pub struct HealthCheck {Show 15 fields
pub state: EngineState,
pub ready: bool,
pub memory_pressure: f64,
pub backpressure_level: BackpressureLevel,
pub accepting_writes: bool,
pub l1_items: usize,
pub l1_bytes: usize,
pub filter_items: usize,
pub filter_trust: FilterTrust,
pub redis_connected: Option<bool>,
pub redis_latency_ms: Option<u64>,
pub sql_connected: Option<bool>,
pub sql_latency_ms: Option<u64>,
pub wal_pending_items: Option<u64>,
pub healthy: bool,
}Expand description
Comprehensive health status of the sync engine.
This struct provides all the information needed for:
/readyendpoint: Just checkhealthyfield/healthendpoint: Full diagnostics with data sources documented- Metrics dashboards: Memory pressure, cache stats, backend latencies
§Data Sources
Each field documents where its value comes from:
- Live probe: Fresh check performed during
health_check()call - Cached: From internal state, no I/O required
- Derived: Computed from other fields
§Example
let health = engine.health_check().await;
if health.healthy {
// Ready for traffic
} else {
// Log diagnostics
eprintln!("Engine unhealthy: state={:?}, redis={}, sql={}",
health.state, health.redis_connected, health.sql_connected);
}Fields§
§state: EngineStateCurrent engine lifecycle state.
Source: Cached from state_tx watch channel.
ready: boolWhether the engine is in Running state and ready for traffic.
Source: Derived from state == Running.
memory_pressure: f64Current memory pressure ratio (0.0 to 1.0).
Source: Cached from l1_size_bytes / config.l1_max_bytes.
backpressure_level: BackpressureLevelCurrent backpressure level based on thresholds. Source: Derived from memory_pressure vs config thresholds.
accepting_writes: boolWhether the engine is accepting write operations.
Source: Derived from backpressure_level != Critical.
l1_items: usizeNumber of items in L1 cache.
Source: Cached from l1_cache.len().
l1_bytes: usizeTotal bytes in L1 cache.
Source: Cached from l1_size_bytes atomic.
filter_items: usizeNumber of items tracked in L3 cuckoo filter.
Source: Cached from l3_filter.len().
filter_trust: FilterTrustCuckoo filter trust status.
Source: Cached from l3_filter.trust().
redis_connected: Option<bool>Whether Redis (L2) responded to PING.
Source: Live probe - redis::cmd("PING").
None if Redis is not configured.
redis_latency_ms: Option<u64>Redis PING latency in milliseconds.
Source: Live probe - timed PING command.
None if Redis is not configured or PING failed.
sql_connected: Option<bool>Whether SQL (L3) responded to SELECT 1.
Source: Live probe - sqlx::query("SELECT 1").
None if SQL is not configured.
sql_latency_ms: Option<u64>SQL SELECT 1 latency in milliseconds.
Source: Live probe - timed query.
None if SQL is not configured or query failed.
wal_pending_items: Option<u64>Number of items pending in WAL (awaiting drain to SQL).
Source: Cached from l3_wal.stats().pending_items.
None if WAL is not configured.
healthy: boolOverall health verdict for load balancer decisions. Source: Derived from:
state == Runningredis_connected != Some(false)(connected or not configured)sql_connected != Some(false)(connected or not configured)backpressure_level != Critical
Trait Implementations§
Source§impl Clone for HealthCheck
impl Clone for HealthCheck
Source§fn clone(&self) -> HealthCheck
fn clone(&self) -> HealthCheck
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for HealthCheck
impl RefUnwindSafe for HealthCheck
impl Send for HealthCheck
impl Sync for HealthCheck
impl Unpin for HealthCheck
impl UnwindSafe for HealthCheck
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more