pub struct PatternGroup { /* private fields */ }
Implementations§
Source§impl PatternGroup
impl PatternGroup
Sourcepub fn new() -> Self
pub fn new() -> Self
Examples found in repository?
examples/basic.rs (line 22)
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}
Sourcepub fn pattern(self, regex: &str, kind: PlotKind) -> Self
pub fn pattern(self, regex: &str, kind: PlotKind) -> Self
Add a pattern to match for plotting
Takes in a regex pattern with a named capture group which will be used to correlate metrics.
§Example
The following will match metrics of the form *_success
and *_error
, and group them
together into plots next to each other.
PatternGroup::new()
.pattern(r"(?<transaction>.*)_success", PlotKind::Rate)
.pattern(r"(?<transaction>.*)_error", PlotKind::Rate)
For instance, foo_success
and foo_error
will be grouped, and bar_success
and
bar_error
will be grouped together.
§Panics
Panics on an invalid Regex
Examples found in repository?
examples/basic.rs (line 23)
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}
Trait Implementations§
Source§impl Debug for PatternGroup
impl Debug for PatternGroup
Auto Trait Implementations§
impl Freeze for PatternGroup
impl RefUnwindSafe for PatternGroup
impl Send for PatternGroup
impl Sync for PatternGroup
impl Unpin for PatternGroup
impl UnwindSafe for PatternGroup
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more