Documentation ¶
Index ¶
- Variables
- func Duration(key string, t time.Duration) log.Field
- func SpanFromContextOrNoop(ctx context.Context) opentracing.Span
- func StartSpanFromContext(ctx context.Context, operationName string, opts ...opentracing.StartSpanOption) (opentracing.Span, context.Context)
- func Time(key string, t time.Time) log.Field
- type TracingConfiguration
Constants ¶
This section is empty.
Variables ¶
var (
TracingBackendJaeger = "jaeger"
)
Supported tracing backends. Currently only jaeger is supported.
Functions ¶
func Duration ¶
Duration is a log.Field for Duration values. It translates to the standard Go duration format (Duration.String()).
func SpanFromContextOrNoop ¶
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.
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).