tracing

package
v0.29.4 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: Apache-2.0 Imports: 12 Imported by: 9

Documentation

Index

Constants

View Source
const HostSuffix = "[.][^/]+"

hostSuffix is an optional suffix that might appear at the end of hostnames. We supplement matches with this to allow matches for:

foo.bar

to match all of:

foo.bar
foo.bar.svc
foo.bar.svc.cluster.local

It's hardly perfect, but requires the suffix to start with the delimiter '.' and then match anything prior to the path starting, e.g. '/'

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 *testlib.Client)

Setup sets up port forwarding to Zipkin.

Types

type SpanMatcher added in v0.14.0

type SpanMatcher struct {
	Kind                     *model.Kind               `json:"a_Kind,omitempty"`
	LocalEndpointServiceName string                    `json:"b_Name,omitempty"`
	Tags                     map[string]*regexp.Regexp `json:"c_Tags,omitempty"`
}

func MatchHTTPSpanNoReply added in v0.14.0

func MatchHTTPSpanNoReply(kind model.Kind, opts ...SpanMatcherOption) *SpanMatcher

func MatchHTTPSpanWithCode added in v0.14.0

func MatchHTTPSpanWithCode(kind model.Kind, statusCode int, opts ...SpanMatcherOption) *SpanMatcher

func MatchHTTPSpanWithReply added in v0.14.0

func MatchHTTPSpanWithReply(kind model.Kind, opts ...SpanMatcherOption) *SpanMatcher

func (*SpanMatcher) MatchesSpan added in v0.14.0

func (m *SpanMatcher) MatchesSpan(span *model.SpanModel) error

type SpanMatcherOption added in v0.14.0

type SpanMatcherOption func(*SpanMatcher)

func WithHTTPHostAndPath added in v0.14.0

func WithHTTPHostAndPath(host, path string) SpanMatcherOption

func WithLocalEndpointServiceName added in v0.14.0

func WithLocalEndpointServiceName(s string) SpanMatcherOption

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(trace []model.SpanModel) (*SpanTree, error)

GetTraceTree converts a set slice of spans into a SpanTree.

func (SpanTree) String

func (t SpanTree) String() string

type TestSpanTree

type TestSpanTree struct {
	Note     string         `json:"a_Note,omitempty"`
	Span     *SpanMatcher   `json:"c_Span"`
	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) MatchesSubtree added in v0.14.0

func (tt TestSpanTree) MatchesSubtree(t *testing.T, actual *SpanTree) (matches [][]SpanTree)

MatchesSubtree checks to see if this TestSpanTree matches a subtree of the actual SpanTree. It is intended to be used for assertions while testing. Returns the set of possible subtree matches with the corresponding set of unmatched siblings.

func (TestSpanTree) String

func (tt TestSpanTree) String() string

Jump to

Keyboard shortcuts

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