opentracing

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TracingBackendJaeger = "jaeger"
)

Supported tracing backends. Currently only jaeger is supported.

Functions

func Duration

func Duration(key string, t time.Duration) log.Field

Duration is a log.Field for Duration values. It translates to the standard Go duration format (Duration.String()).

func SpanFromContextOrNoop

func SpanFromContextOrNoop(ctx context.Context) opentracing.Span

SpanFromContextOrNoop is the same as opentracing.SpanFromContext, but instead of returning nil, it returns a NoopTracer span if ctx doesn't already have an associated span. Use this over opentracing.StartSpanFromContext if you need access to the current span, (e.g. if you don't want to start a child span).

NB: if there is no span in the context, the span returned by this function is a noop, and won't be attached to the context; if you want a proper span, either start one and pass it in, or start one in your function.

func StartSpanFromContext

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

StartSpanFromContext is the same as opentracing.StartSpanFromContext, but instead of always using the global tracer, it attempts to use the parent span's tracer if it's available. This behavior is (arguably) more flexible--it allows a locally set tracer to be used when needed (as in tests)--while being equivalent to the original in most contexts. See https://github.com/opentracing/opentracing-go/issues/149 for more discussion.

func Time

func Time(key string, t time.Time) log.Field

Time is a log.Field for time.Time values. It translates to RFC3339 formatted time strings. (e.g. 2018-04-15T13:47:26+00:00)

Types

type TracingConfiguration

type TracingConfiguration struct {
	ServiceName string                  `yaml:"serviceName"`
	Backend     string                  `yaml:"backend"`
	Jaeger      jaegercfg.Configuration `yaml:"jaeger"`
}

TracingConfiguration configures an opentracing backend for m3query to use. Currently only jaeger is supported. Tracing is disabled if no backend is specified.

func (*TracingConfiguration) NewTracer

func (cfg *TracingConfiguration) NewTracer(defaultServiceName string, scope tally.Scope, logger *zap.Logger) (opentracing.Tracer, io.Closer, error)

NewTracer returns a tracer configured with the configuration provided by this struct. The tracer's concrete type is determined by cfg.Backend. Currently only `"jaeger"` is supported. `""` implies disabled (NoopTracer).

Jump to

Keyboard shortcuts

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