pub struct SpanGroup { /* private fields */ }Expand description
Represents a set of tracing::Spans for which latency information should be collected as a group. It is the unit of latency information collection.
Span definitions are created in the code using macros and functions from the Rust tracing library which define span callsites, i.e., the places in the code where spans are defined. As the code is executed, a span definition in the code may be executed multiple times – each such execution is a span instance. Span instances arising from the same span definition are grouped into SpanGroups for latency information collection. Latencies are collected using Histograms from the hdrhistogram library.
The grouping of spans for latency collection is not exactly based on the span definitions in the code. Spans at runtime are structured as a set of span trees that correspond to the nesting of spans from code execution paths. The grouping of runtime spans for latency collection should respect the runtime parent-child relationships among spans.
Thus, SpanGroups form a forest of trees where some pairs of span groups have a parent-child relationship, corresponding to the parent-child relationships of the spans associated with the span groups. This means that if SpanGroup A is the parent of SpanGroup B then, for each span that was assigned to group B, its parent span was assigned to group A.
The coarsest-grained grouping of spans is characterized by a callsite path – a callsite and the (possibly empty) list of its ancestor callsites based on the different runtime execution paths (see Span relationships). This is the default SpanGroup definition. Finer-grained groupings of spans can differentiate groups of spans with the same callsite path by taking into account values computed at runtime from the spans’ runtime Attributes.
This struct holds the following information:
- the
nameof the span definition that applies to all the spans in the span group - an
idthat, together with itsname, uniquely identifies the span group - a
propsfield that contains the list of name-value pairs (which may be empty) which is common to all the spans in the group - a
code_linefield that contains the file name and line number where all the spans in the group were defined or, in case debug information is not available, the correspondingtracing::callsite::Identifier. - a
parent_idthat is theidfield of the parent span group, if any. - its
depth, i.e., the number of ancestor span groups this span group has