Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrettyPrintTrace ¶
PrettyPrintTrace pretty prints a Trace.
Types ¶
type SpanTree ¶
SpanTree is the tree of Spans representation of a Trace.
func GetTraceTree ¶
GetTraceTree converts a set slice of spans into a SpanTree.
func (SpanTree) ToTestSpanTree ¶
func (t SpanTree) ToTestSpanTree() TestSpanTree
type TestSpanTree ¶
type TestSpanTree struct { Note string `json:"a_Note,omitempty"` Root bool `json:"b_Root,omitempty"` Kind model.Kind `json:"c_Kind,omitempty"` LocalEndpointServiceName string `json:"d_Name,omitempty"` Tags map[string]string `json:"e_Tags,omitempty"` Children []TestSpanTree `json:"z_Children,omitempty"` }
TestSpanTree is the expected version of SpanTree used for assertions in testing.
The JSON names of the fields are weird because we want a specific order when pretty printing JSON. The JSON will be printed in alphabetical order, so we are imposing a certain order by prefixing the keys with a specific letter. The letter has no mean other than ordering.
func (TestSpanTree) Matches ¶
func (t TestSpanTree) Matches(actual SpanTree) error
Matches checks to see if this TestSpanTree matches an actual SpanTree. It is intended to be used for assertions while testing.
func (*TestSpanTree) SortChildren ¶
func (t *TestSpanTree) SortChildren()
SortChildren attempts to sort the children of this TestSpanTree. The children are siblings, order does not actually matter. TestSpanTree.Matches() correctly handles this, by matching in any order. SortChildren() is most useful before JSON pretty printing the structure and comparing manually.
The order it uses:
- Shorter children first.
- Span kind.
- "http.url", "http.host", "http.path" tag presence and values.
If all of those are equal, then arbitrarily choose the earlier index.
func (TestSpanTree) SpanCount ¶
func (t TestSpanTree) SpanCount() int
SpanCount gets the count of spans in this tree.
func (TestSpanTree) String ¶
func (t TestSpanTree) String() string