pub struct Metrics { /* private fields */ }Expand description
Lock-free counters for BEAM actor sends and drops.
Cheap to clone via Arc<Metrics>. Designed to be passed via
ActorContext (Composition-Root IoC) so any actor can record
metrics without coupling to a global registry.
All counters are cumulative for the lifetime of the Metrics
instance. They never reset — start a new Metrics if you need
per-window observation.
§Counter semantics
dropped_sends: incremented whenAddr::sendreturnsErr(())in a fire-and-forget context. This is the primary “silent drop is no longer invisible” counter.reaped_quorums: incremented when the quorum reaper evicts an expired entry. Indicates that quorum timeouts are happening.put_acks_seen: incremented when a Node receives any Put ack.put_acks_quorum: incremented when a Put ack completes a quorum (the__quorum_met__sentinel fired).
Implementations§
Source§impl Metrics
impl Metrics
Sourcepub fn record_dropped_send(&self)
pub fn record_dropped_send(&self)
Record that a fire-and-forget send was dropped.
Call this when Addr::send(msg) returns Err(()) in a
context where you accept the loss but want to know it happened.
Sourcepub fn record_reaped_quorum(&self)
pub fn record_reaped_quorum(&self)
Record that the quorum reaper evicted an expired entry.
Sourcepub fn record_put_ack(&self)
pub fn record_put_ack(&self)
Record that a Put ack was received.
Sourcepub fn record_quorum_ack(&self)
pub fn record_quorum_ack(&self)
Record that a Put ack completed a quorum.
Sourcepub fn snapshot(&self) -> MetricsSnapshot
pub fn snapshot(&self) -> MetricsSnapshot
Read all counters as a plain struct.
Non-atomic across counters — values may be slightly inconsistent. Acceptable for telemetry; do not use for control flow.