adjuster

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package adjuster contains various adjusters for model.Trace.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adjuster

type Adjuster interface {
	Adjust(trace *model.Trace) (*model.Trace, error)
}

Adjuster applies certain modifications to a Trace object. It returns adjusted Trace, which can be the same Trace updated in place. If it detects a problem with the trace that prevents it from applying adjustments, it must still return the original trace, and the error.

func ClockSkew

func ClockSkew() Adjuster

ClockSkew returns an adjuster that modifies start time and log timestamps for spans that appear to be "off" with respect to the parent span due to clock skew on different servers. The main condition that it checks is that child spans do not start before or end after their parent spans.

The algorithm assumes that all spans have unique IDs, so the trace may need to go through another adjuster first, such as SpanIDDeduper.

This adjuster never returns any errors. Instead it records any issues it encounters in Span.Warnings.

func FailFastSequence

func FailFastSequence(adjusters ...Adjuster) Adjuster

FailFastSequence is similar to Sequence() but returns immediately if any adjuster returns an error.

func IPTagAdjuster

func IPTagAdjuster() Adjuster

IPTagAdjuster returns an adjuster that replaces numeric "ip" tags, which usually contain IPv4 packed into uint32, with their string representation (e.g. "8.8.8.8"").

func Sequence

func Sequence(adjusters ...Adjuster) Adjuster

Sequence creates an adjuster that combines a series of adjusters applied in order. Errors from each step are accumulated and returned in the end as a single wrapper error. Errors do not interrupt the sequence of adapters.

func SortLogFields

func SortLogFields() Adjuster

SortLogFields returns an Adjuster that sorts the fields in the span logs. It puts the `event` field in the first position (if present), and sorts all other fields lexicographically.

TODO: it should also do something about the "msg" field, maybe replace it with "event" field. TODO: we may also want to move "level" field (as in logging level) to an earlier place in the list. This adjuster needs some sort of config describing predefined field names/types and their relative order.

func SpanIDDeduper

func SpanIDDeduper() Adjuster

SpanIDDeduper returns an adjuster that changes span ids for server spans (i.e. spans with tag: span.kind == server) if there is another client span that shares the same span ID. This is needed to deal with Zipkin-style clients that reuse the same span ID for both client and server side of an RPC call. Jaeger UI expects all spans to have unique IDs.

This adjuster never returns any errors. Instead it records any issues it encounters in Span.Warnings.

func SpanReferences added in v1.1.0

func SpanReferences() Adjuster

SpanReferences creates an adjuster that removes invalid span references, e.g. with traceID==0

type Func

type Func func(trace *model.Trace) (*model.Trace, error)

Func wraps a function of appropriate signature and makes an Adjuster from it.

func (Func) Adjust

func (f Func) Adjust(trace *model.Trace) (*model.Trace, error)

Adjust implements Adjuster interface.

Jump to

Keyboard shortcuts

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