Merge pull request #86 from RafalGoslawski/expose_metricid

Exposed attributes::MetricId to make extending new outputs possible
This commit is contained in:
Francis Lalonde 2022-12-16 08:27:07 -05:00 committed by GitHub
commit f24a285944
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 3 deletions

View File

@ -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);
}

View File

@ -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()

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,
Attributes, Buffered, Buffering, MetricId, Observe, ObserveWhen, OnFlush, OnFlushCancel,
Prefixed, Sampled, Sampling, WithAttributes,
};
pub use crate::clock::TimeHandle;
pub use crate::input::{