2018-06-17 02:59:51 +00:00
|
|
|
//! A sample application asynchronously printing metrics to stdout.
|
|
|
|
|
2019-03-18 01:42:00 +00:00
|
|
|
use dipstick::*;
|
|
|
|
use std::io;
|
2018-06-17 02:59:51 +00:00
|
|
|
use std::thread::sleep;
|
|
|
|
use std::time::Duration;
|
|
|
|
|
|
|
|
fn main() {
|
2019-03-18 01:42:00 +00:00
|
|
|
let metrics = Stream::write_to(io::stdout())
|
|
|
|
.cached(5)
|
|
|
|
.metrics()
|
|
|
|
.named("cache");
|
2018-06-17 02:59:51 +00:00
|
|
|
|
|
|
|
loop {
|
2018-06-19 19:27:26 +00:00
|
|
|
// report some ad-hoc metric values from our "application" loop
|
2018-06-22 19:32:07 +00:00
|
|
|
metrics.counter("blorf").count(1134);
|
|
|
|
metrics.marker("burg").mark();
|
2018-06-17 02:59:51 +00:00
|
|
|
|
2018-06-19 19:27:26 +00:00
|
|
|
sleep(Duration::from_millis(500));
|
2018-06-17 02:59:51 +00:00
|
|
|
}
|
|
|
|
}
|