Skip to main content

fmetric_dyn

Macro fmetric_dyn 

Source
macro_rules! fmetric_dyn {
    (target: $target:expr, $name:expr, $unit:expr, $($rest:tt)+) => { ... };
    ($name:expr, $unit:expr, $($rest:tt)+) => { ... };
}
Expand description

Records a float metric whose name or unit is only known at run time.

Same as [imetric_dyn!], including the cardinality caveat, for a floating-point value.

use micromegas_tracing::prelude::*;

let (name, unit) = (String::from("http.latency"), "ms");
let elapsed = 12.5;
fmetric_dyn!(target: "my_crate::io", &name, unit, "http.method" = "GET", elapsed);

name and unit are reserved keys, as with fmetric!:

ⓘ
use micromegas_tracing::prelude::*;

fmetric_dyn!("latency", "ms", unit = "s", 1.0);