pub struct KernelMetrics {
pub kernel_id: String,
pub domain: String,
pub messages_total: AtomicU64,
pub messages_success: AtomicU64,
pub messages_failed: AtomicU64,
pub processing_time_ns: AtomicU64,
pub queue_depth: AtomicU64,
}Expand description
Kernel-specific metrics
Fields§
§kernel_id: StringKernel ID
domain: StringDomain
messages_total: AtomicU64Total messages processed
messages_success: AtomicU64Successful messages
messages_failed: AtomicU64Failed messages
processing_time_ns: AtomicU64Total processing time in nanoseconds
queue_depth: AtomicU64Current queue depth
Implementations§
Source§impl KernelMetrics
impl KernelMetrics
Sourcepub fn new(kernel_id: impl Into<String>, domain: impl Into<String>) -> Self
pub fn new(kernel_id: impl Into<String>, domain: impl Into<String>) -> Self
Create new metrics for a kernel
Sourcepub fn record_execution(&self, latency: Duration, success: bool)
pub fn record_execution(&self, latency: Duration, success: bool)
Record a message execution
Sourcepub fn set_queue_depth(&self, depth: u64)
pub fn set_queue_depth(&self, depth: u64)
Update queue depth
Sourcepub fn avg_latency_us(&self) -> f64
pub fn avg_latency_us(&self) -> f64
Get average latency in microseconds
Sourcepub fn success_rate(&self) -> f64
pub fn success_rate(&self) -> f64
Get success rate (0.0 - 1.0)
Sourcepub fn throughput(&self, duration: Duration) -> f64
pub fn throughput(&self, duration: Duration) -> f64
Get throughput (messages per second) over a given duration
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for KernelMetrics
impl RefUnwindSafe for KernelMetrics
impl Send for KernelMetrics
impl Sync for KernelMetrics
impl Unpin for KernelMetrics
impl UnwindSafe for KernelMetrics
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Mutably borrows from an owned value. Read more
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.