Documentation
¶
Index ¶
- Constants
- func Bridge(tp *tracesdk.TracerProvider, l log.Logger) (opentracing.Tracer, io.Closer)
- func ContextTracing_ClientDisablesTracing(t *testing.T, exp *tracetest.InMemoryExporter, ...)
- func ContextTracing_ForceTracing(t *testing.T, exp *tracetest.InMemoryExporter, ...)
- func ContextWithTracer(ctx context.Context, tracer opentracing.Tracer) context.Context
- func CopyTraceContext(trgt, src context.Context) context.Context
- func CountSampledSpans(ss tracetest.SpanStubs) int
- func CountSpans_ClientEnablesTracing(t *testing.T, exp *tracetest.InMemoryExporter, ...)
- func DoInSpan(ctx context.Context, operationName string, doFn func(context.Context), ...)
- func DoInSpanWithErr(ctx context.Context, operationName string, doFn func(context.Context) error, ...) error
- func DoWithSpan(ctx context.Context, operationName string, doFn func(context.Context, Span), ...)
- func GetTraceIDFromBridgeSpan(span opentracing.Span) (string, bool)
- func SamplerWithOverride(baseSampler tracesdk.Sampler, overrideKey attribute.Key) tracesdk.Sampler
- type Span
- type Tag
- type Tags
- type Tracer
Constants ¶
const ForceTracingAttributeKey = "force_tracing"
ForceTracingAttributeKey is used to signalize a span should be traced.
const (
// ForceTracingBaggageKey is a request header name that forces tracing sampling.
ForceTracingBaggageKey = "X-Force-Tracing"
)
Variables ¶
This section is empty.
Functions ¶
func Bridge ¶
func Bridge(tp *tracesdk.TracerProvider, l log.Logger) (opentracing.Tracer, io.Closer)
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 ¶
ContextWithTracer returns a new `context.Context` that holds a reference to given opentracing.Tracer.
func CopyTraceContext ¶
CopyTraceContext copies the necessary trace context from given source context to target context.
func CountSampledSpans ¶
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 ¶
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.