1use metrics::counter;
2use metrics_exporter_plotly::{PatternGroup, PlotKind, PlotlyRecorderBuilder};
3
4#[tokio::main]
5async fn main() {
6 let handle = PlotlyRecorderBuilder::new().install().unwrap();
7
8 let h = tokio::spawn(async {
9 for _ in 0..200 {
10 counter!("something_success").increment(1);
11 counter!("something_error").increment(1);
12
13 counter!("foo_asdf_success").increment(2);
14 counter!("foo_asdf_error").increment(2);
15 tokio::time::sleep(std::time::Duration::from_millis(10)).await;
16 }
17 });
18
19 h.await;
20
21 handle
22 .plot(&[PatternGroup::new()
23 .pattern(r"(?<transaction>.*)_success", PlotKind::Rate)
24 .pattern(r"(?<transaction>.*)_error", PlotKind::Rate)])
25 .await;
26}