jaeger

package
Version: v1.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2017 License: Apache-2.0, MIT Imports: 26 Imported by: 0

Documentation

Overview

Package jaeger implements an OpenTracing (http://opentracing.io) Tracer. It is currently using Zipkin-compatible data model and can be directly itegrated with Zipkin backend (http://zipkin.io).

For integration instructions please refer to the README:

https://github.com/uber/jaeger-client-go/blob/master/README.md

Index

Constants

View Source
const (
	// JaegerClientVersion is the version of the client library reported as Span tag.
	JaegerClientVersion = "Go-2.8.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"

	// 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"

	// TracerStateHeaderName is the http header name used to propagate tracing context.
	// This must be in lower-case to avoid mismatches when decoding incoming headers.
	TracerStateHeaderName = "uber-trace-id"

	// 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
	// only up to a fixed number of traces per second.
	SamplerTypeLowerBound = "lowerbound"
)
View Source
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.

View Source
const ZipkinSpanFormat = "zipkin-span-format"

ZipkinSpanFormat is an OpenTracing carrier format constant

Variables

View Source
var NullLogger = &nullLogger{}

NullLogger is implementation of the Logger interface that delegates to default `log` package

View Source
var ReporterOptions reporterOptions

ReporterOptions is a factory for all available ReporterOption's

View Source
var SamplerOptions samplerOptions

SamplerOptions is a factory for all available SamplerOption's

View Source
var StdLogger = &stdLogger{}

StdLogger is implementation of the Logger interface that delegates to default `log` package

View Source
var TracerOptions tracerOptions

TracerOptions is a factory for all available TracerOption's

Functions

func BuildJaegerProcessThrift

func BuildJaegerProcessThrift(span *Span) *j.Process

BuildJaegerProcessThrift creates a thrift Process type.

func BuildJaegerThrift

func BuildJaegerThrift(span *Span) *j.Span

BuildJaegerThrift builds jaeger span based on internal span.

func BuildZipkinThrift

func BuildZipkinThrift(s *Span) *z.Span

BuildZipkinThrift builds thrift span based on internal span.

func ConvertLogsToJaegerTags

func ConvertLogsToJaegerTags(logFields []log.Field) []*j.Tag

ConvertLogsToJaegerTags converts log Fields into jaeger tags.

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.

Types

type ConstSampler

type ConstSampler struct {
	Decision bool
	// contains filtered or unexported fields
}

ConstSampler is a sampler that always makes the same decision.

func (*ConstSampler) Close

func (s *ConstSampler) Close()

Close implements Close() of Sampler.

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.

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

Close implements Close() of Sampler.

func (*GuaranteedThroughputProbabilisticSampler) Equal

Equal implements Equal() of Sampler.

func (*GuaranteedThroughputProbabilisticSampler) IsSampled

func (s *GuaranteedThroughputProbabilisticSampler) IsSampled(id TraceID, operation string) (bool, []Tag)

IsSampled implements IsSampled() of Sampler.

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 by doing nothing.

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"`

	// Number of traces started by this tracer as not sampled
	TracesStartedNotSampled metrics.Counter `metric:"traces" tags:"state=started,sampled=n"`

	// Number of externally started sampled traces this tracer joined
	TracesJoinedSampled metrics.Counter `metric:"traces" tags:"state=joined,sampled=y"`

	// Number of externally started not-sampled traces this tracer joined
	TracesJoinedNotSampled metrics.Counter `metric:"traces" tags:"state=joined,sampled=n"`

	// Number of sampled spans started by this tracer
	SpansStarted metrics.Counter `metric:"spans" tags:"group=lifecycle,state=started"`

	// Number of sampled spans finished by this tracer
	SpansFinished metrics.Counter `metric:"spans" tags:"group=lifecycle,state=finished"`

	// Number of sampled spans started by this tracer
	SpansSampled metrics.Counter `metric:"spans" tags:"group=sampling,sampled=y"`

	// Number of not-sampled spans started by this tracer
	SpansNotSampled metrics.Counter `metric:"spans" tags:"group=sampling,sampled=n"`

	// Number of errors decoding tracing context
	DecodingErrors metrics.Counter `metric:"decoding-errors"`

	// Number of spans successfully reported
	ReporterSuccess metrics.Counter `metric:"reporter-spans" tags:"state=success"`

	// Number of spans in failed attempts to report
	ReporterFailure metrics.Counter `metric:"reporter-spans" tags:"state=failure"`

	// Number of spans dropped due to internal queue overflow
	ReporterDropped metrics.Counter `metric:"reporter-spans" tags:"state=dropped"`

	// Current number of spans in the reporter queue
	ReporterQueueLength metrics.Gauge `metric:"reporter-queue"`

	// Number of times the Sampler succeeded to retrieve sampling strategy
	SamplerRetrieved metrics.Counter `metric:"sampler" tags:"state=retrieved"`

	// Number of times the Sampler succeeded to retrieve and update sampling strategy
	SamplerUpdated metrics.Counter `metric:"sampler" tags:"state=updated"`

	// Number of times the Sampler failed to update sampling strategy
	SamplerUpdateFailure metrics.Counter `metric:"sampler" tags:"state=failure,phase=updating"`

	// Number of times the Sampler failed to retrieve sampling strategy
	SamplerQueryFailure metrics.Counter `metric:"sampler" tags:"state=failure,phase=query"`
}

Metrics is a container of all stats emitted by Jaeger tracer.

func NewMetrics

func NewMetrics(factory metrics.Factory, globalTags map[string]string) *Metrics

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

type Observer interface {
	OnStartSpan(operationName string, options opentracing.StartSpanOptions) SpanObserver
}

Observer can be registered with the Tracer to receive notifications about new Spans.

type ProbabilisticSampler

type ProbabilisticSampler struct {
	// contains filtered or unexported fields
}

ProbabilisticSampler is a sampler that randomly samples a certain percentage of traces.

func NewProbabilisticSampler

func NewProbabilisticSampler(samplingRate float64) (*ProbabilisticSampler, error)

NewProbabilisticSampler creates a sampler that randomly samples a certain percentage of traces specified by the samplingRate, in the range between 0.0 and 1.0.

It relies on the fact that new trace IDs are 63bit random numbers themselves, thus making the sampling decision without generating a new random number, but simply calculating if traceID < (samplingRate * 2^63). TODO remove the error from this function for next major release

func (*ProbabilisticSampler) Close

func (s *ProbabilisticSampler) Close()

Close implements Close() of Sampler.

func (*ProbabilisticSampler) Equal

func (s *ProbabilisticSampler) Equal(other Sampler) bool

Equal implements Equal() of Sampler.

func (*ProbabilisticSampler) IsSampled

func (s *ProbabilisticSampler) IsSampled(id TraceID, operation string) (bool, []Tag)

IsSampled implements IsSampled() of Sampler.

func (*ProbabilisticSampler) SamplingRate

func (s *ProbabilisticSampler) SamplingRate() float64

SamplingRate returns the sampling probability this sampled was constructed with.

type Reference

type Reference struct {
	Type    opentracing.SpanReferenceType
	Context SpanContext
}

Reference represents a causal reference to other Spans (via their SpanContext).

type RemotelyControlledSampler

type RemotelyControlledSampler struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

RemotelyControlledSampler is a delegating sampler that polls a remote server for the appropriate sampling strategy, constructs a corresponding sampler and delegates to it for sampling decisions.

func NewRemotelyControlledSampler

func NewRemotelyControlledSampler(
	serviceName string,
	opts ...SamplerOption,
) *RemotelyControlledSampler

NewRemotelyControlledSampler creates a sampler that periodically pulls the sampling strategy from an HTTP sampling server (e.g. jaeger-agent).

func (*RemotelyControlledSampler) Close

func (s *RemotelyControlledSampler) Close()

Close implements Close() of Sampler.

func (*RemotelyControlledSampler) Equal

func (s *RemotelyControlledSampler) Equal(other Sampler) bool

Equal implements Equal() of Sampler.

func (RemotelyControlledSampler) InitialSampler

func (RemotelyControlledSampler) InitialSampler(sampler Sampler) SamplerOption

InitialSampler creates a SamplerOption that sets the initial sampler to use before a remote sampler is created and used.

func (*RemotelyControlledSampler) IsSampled

func (s *RemotelyControlledSampler) IsSampled(id TraceID, operation string) (bool, []Tag)

IsSampled implements IsSampled() of Sampler.

func (RemotelyControlledSampler) Logger

func (RemotelyControlledSampler) Logger(logger Logger) SamplerOption

Logger creates a SamplerOption that sets the logger used by the sampler.

func (RemotelyControlledSampler) MaxOperations

func (RemotelyControlledSampler) MaxOperations(maxOperations int) SamplerOption

MaxOperations creates a SamplerOption that sets the maximum number of operations the sampler will keep track of.

func (RemotelyControlledSampler) Metrics

func (RemotelyControlledSampler) Metrics(m *Metrics) SamplerOption

Metrics creates a SamplerOption that initializes Metrics on the sampler, which is used to emit statistics.

func (RemotelyControlledSampler) SamplingRefreshInterval

func (RemotelyControlledSampler) SamplingRefreshInterval(samplingRefreshInterval time.Duration) SamplerOption

SamplingRefreshInterval creates a SamplerOption that sets how often the sampler will poll local agent for the appropriate sampling strategy.

func (RemotelyControlledSampler) SamplingServerURL

func (RemotelyControlledSampler) SamplingServerURL(samplingServerURL string) SamplerOption

SamplingServerURL creates a SamplerOption that sets the sampling server url of the local agent that contains the sampling strategies.

type Reporter

type Reporter interface {
	// Report submits a new span to collectors, possibly asynchronously and/or with buffering.
	Report(span *Span)

	// Close does a clean shutdown of the reporter, flushing any traces that may be buffered in memory.
	Close()
}

Reporter is called by the tracer when a span is completed to report the span to the tracing collector.

func NewCompositeReporter

func NewCompositeReporter(reporters ...Reporter) Reporter

NewCompositeReporter creates a reporter that ignores all reported spans.

func NewLoggingReporter

func NewLoggingReporter(logger Logger) Reporter

NewLoggingReporter creates a reporter that logs all reported spans to provided logger.

func NewNullReporter

func NewNullReporter() Reporter

NewNullReporter creates a no-op reporter that ignores all reported spans.

func NewRemoteReporter

func NewRemoteReporter(sender Transport, opts ...ReporterOption) Reporter

NewRemoteReporter creates a new reporter that sends spans out of process by means of Sender

type ReporterOption

type ReporterOption func(c *reporterOptions)

ReporterOption is a function that sets some option on the reporter.

type Sampler

type Sampler interface {
	// IsSampled decides whether a trace with given `id` and `operation`
	// should be sampled. This function will also return the tags that
	// can be used to identify the type of sampling that was applied to
	// the root span. Most simple samplers would return two tags,
	// sampler.type and sampler.param, similar to those used in the Configuration
	IsSampled(id TraceID, operation string) (sampled bool, tags []Tag)

	// Close does a clean shutdown of the sampler, stopping any background
	// go-routines it may have started.
	Close()

	// Equal checks if the `other` sampler is functionally equivalent
	// to this sampler.
	// TODO remove this function. This function is used to determine if 2 samplers are equivalent
	// which does not bode well with the adaptive sampler which has to create all the composite samplers
	// for the comparison to occur. This is expensive to do if only one sampler has changed.
	Equal(other Sampler) bool
}

Sampler decides whether a new trace should be sampled or not.

func NewAdaptiveSampler

func NewAdaptiveSampler(strategies *sampling.PerOperationSamplingStrategies, maxOperations int) (Sampler, error)

NewAdaptiveSampler returns a delegating sampler that applies both probabilisticSampler and rateLimitingSampler via the guaranteedThroughputProbabilisticSampler. This sampler keeps track of all operations and delegates calls to the respective guaranteedThroughputProbabilisticSampler.

func NewConstSampler

func NewConstSampler(sample bool) Sampler

NewConstSampler creates a ConstSampler.

func NewRateLimitingSampler

func NewRateLimitingSampler(maxTracesPerSecond float64) Sampler

NewRateLimitingSampler creates a sampler that samples at most maxTracesPerSecond. The distribution of sampled traces follows burstiness of the service, i.e. a service with uniformly distributed requests will have those requests sampled uniformly as well, but if requests are bursty, especially sub-second, then a number of sequential requests can be sampled each second.

type SamplerOption

type SamplerOption func(options *samplerOptions)

SamplerOption is a function that sets some option on the sampler

type Span

type Span struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Span implements opentracing.Span

func (*Span) BaggageItem

func (s *Span) BaggageItem(key string) string

BaggageItem implements BaggageItem() of opentracing.SpanContext

func (*Span) Context

func (s *Span) Context() opentracing.SpanContext

Context implements opentracing.Span API

func (*Span) Finish

func (s *Span) Finish()

Finish implements opentracing.Span API

func (*Span) FinishWithOptions

func (s *Span) FinishWithOptions(options opentracing.FinishOptions)

FinishWithOptions implements opentracing.Span API

func (*Span) Log

func (s *Span) Log(ld opentracing.LogData)

Log implements opentracing.Span API

func (*Span) LogEvent

func (s *Span) LogEvent(event string)

LogEvent implements opentracing.Span API

func (*Span) LogEventWithPayload

func (s *Span) LogEventWithPayload(event string, payload interface{})

LogEventWithPayload implements opentracing.Span API

func (*Span) LogFields

func (s *Span) LogFields(fields ...log.Field)

LogFields implements opentracing.Span API

func (*Span) LogKV

func (s *Span) LogKV(alternatingKeyValues ...interface{})

LogKV implements opentracing.Span API

func (*Span) OperationName

func (s *Span) OperationName() string

OperationName allows retrieving current operation name.

func (*Span) SetBaggageItem

func (s *Span) SetBaggageItem(key, value string) opentracing.Span

SetBaggageItem implements SetBaggageItem() of opentracing.SpanContext

func (*Span) SetOperationName

func (s *Span) SetOperationName(operationName string) opentracing.Span

SetOperationName sets or changes the operation name.

func (*Span) SetTag

func (s *Span) SetTag(key string, value interface{}) opentracing.Span

SetTag implements SetTag() of opentracing.Span

func (*Span) String

func (s *Span) String() string

func (*Span) Tracer

func (s *Span) Tracer() opentracing.Tracer

Tracer implements opentracing.Span API

type SpanContext

type SpanContext struct {
	// contains filtered or unexported fields
}

SpanContext represents propagated span identity and state

func ContextFromString

func ContextFromString(value string) (SpanContext, error)

ContextFromString reconstructs the Context encoded in a string

func NewSpanContext

func NewSpanContext(traceID TraceID, spanID, parentID SpanID, sampled bool, baggage map[string]string) SpanContext

NewSpanContext creates a new instance of SpanContext

func (*SpanContext) CopyFrom

func (c *SpanContext) CopyFrom(ctx *SpanContext)

CopyFrom copies data from ctx into this context, including span identity and baggage. TODO This is only used by interop.go. Remove once TChannel Go supports OpenTracing.

func (SpanContext) ForeachBaggageItem

func (c SpanContext) ForeachBaggageItem(handler func(k, v string) bool)

ForeachBaggageItem implements ForeachBaggageItem() of opentracing.SpanContext

func (SpanContext) IsDebug

func (c SpanContext) IsDebug() bool

IsDebug indicates whether sampling was explicitly requested by the service.

func (SpanContext) IsSampled

func (c SpanContext) IsSampled() bool

IsSampled returns whether this trace was chosen for permanent storage by the sampling mechanism of the tracer.

func (SpanContext) IsValid

func (c SpanContext) IsValid() bool

IsValid indicates whether this context actually represents a valid trace.

func (SpanContext) ParentID

func (c SpanContext) ParentID() SpanID

ParentID returns the parent span ID of this span context

func (SpanContext) SpanID

func (c SpanContext) SpanID() SpanID

SpanID returns the span ID of this span context

func (SpanContext) String

func (c SpanContext) String() string

func (SpanContext) TraceID

func (c SpanContext) TraceID() TraceID

TraceID returns the trace ID of this span context

func (SpanContext) WithBaggageItem

func (c SpanContext) WithBaggageItem(key, value string) SpanContext

WithBaggageItem creates a new context with an extra baggage item.

type SpanID

type SpanID uint64

SpanID represents unique 64bit identifier of a span

func SpanIDFromString

func SpanIDFromString(s string) (SpanID, error)

SpanIDFromString creates a SpanID from a hexadecimal string

func (SpanID) String

func (s SpanID) String() string

type SpanObserver

type SpanObserver interface {
	OnSetOperationName(operationName string)
	OnSetTag(key string, value interface{})
	OnFinish(options opentracing.FinishOptions)
}

SpanObserver is created by the Observer and receives notifications about other Span events.

type Tag

type Tag struct {
	// contains filtered or unexported fields
}

Tag is a simple key value wrapper. TODO deprecate in the next major release, use opentracing.Tag instead.

type TraceID

type TraceID struct {
	High, Low uint64
}

TraceID represents unique 128bit identifier of a trace

func TraceIDFromString

func TraceIDFromString(s string) (TraceID, error)

TraceIDFromString creates a TraceID from a hexadecimal string

func (TraceID) IsValid

func (t TraceID) IsValid() bool

IsValid checks if the trace ID is valid, i.e. not zero.

func (TraceID) String

func (t TraceID) String() string

type Tracer

type Tracer struct {
	// contains filtered or unexported fields
}

Tracer implements opentracing.Tracer.

func (*Tracer) Close

func (t *Tracer) Close() error

Close releases all resources used by the Tracer and flushes any remaining buffered spans.

func (*Tracer) Extract

func (t *Tracer) Extract(
	format interface{},
	carrier interface{},
) (opentracing.SpanContext, error)

Extract implements Extract() method of opentracing.Tracer

func (*Tracer) Inject

func (t *Tracer) Inject(ctx opentracing.SpanContext, format interface{}, carrier interface{}) error

Inject implements Inject() method of opentracing.Tracer

func (*Tracer) StartSpan

func (t *Tracer) StartSpan(
	operationName string,
	options ...opentracing.StartSpanOption,
) opentracing.Span

StartSpan implements StartSpan() method of opentracing.Tracer.

func (*Tracer) Tags

func (t *Tracer) Tags() []opentracing.Tag

Tags returns a slice of tracer-level tags.

type TracerOption

type TracerOption func(tracer *Tracer)

TracerOption is a function that sets some option on the tracer

type Transport

type Transport interface {
	// Append converts the span to the wire representation and adds it
	// to sender's internal buffer.  If the buffer exceeds its designated
	// size, the transport should call Flush() and return the number of spans
	// flushed, otherwise return 0. If error is returned, the returned number
	// of spans is treated as failed span, and reported to metrics accordingly.
	Append(span *Span) (int, error)

	// Flush submits the internal buffer to the remote server. It returns the
	// number of spans flushed. If error is returned, the returned number of
	// spans is treated as failed span, and reported to metrics accordingly.
	Flush() (int, error)

	io.Closer
}

Transport abstracts the method of sending spans out of process. Implementations are NOT required to be thread-safe; the RemoteReporter is expected to only call methods on the Transport from the same go-routine.

func NewUDPTransport

func NewUDPTransport(hostPort string, maxPacketSize int) (Transport, error)

NewUDPTransport creates a reporter that submits spans to jaeger-agent

Directories

Path Synopsis
Package rpcmetrics implements an Observer that can be used to emit RPC metrics.
Package rpcmetrics implements an Observer that can be used to emit RPC metrics.
thrift-gen
internal

Jump to

Keyboard shortcuts

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