propagation

package
v0.0.0-...-593c137 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package propagation manages propagation of trace context headers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Extractor

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

Extractor inserts trace context into and extracts trace context out of different types.

func (Extractor) Extract

func (e Extractor) Extract(events ...interface{}) (*TraceContext, error)

Extract looks in the given events one by one and returns once a proper trace context is found.

func (Extractor) ExtractFromLayer

func (e Extractor) ExtractFromLayer(hdr http.Header) *TraceContextExtended

ExtractFromLayer is used for extracting context from the request headers sent from a tracing layer. Currently, only datadog style headers are extracted. If a trace id or parent id are not found, then the embedded *TraceContext will be nil.

func (Extractor) InjectToLayer

func (e Extractor) InjectToLayer(tc *TraceContext, hdr http.Header)

InjectToLayer is used for injecting context into the response headers sent to a tracing layer. Currently, only datadog style headers are injected.

type TraceContext

type TraceContext struct {
	TraceID           uint64
	TraceIDUpper64Hex string
	ParentID          uint64
	SamplingPriority  sampler.SamplingPriority
}

TraceContext stores the propagated trace context values.

type TraceContextExtended

type TraceContextExtended struct {
	*TraceContext
	SpanID          uint64
	InvocationError bool
}

TraceContextExtended stores the propagated trace context values plus other non-standard header values.

Jump to

Keyboard shortcuts

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