macro_proxy/
macro_proxy.rs1use dipstick::*;
4
5use std::time::Duration;
6
7metrics! {
9 pub ROOT_COUNTER: Counter = "root_counter";
11 pub ROOT_GAUGE: Gauge = "root_gauge";
13 pub ROOT_TIMER: Timer = "root_timer";
15}
16
17metrics!(pub PUB_METRICS = "pub_lib_prefix" => {
19 pub PUB_COUNTER: Counter = "some_counter";
21});
22
23metrics!(pub LIB_METRICS = "mod_lib_prefix" => {
25 pub SOME_COUNTER: Counter = "some_counter";
27});
28
29metrics!(LIB_METRICS => {
31 ANOTHER_COUNTER: Counter = "another_counter";
33});
34
35fn main() {
36 dipstick::Proxy::default_target(Stream::write_to_stdout().metrics());
37
38 loop {
39 ROOT_COUNTER.count(123);
40 ANOTHER_COUNTER.count(456);
41 ROOT_TIMER.interval_us(2000000);
42 ROOT_GAUGE.value(34534);
43 std::thread::sleep(Duration::from_millis(40));
44 }
45}