Documentation
¶
Overview ¶
Package jaeger implements an OpenTracing (http://opentracing.io) Tracer.
For integration instructions please refer to the README:
https://github.com/uber/jaeger-client-go/blob/master/README.md
Index ¶
- Constants
- Variables
- func BuildJaegerProcessThrift(span *Span) *j.Process
- func BuildJaegerThrift(span *Span) *j.Span
- func BuildZipkinThrift(s *Span) *z.Span
- func ConvertLogsToJaegerTags(logFields []log.Field) []*j.Tag
- func EnableFirehose(s *Span)
- func NewTracer(serviceName string, sampler Sampler, reporter Reporter, ...) (opentracing.Tracer, io.Closer)
- func SelfRef(ctx SpanContext) opentracing.SpanReference
- type AdaptiveSamplerUpdater
- type BinaryPropagator
- type ConstSampler
- func (s *ConstSampler) Close()
- func (s *ConstSampler) Equal(other Sampler) bool
- func (s *ConstSampler) IsSampled(id TraceID, operation string) (bool, []Tag)
- func (s *ConstSampler) OnCreateSpan(span *Span) SamplingDecision
- func (s *ConstSampler) OnFinishSpan(span *Span) SamplingDecision
- func (s *ConstSampler) OnSetOperationName(span *Span, operationName string) SamplingDecision
- func (s *ConstSampler) OnSetTag(span *Span, key string, value interface{}) SamplingDecision
- func (s *ConstSampler) String() string
- type ContribObserver
- type ContribSpanObserver
- type ExtractableZipkinSpan
- type Extractor
- type GuaranteedThroughputProbabilisticSampler
- func (s *GuaranteedThroughputProbabilisticSampler) Close()
- func (s *GuaranteedThroughputProbabilisticSampler) Equal(other Sampler) bool
- func (s *GuaranteedThroughputProbabilisticSampler) IsSampled(id TraceID, operation string) (bool, []Tag)
- func (s GuaranteedThroughputProbabilisticSampler) String() string
- type HeadersConfig
- type InMemoryReporter
- type InjectableZipkinSpan
- type Injector
- type Logger
- type Metrics
- type Observerdeprecated
- type PerOperationSampler
- func (s *PerOperationSampler) Close()
- func (s *PerOperationSampler) Equal(other Sampler) bool
- func (s *PerOperationSampler) IsSampled(id TraceID, operation string) (bool, []Tag)
- func (s *PerOperationSampler) OnCreateSpan(span *Span) SamplingDecision
- func (s *PerOperationSampler) OnFinishSpan(span *Span) SamplingDecision
- func (s *PerOperationSampler) OnSetOperationName(span *Span, operationName string) SamplingDecision
- func (s *PerOperationSampler) OnSetTag(span *Span, key string, value interface{}) SamplingDecision
- func (s *PerOperationSampler) String() string
- type PerOperationSamplerParams
- type ProbabilisticSampler
- func (s *ProbabilisticSampler) Close()
- func (s *ProbabilisticSampler) Equal(other Sampler) bool
- func (s *ProbabilisticSampler) IsSampled(id TraceID, operation string) (bool, []Tag)
- func (s *ProbabilisticSampler) OnCreateSpan(span *Span) SamplingDecision
- func (s *ProbabilisticSampler) OnFinishSpan(span *Span) SamplingDecision
- func (s *ProbabilisticSampler) OnSetOperationName(span *Span, operationName string) SamplingDecision
- func (s *ProbabilisticSampler) OnSetTag(span *Span, key string, value interface{}) SamplingDecision
- func (s *ProbabilisticSampler) SamplingRate() float64
- func (s *ProbabilisticSampler) String() string
- func (s *ProbabilisticSampler) Update(samplingRate float64) error
- type ProbabilisticSamplerUpdater
- type Process
- type ProcessSetter
- type RateLimitingSampler
- func (s *RateLimitingSampler) Close()
- func (s *RateLimitingSampler) Equal(other Sampler) bool
- func (s *RateLimitingSampler) IsSampled(id TraceID, operation string) (bool, []Tag)
- func (s *RateLimitingSampler) OnCreateSpan(span *Span) SamplingDecision
- func (s *RateLimitingSampler) OnFinishSpan(span *Span) SamplingDecision
- func (s *RateLimitingSampler) OnSetOperationName(span *Span, operationName string) SamplingDecision
- func (s *RateLimitingSampler) OnSetTag(span *Span, key string, value interface{}) SamplingDecision
- func (s *RateLimitingSampler) String() string
- func (s *RateLimitingSampler) Update(maxTracesPerSecond float64)
- type RateLimitingSamplerUpdater
- type Reference
- type RemotelyControlledSampler
- func (s *RemotelyControlledSampler) Close()
- func (s *RemotelyControlledSampler) Equal(other Sampler) bool
- func (s *RemotelyControlledSampler) IsSampled(id TraceID, operation string) (bool, []Tag)
- func (s *RemotelyControlledSampler) OnCreateSpan(span *Span) SamplingDecision
- func (s *RemotelyControlledSampler) OnFinishSpan(span *Span) SamplingDecision
- func (s *RemotelyControlledSampler) OnSetOperationName(span *Span, operationName string) SamplingDecision
- func (s *RemotelyControlledSampler) OnSetTag(span *Span, key string, value interface{}) SamplingDecision
- func (s *RemotelyControlledSampler) Sampler() SamplerV2
- func (s *RemotelyControlledSampler) UpdateSampler()
- type Reporter
- type ReporterOption
- type Sampler
- type SamplerOption
- type SamplerOptionsFactory
- func (SamplerOptionsFactory) InitialSampler(sampler Sampler) SamplerOption
- func (SamplerOptionsFactory) Logger(logger Logger) SamplerOption
- func (SamplerOptionsFactory) MaxOperations(maxOperations int) SamplerOption
- func (SamplerOptionsFactory) Metrics(m *Metrics) SamplerOption
- func (SamplerOptionsFactory) OperationNameLateBinding(enable bool) SamplerOption
- func (SamplerOptionsFactory) SamplingRefreshInterval(samplingRefreshInterval time.Duration) SamplerOption
- func (SamplerOptionsFactory) SamplingServerURL(samplingServerURL string) SamplerOption
- func (SamplerOptionsFactory) SamplingStrategyFetcher(fetcher SamplingStrategyFetcher) SamplerOption
- func (SamplerOptionsFactory) SamplingStrategyParser(parser SamplingStrategyParser) SamplerOption
- func (SamplerOptionsFactory) Updaters(updaters ...SamplerUpdater) SamplerOption
- type SamplerUpdater
- type SamplerV2
- type SamplerV2Base
- type SamplingDecision
- type SamplingStrategyFetcher
- type SamplingStrategyParser
- type Span
- func (s *Span) BaggageItem(key string) string
- func (s *Span) Context() opentracing.SpanContext
- func (s *Span) Duration() time.Duration
- func (s *Span) Finish()
- func (s *Span) FinishWithOptions(options opentracing.FinishOptions)
- func (s *Span) Log(ld opentracing.LogData)
- func (s *Span) LogEvent(event string)
- func (s *Span) LogEventWithPayload(event string, payload interface{})
- func (s *Span) LogFields(fields ...log.Field)
- func (s *Span) LogKV(alternatingKeyValues ...interface{})
- func (s *Span) Logs() []opentracing.LogRecord
- func (s *Span) OperationName() string
- func (s *Span) References() []opentracing.SpanReference
- func (s *Span) Release()
- func (s *Span) Retain() *Span
- func (s *Span) SetBaggageItem(key, value string) opentracing.Span
- func (s *Span) SetOperationName(operationName string) opentracing.Span
- func (s *Span) SetTag(key string, value interface{}) opentracing.Span
- func (s *Span) SpanContext() SpanContext
- func (s *Span) StartTime() time.Time
- func (s *Span) String() string
- func (s *Span) Tags() opentracing.Tags
- func (s *Span) Tracer() opentracing.Tracer
- type SpanAllocator
- type SpanContext
- func (c *SpanContext) CopyFrom(ctx *SpanContext)
- func (c SpanContext) ExtendedSamplingState(key interface{}, initValue func() interface{}) interface{}
- func (c SpanContext) Flags() byte
- func (c SpanContext) ForeachBaggageItem(handler func(k, v string) bool)
- func (c SpanContext) IsDebug() bool
- func (c SpanContext) IsFirehose() bool
- func (c SpanContext) IsSampled() bool
- func (c SpanContext) IsSamplingFinalized() bool
- func (c SpanContext) IsValid() bool
- func (c SpanContext) ParentID() SpanID
- func (c SpanContext) SetFirehose()
- func (c SpanContext) SpanID() SpanID
- func (c SpanContext) String() string
- func (c SpanContext) TraceID() TraceID
- func (c SpanContext) WithBaggageItem(key, value string) SpanContext
- type SpanID
- type SpanObserverdeprecated
- type Tag
- type TextMapPropagator
- type TraceID
- type Tracer
- func (t *Tracer) Close() error
- func (t *Tracer) Extract(format interface{}, carrier interface{}) (opentracing.SpanContext, error)
- func (t *Tracer) Inject(ctx opentracing.SpanContext, format interface{}, carrier interface{}) error
- func (t *Tracer) Sampler() SamplerV2
- func (t *Tracer) StartSpan(operationName string, options ...opentracing.StartSpanOption) opentracing.Span
- func (t *Tracer) Tags() []opentracing.Tag
- type TracerOption
- type TracerOptionsFactory
- func (TracerOptionsFactory) BaggageRestrictionManager(mgr baggage.RestrictionManager) TracerOption
- func (TracerOptionsFactory) ContribObserver(observer ContribObserver) TracerOption
- func (TracerOptionsFactory) CustomHeaderKeys(headerKeys *HeadersConfig) TracerOption
- func (TracerOptionsFactory) DebugThrottler(throttler throttler.Throttler) TracerOption
- func (TracerOptionsFactory) Extractor(format interface{}, extractor Extractor) TracerOption
- func (TracerOptionsFactory) Gen128Bit(gen128Bit bool) TracerOption
- func (TracerOptionsFactory) HighTraceIDGenerator(highTraceIDGenerator func() uint64) TracerOption
- func (TracerOptionsFactory) HostIPv4(hostIPv4 uint32) TracerOption
- func (TracerOptionsFactory) Injector(format interface{}, injector Injector) TracerOption
- func (TracerOptionsFactory) Logger(logger Logger) TracerOption
- func (TracerOptionsFactory) MaxLogsPerSpan(maxLogsPerSpan int) TracerOption
- func (TracerOptionsFactory) MaxTagValueLength(maxTagValueLength int) TracerOption
- func (TracerOptionsFactory) Metrics(m *Metrics) TracerOption
- func (TracerOptionsFactory) NoDebugFlagOnForcedSampling(noDebugFlagOnForcedSampling bool) TracerOption
- func (t TracerOptionsFactory) Observer(observer Observer) TracerOption
- func (TracerOptionsFactory) PoolSpans(poolSpans bool) TracerOption
- func (TracerOptionsFactory) RandomNumber(randomNumber func() uint64) TracerOption
- func (TracerOptionsFactory) Tag(key string, value interface{}) TracerOption
- func (TracerOptionsFactory) TimeNow(timeNow func() time.Time) TracerOption
- func (TracerOptionsFactory) ZipkinSharedRPCSpan(zipkinSharedRPCSpan bool) TracerOption
- type Transport
- type UDPTransportParams
Constants ¶
const ( // JaegerClientVersion is the version of the client library reported as Span tag. JaegerClientVersion = "Go-2.30.0" // JaegerClientVersionTagKey is the name of the tag used to report client version. JaegerClientVersionTagKey = "jaeger.version" // JaegerDebugHeader is the name of HTTP header or a TextMap carrier key which, // if found in the carrier, forces the trace to be sampled as "debug" trace. // The value of the header is recorded as the tag on the root span, so that the // trace can be found in the UI using this value as a correlation ID. JaegerDebugHeader = "jaeger-debug-id" // JaegerBaggageHeader is the name of the HTTP header that is used to submit baggage. // It differs from TraceBaggageHeaderPrefix in that it can be used only in cases where // a root span does not exist. JaegerBaggageHeader = "jaeger-baggage" // TracerHostnameTagKey used to report host name of the process. TracerHostnameTagKey = "hostname" // TracerIPTagKey used to report ip of the process. TracerIPTagKey = "ip" // TracerUUIDTagKey used to report UUID of the client process. TracerUUIDTagKey = "client-uuid" // SamplerTypeTagKey reports which sampler was used on the root span. SamplerTypeTagKey = "sampler.type" // SamplerParamTagKey reports the parameter of the sampler, like sampling probability. SamplerParamTagKey = "sampler.param" // TraceContextHeaderName is the http header name used to propagate tracing context. // This must be in lower-case to avoid mismatches when decoding incoming headers. TraceContextHeaderName = "uber-trace-id" // TracerStateHeaderName is deprecated. // Deprecated: use TraceContextHeaderName TracerStateHeaderName = TraceContextHeaderName // TraceBaggageHeaderPrefix is the prefix for http headers used to propagate baggage. // This must be in lower-case to avoid mismatches when decoding incoming headers. TraceBaggageHeaderPrefix = "uberctx-" // SamplerTypeConst is the type of sampler that always makes the same decision. SamplerTypeConst = "const" // SamplerTypeRemote is the type of sampler that polls Jaeger agent for sampling strategy. SamplerTypeRemote = "remote" // SamplerTypeProbabilistic is the type of sampler that samples traces // with a certain fixed probability. SamplerTypeProbabilistic = "probabilistic" // SamplerTypeRateLimiting is the type of sampler that samples // only up to a fixed number of traces per second. SamplerTypeRateLimiting = "ratelimiting" // SamplerTypeLowerBound is the type of sampler that samples // at least a fixed number of traces per second. SamplerTypeLowerBound = "lowerbound" // DefaultUDPSpanServerHost is the default host to send the spans to, via UDP DefaultUDPSpanServerHost = "localhost" // DefaultUDPSpanServerPort is the default port to send the spans to, via UDP DefaultUDPSpanServerPort = 6831 // DefaultSamplingServerPort is the default port to fetch sampling config from, via http DefaultSamplingServerPort = 5778 // DefaultMaxTagValueLength is the default max length of byte array or string allowed in the tag value. DefaultMaxTagValueLength = 256 )
const SpanContextFormat formatKey = iota
SpanContextFormat is a constant used as OpenTracing Format. Requires *SpanContext as carrier. This format is intended for interop with TChannel or other Zipkin-like tracers.
const ZipkinSpanFormat = "zipkin-span-format"
ZipkinSpanFormat is an OpenTracing carrier format constant
Variables ¶
var ( // DefaultSamplingServerURL is the default url to fetch sampling config from, via http DefaultSamplingServerURL = fmt.Sprintf("http://127.0.0.1:%d/sampling", DefaultSamplingServerPort) )
var NullLogger = &nullLogger{}
NullLogger is implementation of the Logger interface that delegates to default `log` package
var ReporterOptions reporterOptions
ReporterOptions is a factory for all available ReporterOption's
var StdLogger = &stdLogger{}
StdLogger is implementation of the Logger interface that delegates to default `log` package
Functions ¶
func BuildJaegerProcessThrift ¶
BuildJaegerProcessThrift creates a thrift Process type. TODO: (breaking change) move to internal package.
func BuildJaegerThrift ¶
BuildJaegerThrift builds jaeger span based on internal span. TODO: (breaking change) move to internal package.
func BuildZipkinThrift ¶
BuildZipkinThrift builds thrift span based on internal span. TODO: (breaking change) move to transport/zipkin and make private.
func ConvertLogsToJaegerTags ¶
ConvertLogsToJaegerTags converts log Fields into jaeger tags.
func EnableFirehose ¶
func EnableFirehose(s *Span)
EnableFirehose enables firehose flag on the span context
func NewTracer ¶
func NewTracer( serviceName string, sampler Sampler, reporter Reporter, options ...TracerOption, ) (opentracing.Tracer, io.Closer)
NewTracer creates Tracer implementation that reports tracing to Jaeger. The returned io.Closer can be used in shutdown hooks to ensure that the internal queue of the Reporter is drained and all buffered spans are submitted to collectors. TODO (breaking change) return *Tracer only, without closer.
func SelfRef ¶
func SelfRef(ctx SpanContext) opentracing.SpanReference
SelfRef creates an opentracing compliant SpanReference from a jaeger SpanContext. This is a factory function in order to encapsulate jaeger specific types.
Types ¶
type AdaptiveSamplerUpdater ¶
AdaptiveSamplerUpdater is used by RemotelyControlledSampler to parse sampling configuration. Fields have the same meaning as in PerOperationSamplerParams.
type BinaryPropagator ¶
type BinaryPropagator struct {
// contains filtered or unexported fields
}
BinaryPropagator is a combined Injector and Extractor for Binary format
func NewBinaryPropagator ¶
func NewBinaryPropagator(tracer *Tracer) *BinaryPropagator
NewBinaryPropagator creates a combined Injector and Extractor for Binary format
func (*BinaryPropagator) Extract ¶
func (p *BinaryPropagator) Extract(abstractCarrier interface{}) (SpanContext, error)
Extract implements Extractor of BinaryPropagator
func (*BinaryPropagator) Inject ¶
func (p *BinaryPropagator) Inject( sc SpanContext, abstractCarrier interface{}, ) error
Inject implements Injector of BinaryPropagator
type ConstSampler ¶
type ConstSampler struct {
Decision bool
// contains filtered or unexported fields
}
ConstSampler is a sampler that always makes the same decision.
func NewConstSampler ¶
func NewConstSampler(sample bool) *ConstSampler
NewConstSampler creates a ConstSampler.
func (*ConstSampler) Equal ¶
func (s *ConstSampler) Equal(other Sampler) bool
Equal implements Equal() of Sampler.
func (*ConstSampler) IsSampled ¶
func (s *ConstSampler) IsSampled(id TraceID, operation string) (bool, []Tag)
IsSampled implements IsSampled() of Sampler.
func (*ConstSampler) OnCreateSpan ¶
func (s *ConstSampler) OnCreateSpan(span *Span) SamplingDecision
func (*ConstSampler) OnFinishSpan ¶
func (s *ConstSampler) OnFinishSpan(span *Span) SamplingDecision
func (*ConstSampler) OnSetOperationName ¶
func (s *ConstSampler) OnSetOperationName(span *Span, operationName string) SamplingDecision
func (*ConstSampler) OnSetTag ¶
func (s *ConstSampler) OnSetTag(span *Span, key string, value interface{}) SamplingDecision
func (*ConstSampler) String ¶
func (s *ConstSampler) String() string
String is used to log sampler details.
type ContribObserver ¶
type ContribObserver interface {
// Create and return a span observer. Called when a span starts.
// If the Observer is not interested in the given span, it must return (nil, false).
// E.g :
// func StartSpan(opName string, opts ...opentracing.StartSpanOption) {
// var sp opentracing.Span
// sso := opentracing.StartSpanOptions{}
// if spanObserver, ok := Observer.OnStartSpan(span, opName, sso); ok {
// // we have a valid SpanObserver
// }
// ...
// }
OnStartSpan(sp opentracing.Span, operationName string, options opentracing.StartSpanOptions) (ContribSpanObserver, bool)
}
ContribObserver can be registered with the Tracer to receive notifications about new Spans. Modelled after github.com/opentracing-contrib/go-observer.
type ContribSpanObserver ¶
type ContribSpanObserver interface {
OnSetOperationName(operationName string)
OnSetTag(key string, value interface{})
OnFinish(options opentracing.FinishOptions)
}
ContribSpanObserver is created by the Observer and receives notifications about other Span events. This interface is meant to match github.com/opentracing-contrib/go-observer, via duck typing, without directly importing the go-observer package.
type ExtractableZipkinSpan ¶
type ExtractableZipkinSpan interface {
TraceID() uint64
SpanID() uint64
ParentID() uint64
Flags() byte
}
ExtractableZipkinSpan is a type of Carrier used for integration with Zipkin-aware RPC frameworks (like TChannel). It does not support baggage, only trace IDs.
type Extractor ¶
type Extractor interface {
// Extract decodes a SpanContext instance from the given `carrier`,
// or (nil, opentracing.ErrSpanContextNotFound) if no context could
// be found in the `carrier`.
Extract(carrier interface{}) (SpanContext, error)
}
Extractor is responsible for extracting SpanContext instances from a format-specific "carrier" object. Typically the extraction will take place on the server side of an RPC boundary, but message queues and other IPC mechanisms are also reasonable places to use an Extractor.
type GuaranteedThroughputProbabilisticSampler ¶
type GuaranteedThroughputProbabilisticSampler struct {
// contains filtered or unexported fields
}
GuaranteedThroughputProbabilisticSampler is a sampler that leverages both ProbabilisticSampler and RateLimitingSampler. The RateLimitingSampler is used as a guaranteed lower bound sampler such that every operation is sampled at least once in a time interval defined by the lowerBound. ie a lowerBound of 1.0 / (60 * 10) will sample an operation at least once every 10 minutes.
The ProbabilisticSampler is given higher priority when tags are emitted, ie. if IsSampled() for both samplers return true, the tags for ProbabilisticSampler will be used.
func NewGuaranteedThroughputProbabilisticSampler ¶
func NewGuaranteedThroughputProbabilisticSampler( lowerBound, samplingRate float64, ) (*GuaranteedThroughputProbabilisticSampler, error)
NewGuaranteedThroughputProbabilisticSampler returns a delegating sampler that applies both ProbabilisticSampler and RateLimitingSampler.
func (*GuaranteedThroughputProbabilisticSampler) Close ¶
func (s *GuaranteedThroughputProbabilisticSampler) Close()
Close implements Close() of Sampler.
func (*GuaranteedThroughputProbabilisticSampler) Equal ¶
func (s *GuaranteedThroughputProbabilisticSampler) Equal(other Sampler) bool
Equal implements Equal() of Sampler.
func (*GuaranteedThroughputProbabilisticSampler) IsSampled ¶
func (s *GuaranteedThroughputProbabilisticSampler) IsSampled(id TraceID, operation string) (bool, []Tag)
IsSampled implements IsSampled() of Sampler.
func (GuaranteedThroughputProbabilisticSampler) String ¶
func (s GuaranteedThroughputProbabilisticSampler) String() string
type HeadersConfig ¶
type HeadersConfig struct {
// JaegerDebugHeader is the name of HTTP header or a TextMap carrier key which,
// if found in the carrier, forces the trace to be sampled as "debug" trace.
// The value of the header is recorded as the tag on the root span, so that the
// trace can be found in the UI using this value as a correlation ID.
JaegerDebugHeader string `yaml:"jaegerDebugHeader"`
// JaegerBaggageHeader is the name of the HTTP header that is used to submit baggage.
// It differs from TraceBaggageHeaderPrefix in that it can be used only in cases where
// a root span does not exist.
JaegerBaggageHeader string `yaml:"jaegerBaggageHeader"`
// TraceContextHeaderName is the http header name used to propagate tracing context.
// This must be in lower-case to avoid mismatches when decoding incoming headers.
TraceContextHeaderName string `yaml:"TraceContextHeaderName"`
// TraceBaggageHeaderPrefix is the prefix for http headers used to propagate baggage.
// This must be in lower-case to avoid mismatches when decoding incoming headers.
TraceBaggageHeaderPrefix string `yaml:"traceBaggageHeaderPrefix"`
}
HeadersConfig contains the values for the header keys that Jaeger will use. These values may be either custom or default depending on whether custom values were provided via a configuration.
func (*HeadersConfig) ApplyDefaults ¶
func (c *HeadersConfig) ApplyDefaults() *HeadersConfig
ApplyDefaults sets missing configuration keys to default values
type InMemoryReporter ¶
type InMemoryReporter struct {
// contains filtered or unexported fields
}
InMemoryReporter is used for testing, and simply collects spans in memory.
func NewInMemoryReporter ¶
func NewInMemoryReporter() *InMemoryReporter
NewInMemoryReporter creates a reporter that stores spans in memory. NOTE: the Tracer should be created with options.PoolSpans = false.
func (*InMemoryReporter) Close ¶
func (r *InMemoryReporter) Close()
Close implements Close() method of Reporter
func (*InMemoryReporter) GetSpans ¶
func (r *InMemoryReporter) GetSpans() []opentracing.Span
GetSpans returns accumulated spans as a copy of the buffer.
func (*InMemoryReporter) Report ¶
func (r *InMemoryReporter) Report(span *Span)
Report implements Report() method of Reporter by storing the span in the buffer.
func (*InMemoryReporter) Reset ¶
func (r *InMemoryReporter) Reset()
Reset clears all accumulated spans.
func (*InMemoryReporter) SpansSubmitted ¶
func (r *InMemoryReporter) SpansSubmitted() int
SpansSubmitted returns the number of spans accumulated in the buffer.
type InjectableZipkinSpan ¶
type InjectableZipkinSpan interface {
SetTraceID(traceID uint64)
SetSpanID(spanID uint64)
SetParentID(parentID uint64)
SetFlags(flags byte)
}
InjectableZipkinSpan is a type of Carrier used for integration with Zipkin-aware RPC frameworks (like TChannel). It does not support baggage, only trace IDs.
type Injector ¶
type Injector interface {
// Inject takes `SpanContext` and injects it into `carrier`. The actual type
// of `carrier` depends on the `format` passed to `Tracer.Inject()`.
//
// Implementations may return opentracing.ErrInvalidCarrier or any other
// implementation-specific error if injection fails.
Inject(ctx SpanContext, carrier interface{}) error
}
Injector is responsible for injecting SpanContext instances in a manner suitable for propagation via a format-specific "carrier" object. Typically the injection will take place across an RPC boundary, but message queues and other IPC mechanisms are also reasonable places to use an Injector.
type Logger ¶
type Logger interface {
// Error logs a message at error priority
Error(msg string)
// Infof logs a message at info priority
Infof(msg string, args ...interface{})
}
Logger provides an abstract interface for logging from Reporters. Applications can provide their own implementation of this interface to adapt reporters logging to whatever logging library they prefer (stdlib log, logrus, go-logging, etc).
type Metrics ¶
type Metrics struct {
// Number of traces started by this tracer as sampled
TracesStartedSampled metrics.Counter `metric:"traces" tags:"state=started,sampled=y" help:"Number of traces started by this tracer as sampled"`
// Number of traces started by this tracer as not sampled
TracesStartedNotSampled metrics.Counter `metric:"traces" tags:"state=started,sampled=n" help:"Number of traces started by this tracer as not sampled"`
// Number of traces started by this tracer with delayed sampling
TracesStartedDelayedSampling metrics.Counter `metric:"traces" tags:"state=started,sampled=n" help:"Number of traces started by this tracer with delayed sampling"`
// Number of externally started sampled traces this tracer joined
TracesJoinedSampled metrics.Counter `metric:"traces" tags:"state=joined,sampled=y" help:"Number of externally started sampled traces this tracer joined"`
// Number of externally started not-sampled traces this tracer joined
TracesJoinedNotSampled metrics.Counter `metric:"traces" tags:"state=joined,sampled=n" help:"Number of externally started not-sampled traces this tracer joined"`
// Number of sampled spans started by this tracer
SpansStartedSampled metrics.Counter `metric:"started_spans" tags:"sampled=y" help:"Number of spans started by this tracer as sampled"`
// Number of not sampled spans started by this tracer
SpansStartedNotSampled metrics.Counter `metric:"started_spans" tags:"sampled=n" help:"Number of spans started by this tracer as not sampled"`
// Number of spans with delayed sampling started by this tracer
SpansStartedDelayedSampling metrics.Counter `metric:"started_spans" tags:"sampled=delayed" help:"Number of spans started by this tracer with delayed sampling"`
// Number of spans finished by this tracer
SpansFinishedSampled metrics.Counter `metric:"finished_spans" tags:"sampled=y" help:"Number of sampled spans finished by this tracer"`
// Number of spans finished by this tracer
SpansFinishedNotSampled metrics.Counter `metric:"finished_spans" tags:"sampled=n" help:"Number of not-sampled spans finished by this tracer"`
// Number of spans finished by this tracer
SpansFinishedDelayedSampling metrics.Counter `metric:"finished_spans" tags:"sampled=delayed" help:"Number of spans with delayed sampling finished by this tracer"`
// Number of errors decoding tracing context
DecodingErrors metrics.Counter `metric:"span_context_decoding_errors" help:"Number of errors decoding tracing context"`
// Number of spans successfully reported
ReporterSuccess metrics.Counter `metric:"reporter_spans" tags:"result=ok" help:"Number of spans successfully reported"`
// Number of spans not reported due to a Sender failure
ReporterFailure metrics.Counter `metric:"reporter_spans" tags:"result=err" help:"Number of spans not reported due to a Sender failure"`
// Number of spans dropped due to internal queue overflow
ReporterDropped metrics.Counter `metric:"reporter_spans" tags:"result=dropped" help:"Number of spans dropped due to internal queue overflow"`
// Current number of spans in the reporter queue
ReporterQueueLength metrics.Gauge `metric:"reporter_queue_length" help:"Current number of spans in the reporter queue"`
// Number of times the Sampler succeeded to retrieve sampling strategy
SamplerRetrieved metrics.Counter `metric:"sampler_queries" tags:"result=ok" help:"Number of times the Sampler succeeded to retrieve sampling strategy"`
// Number of times the Sampler failed to retrieve sampling strategy
SamplerQueryFailure metrics.Counter `metric:"sampler_queries" tags:"result=err" help:"Number of times the Sampler failed to retrieve sampling strategy"`
// Number of times the Sampler succeeded to retrieve and update sampling strategy
SamplerUpdated metrics.Counter `` /* 127-byte string literal not displayed */
// Number of times the Sampler failed to update sampling strategy
SamplerUpdateFailure metrics.Counter `metric:"sampler_updates" tags:"result=err" help:"Number of times the Sampler failed to update sampling strategy"`
// Number of times baggage was successfully written or updated on spans.
BaggageUpdateSuccess metrics.Counter `metric:"baggage_updates" tags:"result=ok" help:"Number of times baggage was successfully written or updated on spans"`
// Number of times baggage failed to write or update on spans.
BaggageUpdateFailure metrics.Counter `metric:"baggage_updates" tags:"result=err" help:"Number of times baggage failed to write or update on spans"`
// Number of times baggage was truncated as per baggage restrictions.
BaggageTruncate metrics.Counter `metric:"baggage_truncations" help:"Number of times baggage was truncated as per baggage restrictions"`
// Number of times baggage restrictions were successfully updated.
BaggageRestrictionsUpdateSuccess metrics.Counter `metric:"baggage_restrictions_updates" tags:"result=ok" help:"Number of times baggage restrictions were successfully updated"`
// Number of times baggage restrictions failed to update.
BaggageRestrictionsUpdateFailure metrics.Counter `metric:"baggage_restrictions_updates" tags:"result=err" help:"Number of times baggage restrictions failed to update"`
// Number of times debug spans were throttled.
ThrottledDebugSpans metrics.Counter `metric:"throttled_debug_spans" help:"Number of times debug spans were throttled"`
// Number of times throttler successfully updated.
ThrottlerUpdateSuccess metrics.Counter `metric:"throttler_updates" tags:"result=ok" help:"Number of times throttler successfully updated"`
// Number of times throttler failed to update.
ThrottlerUpdateFailure metrics.Counter `metric:"throttler_updates" tags:"result=err" help:"Number of times throttler failed to update"`
}
Metrics is a container of all stats emitted by Jaeger tracer.
func NewMetrics ¶
NewMetrics creates a new Metrics struct and initializes it.
func NewNullMetrics ¶
func NewNullMetrics() *Metrics
NewNullMetrics creates a new Metrics struct that won't report any metrics.
type Observer
deprecated
type Observer interface {
OnStartSpan(operationName string, options opentracing.StartSpanOptions) SpanObserver
}
Observer can be registered with the Tracer to receive notifications about new Spans.
Deprecated: use jaeger.ContribObserver instead.
type PerOperationSampler ¶
PerOperationSampler is a delegating sampler that applies GuaranteedThroughputProbabilisticSampler on a per-operation basis.
func NewAdaptiveSampler ¶
func NewAdaptiveSampler(strategies *sampling.PerOperationSamplingStrategies, maxOperations int) (*PerOperationSampler, error)
NewAdaptiveSampler returns a new PerOperationSampler. Deprecated: please use NewPerOperationSampler.
func NewPerOperationSampler ¶
func NewPerOperationSampler(params PerOperationSamplerParams) *PerOperationSampler
NewPerOperationSampler returns a new PerOperationSampler.
func (*PerOperationSampler) Close ¶
func (s *PerOperationSampler) Close()
Close invokes Close on all underlying samplers.
func (*PerOperationSampler) Equal ¶
func (s *PerOperationSampler) Equal(other Sampler) bool
Equal is not used. TODO (breaking change) remove this in the future
func (*PerOperationSampler) IsSampled ¶
func (s *PerOperationSampler) IsSampled(id TraceID, operation string) (bool, []Tag)
IsSampled is not used and only exists to match Sampler V1 API. TODO (breaking change) remove when upgrading everything to SamplerV2
func (*PerOperationSampler) OnCreateSpan ¶
func (s *PerOperationSampler) OnCreateSpan(span *Span) SamplingDecision
OnCreateSpan implements OnCreateSpan of SamplerV2.
func (*PerOperationSampler) OnFinishSpan ¶
func (s *PerOperationSampler) OnFinishSpan(span *Span) SamplingDecision
OnFinishSpan implements OnFinishSpan of SamplerV2.
func (*PerOperationSampler) OnSetOperationName ¶
func (s *PerOperationSampler) OnSetOperationName(span *Span, operationName