diff --git a/examples/basics.rs b/examples/basics.rs index 46b9244..2d32753 100644 --- a/examples/basics.rs +++ b/examples/basics.rs @@ -45,6 +45,6 @@ fn main() { // using a "time handle" let start_time = timer.start(); - Duration::from_millis(5); + sleep(Duration::from_millis(5)); timer.stop(start_time); } diff --git a/examples/raw_log.rs b/examples/raw_log.rs index 8d9a046..537c96a 100755 --- a/examples/raw_log.rs +++ b/examples/raw_log.rs @@ -1,7 +1,7 @@ //! Use the metrics backend directly to log a metric value. //! Applications should use the metrics()-provided instruments instead. -use dipstick::{labels, Input, InputScope, Labels}; +use dipstick::{labels, Input, InputScope}; fn main() { raw_write() diff --git a/src/attributes.rs b/src/attributes.rs index 7bd8139..ec75554 100755 --- a/src/attributes.rs +++ b/src/attributes.rs @@ -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)) diff --git a/src/lib.rs b/src/lib.rs index a80a831..bf91125 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -71,7 +71,8 @@ mod multi; mod queue; pub use crate::attributes::{ - Buffered, Buffering, Observe, ObserveWhen, OnFlush, OnFlushCancel, Prefixed, Sampled, Sampling, + Attributes, Buffered, Buffering, MetricId, Observe, ObserveWhen, OnFlush, OnFlushCancel, + Prefixed, Sampled, Sampling, WithAttributes, }; pub use crate::clock::TimeHandle; pub use crate::input::{