Macro record_latency

Source
macro_rules! record_latency {
    ($collector:expr, $name:expr, $latency_ns:expr) => { ... };
}
Expand description

Records a latency measurement metric

This macro records the latency of an operation in nanoseconds. It’s optimized for high-frequency measurements with minimal overhead.

§Arguments

  • $collector - The MetricCollector instance to record to
  • $name - The metric name as a string or string slice
  • $latency_ns - The latency value in nanoseconds as a u64

§Example

let start = TimingUpkeep::now_ns();
// ... perform operation ...
let latency = TimingUpkeep::now_ns() - start;
record_latency!(collector, "order_processing", latency);