mirror of https://github.com/fralalonde/dipstick
Merge pull request #86 from RafalGoslawski/expose_metricid
Exposed attributes::MetricId to make extending new outputs possible
This commit is contained in:
commit
f24a285944
|
@ -45,6 +45,6 @@ fn main() {
|
||||||
|
|
||||||
// using a "time handle"
|
// using a "time handle"
|
||||||
let start_time = timer.start();
|
let start_time = timer.start();
|
||||||
Duration::from_millis(5);
|
sleep(Duration::from_millis(5));
|
||||||
timer.stop(start_time);
|
timer.stop(start_time);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//! Use the metrics backend directly to log a metric value.
|
//! Use the metrics backend directly to log a metric value.
|
||||||
//! Applications should use the metrics()-provided instruments instead.
|
//! Applications should use the metrics()-provided instruments instead.
|
||||||
|
|
||||||
use dipstick::{labels, Input, InputScope, Labels};
|
use dipstick::{labels, Input, InputScope};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
raw_write()
|
raw_write()
|
||||||
|
|
|
@ -59,10 +59,12 @@ impl Default for Buffering {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A metrics identifier
|
||||||
#[derive(Clone, Debug, Hash, Eq, PartialOrd, PartialEq)]
|
#[derive(Clone, Debug, Hash, Eq, PartialOrd, PartialEq)]
|
||||||
pub struct MetricId(String);
|
pub struct MetricId(String);
|
||||||
|
|
||||||
impl MetricId {
|
impl MetricId {
|
||||||
|
/// Return a MetricId based on output type and metric name
|
||||||
pub fn forge(out_type: &str, name: MetricName) -> Self {
|
pub fn forge(out_type: &str, name: MetricName) -> Self {
|
||||||
let id: String = name.join("/");
|
let id: String = name.join("/");
|
||||||
MetricId(format!("{}:{}", out_type, id))
|
MetricId(format!("{}:{}", out_type, id))
|
||||||
|
|
|
@ -71,7 +71,8 @@ mod multi;
|
||||||
mod queue;
|
mod queue;
|
||||||
|
|
||||||
pub use crate::attributes::{
|
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::clock::TimeHandle;
|
||||||
pub use crate::input::{
|
pub use crate::input::{
|
||||||
|
|
Loading…
Reference in New Issue