adjuster

package
v1.65.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adjuster

type Adjuster interface {
	Adjust(ptrace.Traces)
}

Adjuster is an interface for modifying a trace object in place. If an issue is encountered that prevents modifications, an error should be returned. The caller must ensure that all spans in the ptrace.Traces argument belong to the same trace and represent the complete trace.

func CorrectClockSkew

func CorrectClockSkew(maxDelta time.Duration) Adjuster

CorrectClockSkew returns an Adjuster that corrects span timestamps for clock skew.

This adjuster modifies the start and log timestamps of child spans that are inconsistent with their parent spans due to clock differences between hosts. It assumes all spans have unique IDs and should be used after SpanIDUniquifier.

The adjuster determines if two spans belong to the same source by deriving a unique string representation of a host based on resource attributes, such as `host.id`, `host.ip`, or `host.name`. If two spans have the same host key, they are considered to be from the same source, and no clock skew adjustment is expected between them.

Parameters:

  • maxDelta: The maximum allowable time adjustment. Adjustments exceeding this value will be ignored.

func DeduplicateClientServerSpanIDs

func DeduplicateClientServerSpanIDs() Adjuster

DeduplicateClientServerSpanIDs 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.

Any issues encountered during adjustment are recorded as warnings in the span.

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 StandardAdjusters

func StandardAdjusters(maxClockSkewAdjust time.Duration) []Adjuster

StandardAdjusters returns a list of adjusters applied by the query service before returning the data to the API clients.

type Func

type Func func(traces ptrace.Traces)

Func is a type alias that wraps a function and makes an Adjuster from it.

func (Func) Adjust

func (f Func) Adjust(traces ptrace.Traces)

Adjust implements Adjuster interface for the Func alias.

type IPAttributeAdjuster

type IPAttributeAdjuster struct{}

func NormalizeIPAttributes

func NormalizeIPAttributes() IPAttributeAdjuster

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

func (IPAttributeAdjuster) Adjust

func (ia IPAttributeAdjuster) Adjust(traces ptrace.Traces)

type LinksAdjuster

type LinksAdjuster struct{}
func RemoveEmptySpanLinks() LinksAdjuster

RemoveEmptySpanLinks creates an adjuster that removes span links with empty trace IDs.

func (LinksAdjuster) Adjust

func (la LinksAdjuster) Adjust(traces ptrace.Traces)

type ResourceAttributesAdjuster

type ResourceAttributesAdjuster struct{}

func MoveLibraryAttributes

func MoveLibraryAttributes() ResourceAttributesAdjuster

MoveLibraryAttributes creates an adjuster that moves the OpenTelemetry library attributes from spans to the parent resource so that the UI can display them separately under Process. https://github.com/jaegertracing/jaeger/issues/4534

func (ResourceAttributesAdjuster) Adjust

func (o ResourceAttributesAdjuster) Adjust(traces ptrace.Traces)

type SortAttributesAndEventsAdjuster

type SortAttributesAndEventsAdjuster struct{}

func SortCollections

func SortCollections() SortAttributesAndEventsAdjuster

SortCollections creates an adjuster that standardizes trace data by sorting elements: - Resource attributes are sorted lexicographically by their keys. - Scope attributes are sorted lexicographically by their keys. - Span attributes are sorted lexicographically by their keys. - Span events are sorted lexicographically by their names. - Attributes within each span event are sorted lexicographically by their keys. - Attributes within each span link are sorted lexicographically by their keys.

func (SortAttributesAndEventsAdjuster) Adjust

type SpanHashDeduper

type SpanHashDeduper struct {
	// contains filtered or unexported fields
}

func DeduplicateSpans

func DeduplicateSpans() *SpanHashDeduper

DeduplicateSpans creates an adjuster that deduplicates spans by removing all but one span with the same hash code. This is particularly useful for scenarios where spans may be duplicated during archival, such as with ElasticSearch archival.

The hash code is generated by serializing the span into protobuf bytes and applying the FNV hashing algorithm to the serialized data.

To ensure consistent hash codes, this adjuster should be executed after SortAttributesAndEvents, which normalizes the order of collections within the span.

func (*SpanHashDeduper) Adjust

func (s *SpanHashDeduper) Adjust(traces ptrace.Traces)

Jump to

Keyboard shortcuts

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