tracing

package
v0.43.3 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 8 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.

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 MatchSpan added in v0.32.3

func MatchSpan(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 WithCode added in v0.32.3

func WithCode(statusCode int) SpanMatcherOption

func WithHTTPHostAndPath added in v0.14.0

func WithHTTPHostAndPath(host, path string) SpanMatcherOption

func WithHTTPURL added in v0.32.3

func WithHTTPURL(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