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>
impl<const MAX_NODES: usize, const MAX_EDGES: usize, Writer: TelemetrySink> GraphTelemetry<MAX_NODES, MAX_EDGES, Writer>
Sourcepub const fn new(id: u32, events: bool, writer: Writer) -> Self
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.
Sourcepub fn enable_events(&mut self)
pub fn enable_events(&mut self)
Enable emission of structured telemetry events.
Sourcepub fn disable_events(&mut self)
pub fn disable_events(&mut self)
Disable emission of structured telemetry events.
Sourcepub fn metrics(&self) -> &GraphMetrics<MAX_NODES, MAX_EDGES>
pub fn metrics(&self) -> &GraphMetrics<MAX_NODES, MAX_EDGES>
Access the underlying metrics record.
Sourcepub fn nodes(&self) -> &[NodeMetrics; MAX_NODES]
pub fn nodes(&self) -> &[NodeMetrics; MAX_NODES]
Access the full array of node metrics.
Sourcepub fn edges(&self) -> &[EdgeMetrics; MAX_EDGES]
pub fn edges(&self) -> &[EdgeMetrics; MAX_EDGES]
Access the full array of edge metrics.
Sourcepub fn merge_from<const N2: usize, const E2: usize, W2: TelemetrySink>(
&mut self,
other: &GraphTelemetry<N2, E2, W2>,
)
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>
impl<const N: usize, const E: usize, W: TelemetrySink + Clone> Clone for GraphTelemetry<N, E, W>
Source§impl<const N: usize, const E: usize, W: TelemetrySink> Telemetry for GraphTelemetry<N, E, W>
impl<const N: usize, const E: usize, W: TelemetrySink> Telemetry for GraphTelemetry<N, E, W>
Source§fn events_enabled(&self) -> bool
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.