pub struct InvocationMetricsBus { /* private fields */ }Expand description
Broadcast bus that fans an InvocationMetric out to subscribers.
Construct one per PluginSandbox and clone the Arc to pass it
into each SandboxInstance. External code calls subscribe to
get a Receiver for live events.
Implementations§
Source§impl InvocationMetricsBus
impl InvocationMetricsBus
Sourcepub fn new() -> Self
pub fn new() -> Self
Construct a bus with the default channel capacity
([DEFAULT_CHANNEL_CAPACITY]).
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Construct a bus with a custom channel capacity. Larger values tolerate slower subscribers without dropping events; smaller values use less memory per bus.
Sourcepub fn subscribe(&self) -> Receiver<InvocationMetric>
pub fn subscribe(&self) -> Receiver<InvocationMetric>
Subscribe to live metrics. Each subscriber sees every event sent
after the call to subscribe; events emitted before are not
replayed.
Sourcepub fn record(&self, metric: InvocationMetric)
pub fn record(&self, metric: InvocationMetric)
Send a metric. Non-blocking. If the channel is full, the oldest
undelivered event is dropped (broadcast semantics) — that
subscriber gets RecvError::Lagged on the next recv. If
nobody is subscribed, the metric is silently dropped.
Sourcepub fn subscriber_count(&self) -> usize
pub fn subscriber_count(&self) -> usize
Current number of subscribers. Useful for tests and for skipping metric construction when nobody’s listening.
Trait Implementations§
Source§impl Clone for InvocationMetricsBus
impl Clone for InvocationMetricsBus
Source§fn clone(&self) -> InvocationMetricsBus
fn clone(&self) -> InvocationMetricsBus
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InvocationMetricsBus
impl Debug for InvocationMetricsBus
Auto Trait Implementations§
impl Freeze for InvocationMetricsBus
impl RefUnwindSafe for InvocationMetricsBus
impl Send for InvocationMetricsBus
impl Sync for InvocationMetricsBus
impl Unpin for InvocationMetricsBus
impl UnsafeUnpin for InvocationMetricsBus
impl UnwindSafe for InvocationMetricsBus
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> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
self file descriptor. Read moreSource§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