byteflow/scheduler/mailbox/metrics.rs
1/// Per-mailbox counters (Relaxed atomics would over-synchronize a hot
2/// inbox). Updated only while the mailbox mutex is held — same critical
3/// section as enqueue / park — then copied out for host scrapes.
4#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
5pub struct MailboxStats {
6 pub enqueued: u64,
7 pub dequeued: u64,
8 /// Total refusals under [`super::OverflowPolicy::Reject`], whichever
9 /// bound was hit.
10 pub rejected: u64,
11 /// Subset of [`Self::rejected`] caused by the byte budget rather than
12 /// the hop count. `rejected - rejected_byte_limit` is therefore the
13 /// hop-count share — the two have different remedies, so an operator
14 /// needs to tell them apart.
15 pub rejected_byte_limit: u64,
16 pub dropped_newest: u64,
17 pub dropped_oldest: u64,
18 /// Hops queued **right now** (occupancy, not a counter).
19 pub queued_messages: usize,
20 /// Bytes charged to the queued hops right now. Compare against the
21 /// configured [`super::MailboxBytes`] to see how close an inbox is to
22 /// its budget before it starts refusing.
23 pub queued_bytes: usize,
24}