tracing

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package tracing contains orchestration code for opentracing. Specifically, it is used to build an integration with Jaeger.

Index

Constants

This section is empty.

Variables

View Source
var Flags = flag.Flags{
	&flag.Boolean{
		Name:        "tracer-disabled",
		Usage:       "If true, disables opentracing",
		EnvVar:      "TRACER_DISABLED",
		Destination: &config.disabled,
		Hidden:      true,
	},
	&flag.String{
		Name:        "tracer-host",
		Usage:       "Host for opentracing",
		EnvVar:      "TRACER_HOST",
		Destination: &config.host,
		Hidden:      true,
	},
	&flag.Float64{
		Name:        "tracer-sample-rate",
		Usage:       "Sample rate for traces",
		EnvVar:      "TRACER_SAMPLE_RATE",
		Value:       1,
		Destination: &config.sampleRate,
		Hidden:      true,
	},
	&flag.Duration{
		Name:        "tracer-flush-interval",
		Usage:       "Buffer flushing interval for traces",
		EnvVar:      "TRACER_BUFFER_FLUSH_INTERVAL",
		Value:       time.Second,
		Destination: &config.bufferFlushInterval,
		Hidden:      true,
	},
}

Flags contains all command-line flags that can be used to configure tracing.

Functions

func AddError

func AddError(span opentracing.Span, err error)

AddError adds the provided error to the span.

func New

func New() (io.Closer, error)

New sets up the global tracer. The io.Closer instance returned is used to stop tracing.

func SetSpanTag added in v1.5.0

func SetSpanTag(ctx context.Context, key string, val interface{})

SetSpanTag adds the given key/value pair to the tags for the current span.

func SpanFromMetadata added in v1.5.0

func SpanFromMetadata(ctx context.Context, operationName string, md map[string]string) (opentracing.Span, context.Context, error)

SpanFromMetadata starts a new span whose name is set to operationName. The previous span is extracted from the given map[string]string. If no span metadata is set, a new span is started using whatever is inside the given context.

func SpanMetadata added in v1.5.0

func SpanMetadata(span opentracing.Span) (map[string]string, error)

SpanMetadata returns a map[string]string containing the metadata for the provided span. This should be used for passing span information across application boundaries.

func WithError

func WithError(span opentracing.Span, err error) error

WithError returns err after adding its details to the span.

func WrapHTTPHandler

func WrapHTTPHandler(h http.Handler) http.Handler

WrapHTTPHandler wraps an http.Handler so that all inbound requests create a trace. Ignores operational endpoints.

Types

This section is empty.

Jump to

Keyboard shortcuts

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