Skip to main content

Module entity_set_stats

Module entity_set_stats 

Source
Expand description

Periodic-summary entity-SET/DEL instrumentation.

Replaces the per-set/del tracing::debug!("[entity] SET|DEL {} id={}", ...) lines in [ServerContext], which fire tens of thousands of times per second under pulse-heavy workloads (e.g. comp-engine field/cap presence pulses) and dominate log I/O.

The hot path increments a per-entity-type atomic counter (SET and DEL kept separate) via a DashMap entry lookup; a single dedicated thread emits one summary log line every WINDOW_MS. Quiet windows emit nothing.

Mirrors the super::report_cache_stats pattern. To silence even the summary, set RUST_LOG=myko::server::entity_set_stats=off.

Functions§

record_del
Record a single entity DEL for entity_type. Counted separately from SET so the summary distinguishes churn from removal.
record_set
Record a single entity SET for entity_type. Cheap: one DashMap lookup plus a relaxed atomic increment.
start_periodic_logger
Spawn the summary thread. Idempotent.