tracing

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const ForceTracingAttributeKey = "force_tracing"

ForceTracingAttributeKey is used to signalize a span should be traced.

View Source
const (
	// ForceTracingBaggageKey is a request header name that forces tracing sampling.
	ForceTracingBaggageKey = "X-Force-Tracing"
)

Variables

This section is empty.

Functions

func Bridge

Bridge is a method to facilitate migration from OpenTracing (OT) to OpenTelemetry (OTEL). It pairs an OTEL tracer with a so-called bridge tracer, which satisfies the OT Tracer interface. This makes it possible for OT instrumentation to work with an OTEL tracer.

NOTE: After instrumentation migration is finished, this bridge should be removed.

func ContextTracing_ClientDisablesTracing

func ContextTracing_ClientDisablesTracing(t *testing.T, exp *tracetest.InMemoryExporter, clientRoot, srvRoot, srvChild opentracing.Span)

func ContextTracing_ForceTracing

func ContextTracing_ForceTracing(t *testing.T, exp *tracetest.InMemoryExporter, clientRoot, srvRoot, srvChild opentracing.Span)

func ContextWithTracer

func ContextWithTracer(ctx context.Context, tracer opentracing.Tracer) context.Context

ContextWithTracer returns a new `context.Context` that holds a reference to given opentracing.Tracer.

func CopyTraceContext

func CopyTraceContext(trgt, src context.Context) context.Context

CopyTraceContext copies the necessary trace context from given source context to target context.

func CountSampledSpans

func CountSampledSpans(ss tracetest.SpanStubs) int

Utility function for use with tests in pkg/tracing.

func CountSpans_ClientEnablesTracing

func CountSpans_ClientEnablesTracing(t *testing.T, exp *tracetest.InMemoryExporter, clientRoot, srvRoot, srvChild opentracing.Span)

func DoInSpan

func DoInSpan(ctx context.Context, operationName string, doFn func(context.Context), opts ...opentracing.StartSpanOption)

DoInSpan executes function doFn inside new span with `operationName` name and hooking as child to a span found within given context if any. It uses opentracing.Tracer propagated in context. If no found, it uses noop tracer notification.

func DoInSpanWithErr

func DoInSpanWithErr(ctx context.Context, operationName string, doFn func(context.Context) error, opts ...opentracing.StartSpanOption) error

DoInSpanWithErr executes function doFn inside new span with `operationName` name and hooking as child to a span found within given context if any. It uses opentracing.Tracer propagated in context. If no found, it uses noop tracer notification. It logs the error inside the new span created, which differentiates it from DoInSpan and DoWithSpan.

func DoWithSpan

func DoWithSpan(ctx context.Context, operationName string, doFn func(context.Context, Span), opts ...opentracing.StartSpanOption)

DoWithSpan executes function doFn inside new span with `operationName` name and hooking as child to a span found within given context if any. It uses opentracing.Tracer propagated in context. If no found, it uses noop tracer notification.

func GetTraceIDFromBridgeSpan

func GetTraceIDFromBridgeSpan(span opentracing.Span) (string, bool)

func SamplerWithOverride

func SamplerWithOverride(baseSampler tracesdk.Sampler, overrideKey attribute.Key) tracesdk.Sampler

SamplerWithOverride creates a new sampler with the capability to override the sampling decision, if the span includes an attribute with the specified key. Otherwise the sampler delegates the decision to the wrapped base sampler. This is primarily used to enable forced tracing in Thanos components. Implements go.opentelemetry.io/otel/sdk/trace.Sampler interface.

Types

type Span

type Span = opentracing.Span

func StartSpan

func StartSpan(ctx context.Context, operationName string, opts ...opentracing.StartSpanOption) (Span, context.Context)

StartSpan starts and returns span with `operationName` and hooking as child to a span found within given context if any. It uses opentracing.Tracer propagated in context. If no found, it uses noop tracer without notification.

type Tag

type Tag = opentracing.Tag

type Tags

type Tags = opentracing.Tags

type Tracer

type Tracer interface {
	GetTraceIDFromSpanContext(ctx opentracing.SpanContext) (string, bool)
}

Tracer interface to provide GetTraceIDFromSpanContext method.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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