tracing

package
v0.32.2 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: Apache-2.0 Imports: 17 Imported by: 20

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func ContextTracing_ClientDisablesTracing added in v0.29.0

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

func ContextTracing_ForceTracing added in v0.29.0

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

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

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

func CountSampledSpans added in v0.29.0

func CountSampledSpans(ss tracetest.SpanStubs) int

Utility function for use with tests in pkg/tracing.

func CountSpans_ClientEnablesTracing added in v0.29.0

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

func DoInSpan added in v0.12.0

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

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

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 HTTPMiddleware

func HTTPMiddleware(tracer opentracing.Tracer, name string, logger log.Logger, next http.Handler) http.HandlerFunc

HTTPMiddleware returns an HTTP handler that injects the given tracer and starts a new server span. If any client span is fetched from the wire, we include that as our parent.

func HTTPTripperware

func HTTPTripperware(logger log.Logger, next http.RoundTripper) http.RoundTripper

HTTPTripperware returns HTTP tripper that assumes given span in context as client child span and injects it into the wire. NOTE: It assumes tracer is given in request context. Also, it is caller responsibility to finish span.

func StreamClientInterceptor

func StreamClientInterceptor(tracer opentracing.Tracer) grpc.StreamClientInterceptor

StreamClientInterceptor returns a new streaming client interceptor for OpenTracing.

func StreamServerInterceptor

func StreamServerInterceptor(tracer opentracing.Tracer) grpc.StreamServerInterceptor

StreamServerInterceptor returns a new streaming server interceptor for OpenTracing and injects given tracer.

func UnaryClientInterceptor

func UnaryClientInterceptor(tracer opentracing.Tracer) grpc.UnaryClientInterceptor

UnaryClientInterceptor returns a new unary client interceptor for OpenTracing.

func UnaryServerInterceptor

func UnaryServerInterceptor(tracer opentracing.Tracer) grpc.UnaryServerInterceptor

UnaryServerInterceptor returns a new unary server interceptor for OpenTracing and injects given tracer.

Types

type Span added in v0.23.0

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

type Tag = opentracing.Tag

type Tags added in v0.23.0

type Tags = opentracing.Tags

type Tracer added in v0.7.0

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