Skip to main content

NodeMetrics

Struct NodeMetrics 

Source
pub struct NodeMetrics {
Show 23 fields pub name: String, pub status: NodeStatus, pub vram_gb: f32, pub total_vram_gb: f32, pub system_memory_gb: f32, pub compute_capability: String, pub gpu_name: Option<String>, pub ip_address: Option<SocketAddr>, pub last_heartbeat: Instant, pub heartbeat_timeout: Duration, pub avg_latency_us: f32, pub min_latency_us: f32, pub max_latency_us: f32, pub latency_samples: u64, pub delivery_ratio: f32, pub throughput_gbps: f32, pub latency_history_us: VecDeque<f32>, pub throughput_history_gbps: VecDeque<f32>, pub used_vram_gb: f32, pub available_vram_gb: f32, pub streaming_layers: Option<(usize, usize)>, pub af_xdp_gbps: f32, pub latency_micros: f32, /* private fields */
}
Expand description

Metrics for a single node

Fields§

§name: String

Node display name

§status: NodeStatus

Current status

§vram_gb: f32

Total VRAM in GB

§total_vram_gb: f32

Total VRAM (alias for vram_gb, used by display/balancer)

§system_memory_gb: f32

System memory in GB

§compute_capability: String

Compute capability

§gpu_name: Option<String>

GPU name/model

§ip_address: Option<SocketAddr>

Resolved IP address of the node

§last_heartbeat: Instant

Last heartbeat time

§heartbeat_timeout: Duration

Heartbeat interval threshold

§avg_latency_us: f32

Average latency in microseconds

§min_latency_us: f32

Minimum observed latency

§max_latency_us: f32

Maximum observed latency

§latency_samples: u64

Number of latency samples

§delivery_ratio: f32

Delivery ratio (0.0 to 1.0)

§throughput_gbps: f32

Throughput in GB/s

§latency_history_us: VecDeque<f32>

Recent latency history in microseconds

§throughput_history_gbps: VecDeque<f32>

Recent throughput history in GB/s

§used_vram_gb: f32

Current used VRAM in GB

§available_vram_gb: f32

Available VRAM in GB

§streaming_layers: Option<(usize, usize)>

Number of layers streaming on this node

§af_xdp_gbps: f32

AF_XDP throughput in Gbps (for display)

§latency_micros: f32

Per-packet latency in microseconds (for display)

Implementations§

Source§

impl NodeMetrics

Source

pub fn new( vram_gb: f32, system_memory_gb: f32, compute_capability: String, heartbeat_timeout: Duration, ) -> Self

Create new metrics for a node

Source

pub fn record_latency(&mut self, latency_us: f32)

Update metrics with new latency sample (EMA with alpha=0.1)

Source

pub fn record_delivery_ratio(&mut self, ratio: f32)

Update metrics with new delivery ratio sample

Source

pub fn record_throughput(&mut self, throughput_gbps: f32)

Update metrics with new throughput sample

Source

pub fn record_vram_usage(&mut self, used_vram_gb: f32)

Update used VRAM

Source

pub fn set_streaming_layers(&mut self, start: usize, end: usize)

Set streaming layers

Source

pub fn clear_streaming_layers(&mut self)

Clear streaming layers

Trait Implementations§

Source§

impl Clone for NodeMetrics

Source§

fn clone(&self) -> NodeMetrics

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NodeMetrics

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for NodeMetrics

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more