tracing

package
v0.13.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrettyPrintTrace

func PrettyPrintTrace(trace []model.SpanModel) string

PrettyPrintTrace pretty prints a Trace.

func Setup

func Setup(t *testing.T, client *lib.Client)

Setup sets up port forwarding to Zipkin and sets the knative-eventing tracing config to debug mode (everything is sampled).

Types

type SpanTree

type SpanTree struct {
	Root     bool
	Span     model.SpanModel
	Children []SpanTree
}

SpanTree is the tree of Spans representation of a Trace.

func GetTraceTree

func GetTraceTree(t *testing.T, trace []model.SpanModel) SpanTree

GetTraceTree converts a set slice of spans into a SpanTree.

func (SpanTree) String

func (t SpanTree) String() string

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:

  1. Shorter children first.
  2. Span kind.
  3. "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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL