Skip to main content

GraphTelemetry

Struct GraphTelemetry 

Source
pub struct GraphTelemetry<const MAX_NODES: usize, const MAX_EDGES: usize, Sink: TelemetrySink> { /* private fields */ }
Expand description

Fixed size telemetry collector backed by arrays.

This collector stores node and edge metrics in statically sized arrays and forwards structured events to a TelemetrySink. It is suitable for no_std environments where heap allocation is not available.

Implementations§

Source§

impl<const MAX_NODES: usize, const MAX_EDGES: usize, Writer: TelemetrySink> GraphTelemetry<MAX_NODES, MAX_EDGES, Writer>

Source

pub const fn new(id: u32, events: bool, writer: Writer) -> Self

Create a new fixed size collector with the given event writer.

All node and edge metrics are initialized to zero.

Source

pub fn enable_events(&mut self)

Enable emission of structured telemetry events.

Source

pub fn disable_events(&mut self)

Disable emission of structured telemetry events.

Source

pub fn metrics(&self) -> &GraphMetrics<MAX_NODES, MAX_EDGES>

Access the underlying metrics record.

Source

pub fn nodes(&self) -> &[NodeMetrics; MAX_NODES]

Access the full array of node metrics.

Source

pub fn edges(&self) -> &[EdgeMetrics; MAX_EDGES]

Access the full array of edge metrics.

Source

pub fn writer(&self) -> &Writer

Access the underlying event writer.

Source

pub fn merge_from<const N2: usize, const E2: usize, W2: TelemetrySink>( &mut self, other: &GraphTelemetry<N2, E2, W2>, )

Merge metrics from another fixed size collector into this one.

Node metrics are combined by saturating addition and maximum for latency maxima, while edge queue depth uses a last writer wins strategy.

Trait Implementations§

Source§

impl<const N: usize, const E: usize, W: TelemetrySink + Clone> Clone for GraphTelemetry<N, E, W>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<const N: usize, const E: usize, W: TelemetrySink> Telemetry for GraphTelemetry<N, E, W>

Source§

fn events_enabled(&self) -> bool

Return true if this telemetry collector wants structured events.

Runtimes and nodes can use this to avoid constructing TelemetryEvent values when events are disabled, keeping the hot path as cheap as possible.

Source§

const METRICS_ENABLED: bool = true

Compile-time flag indicating whether this telemetry implementation wants metrics (counters, gauges, latencies) at all. Read more
Source§

const EVENTS_STATICALLY_ENABLED: bool = true

Compile-time flag indicating whether this telemetry implementation ever produces structured events. Read more
Source§

fn incr_counter(&mut self, key: TelemetryKey, delta: u64)

Increment a counter metric identified by the given key. Read more
Source§

fn set_gauge(&mut self, key: TelemetryKey, value: u64)

Set a gauge metric identified by the given key. Read more
Source§

fn record_latency_ns(&mut self, key: TelemetryKey, value_ns: u64)

Record a latency sample in nanoseconds for the given key. Read more
Source§

fn push_metrics(&mut self)

Optional: push a snapshot of aggregated metrics to the sink. Read more
Source§

fn push_event(&mut self, event: TelemetryEvent)

Emit a structured telemetry event. Read more
Source§

fn flush(&mut self)

Flush any buffered telemetry data to the underlying sink. Read more

Auto Trait Implementations§

§

impl<const MAX_NODES: usize, const MAX_EDGES: usize, Sink> Freeze for GraphTelemetry<MAX_NODES, MAX_EDGES, Sink>
where Sink: Freeze,

§

impl<const MAX_NODES: usize, const MAX_EDGES: usize, Sink> RefUnwindSafe for GraphTelemetry<MAX_NODES, MAX_EDGES, Sink>
where Sink: RefUnwindSafe,

§

impl<const MAX_NODES: usize, const MAX_EDGES: usize, Sink> Send for GraphTelemetry<MAX_NODES, MAX_EDGES, Sink>
where Sink: Send,

§

impl<const MAX_NODES: usize, const MAX_EDGES: usize, Sink> Sync for GraphTelemetry<MAX_NODES, MAX_EDGES, Sink>
where Sink: Sync,

§

impl<const MAX_NODES: usize, const MAX_EDGES: usize, Sink> Unpin for GraphTelemetry<MAX_NODES, MAX_EDGES, Sink>
where Sink: Unpin,

§

impl<const MAX_NODES: usize, const MAX_EDGES: usize, Sink> UnsafeUnpin for GraphTelemetry<MAX_NODES, MAX_EDGES, Sink>
where Sink: UnsafeUnpin,

§

impl<const MAX_NODES: usize, const MAX_EDGES: usize, Sink> UnwindSafe for GraphTelemetry<MAX_NODES, MAX_EDGES, Sink>
where Sink: UnwindSafe,

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<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, 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> 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.