Expand description
The tap (SRV-011 R2): a sampled, bounded view of live traffic.
A TapSubscription names the traffic it wants with a TapFilter and
holds a BoundedRing of kept messages. The server samples 1 in N per
subscription: N doubles whenever the subscriber’s ring is more than half
full after a push and halves each time the subscriber drains. Every kept
message remembers the N it was kept under, and a drain closes a batch
wherever N changed, so each TapBatch has one divisor that is true of
every message in it. The ring drops its oldest message with a count when
full, so a slow subscriber costs at most capacity messages of memory, and
each batch says how many were lost since the one before.
The hook is Tap::observe, called once at the server’s publish return.
With no subscriber it costs one atomic load.
Re-exports§
pub use error::TapError;pub use message::Hop;pub use message::PayloadGrant;pub use message::PublishFact;pub use message::Reached;pub use message::Recorded;pub use message::TapBatch;pub use message::TapFilter;pub use message::TapIdent;pub use message::TapMessage;pub use message::TapOutcome;pub use message::TapSource;pub use ring::BoundedRing;pub use subscription::DEFAULT_TAP_CAPACITY;pub use subscription::MAX_SAMPLE_ONE_IN;pub use subscription::Tap;pub use subscription::TapSubscription;pub use subscription::TapWaker;
Modules§
- error
- The tap’s failures: a lock another thread poisoned, a station list its two passes disagreed on, and hops that could not be kept as measured.
- message
- What a tap carries: the filter, the grant, the publish it is shown, and the per-message facts it keeps.
- ring
- A bounded queue that drops its oldest entry, with a count, when full.
- subscription
- The tap and its subscriptions.