Trait tracing_timing::SpanGroup
source · [−]pub trait SpanGroup {
type Id;
fn group(&self, span: &Attributes<'_>) -> Self::Id;
}
Expand description
Translate attributes from a tracing span into a timing span group.
All spans whose attributes produce the same Id
-typed value when passed through group
share a namespace for the groups produced by EventGroup::group
on their contained events.
This trait is implemented for all functions with the appropriate signature. Note that you may
run into weird lifetime errors from the compiler when using a closure as a SpanGroup
. This is
a known compiler issue. You can work around it by adding a slight type hint to the arguments
passed to the closure as follows (note the : &_
):
use tracing_timing::{Builder, Histogram};
use tracing::span;
let s = Builder::default()
.spans(|_: &span::Attributes| "all spans as one")
.build(|| Histogram::new(3).unwrap());
Associated Types
Required methods
fn group(&self, span: &Attributes<'_>) -> Self::Id
fn group(&self, span: &Attributes<'_>) -> Self::Id
Extract the group for this span’s attributes.