Exposed attributes::MetricId

This commit is contained in:
RafalGoslawski 2022-12-15 17:18:49 +00:00
parent e7a00d9cf3
commit a29991a938
No known key found for this signature in database
2 changed files with 4 additions and 1 deletions

View File

@ -59,10 +59,12 @@ impl Default for Buffering {
}
}
/// A metrics identifier
#[derive(Clone, Debug, Hash, Eq, PartialOrd, PartialEq)]
pub struct MetricId(String);
impl MetricId {
/// Return a MetricId based on output type and metric name
pub fn forge(out_type: &str, name: MetricName) -> Self {
let id: String = name.join("/");
MetricId(format!("{}:{}", out_type, id))

View File

@ -71,7 +71,8 @@ mod multi;
mod queue;
pub use crate::attributes::{
Buffered, Buffering, Observe, ObserveWhen, OnFlush, OnFlushCancel, Prefixed, Sampled, Sampling,
Buffered, Buffering, MetricId, Observe, ObserveWhen, OnFlush, OnFlushCancel, Prefixed, Sampled,
Sampling,
};
pub use crate::clock::TimeHandle;
pub use crate::input::{