Documentation ¶
Index ¶
- Constants
- Variables
- func AddFlags(flags *flag.FlagSet)
- func ContextFromString(context *SpanContext, value string) error
- func HexToUint64(value string) (uint64, error)
- type AdaptiveSampler
- type BinaryPropagator
- type ConstSampler
- type DynamicSampler
- type Extractor
- type Factory
- type HttpHeadersPropagator
- type Injector
- type Operation
- type Options
- type PerOperationSampler
- type ProbabilitySampler
- type Process
- type RateLimitingSampler
- type RemoteReporterParams
- type RemoteSampler
- type RemoteSamplerParams
- type Reporter
- type Sampler
- func NewAdaptiveSampler(samplingRate float64) Sampler
- func NewConstSampler(decision bool) Sampler
- func NewDynamicSampler(samplingRate float64) Sampler
- func NewProbabilitySampler(samplingRate float64) Sampler
- func NewRateLimitingSampler(maxTracesPerSecond float64) Sampler
- func NewRemoteSampler(params *RemoteSamplerParams) Sampler
- type SamplerUpdater
- type SamplingDecision
- type SamplingStrategyFetcher
- type Span
- func (s *Span) BaggageItem(restrictedKey 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) IsIngress() bool
- func (s *Span) Log(data 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) SetBaggageItem(restrictedKey, 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) Tags() []opentracing.Tag
- func (s *Span) Tracer() opentracing.Tracer
- type SpanContext
- type SpanID
- type Throughput
- type TraceID
- type Tracer
- type TracerParams
- type Transport
- type TransportParams
Constants ¶
const ( DefaultPullStrategiesInterval = time.Second * 10 DefaultReporterType = "remote" DefaultAgentAddr = "localhost" DefaultAgentPort = ports.AgentGrpcListenPort DefaultBufferRefreshInterval = time.Second * 1 DefaultQueueSize = 100 DefaultMaxBufferedSize = 65000 )
flags.go
const ( ReporterType_Null = "null" ReporterType_Logging = "logging" ReporterType_Remote = "remote" )
reporter.go
const ( SamplerTypeKey = "sampler.type" SamplerParamKey = "sampler.param" SamplerTypeConst = "const" SamplerTypeDynamic = "dynamic" SamplerTypeAdaptive = "adaptive" SamplerTypeProbability = "probability" SamplerTypeRateLimiting = "rate-limiting" )
sampler.go
const ( BaggageServiceNameKey = "svc" BaggageOperationNameKey = "op" ParentServiceNameTagKey = "p-svc" ParentOperationNameTagKey = "p-op" )
tracer.go
const ( TraceContextHeaderName = "houyi-tx-ctx" TraceBaggageHeaderPrefix = "houyi-" )
propagation.go
Variables ¶
var ( ErrEmptyContextString = fmt.Errorf("context string can not be empty") ErrInvalidFormatContext = fmt.Errorf("split parts of context string should be length 5") )
Functions ¶
func ContextFromString ¶ added in v1.0.0
func ContextFromString(context *SpanContext, value string) error
ContextFromString reconstructs the Context encoded in a string
func HexToUint64 ¶ added in v1.0.0
HexToUint64 converts a hexadecimal string to it's actual value of type uint64.
Types ¶
type AdaptiveSampler ¶ added in v1.6.0
type AdaptiveSampler struct {
ProbabilitySampler
}
func (*AdaptiveSampler) OnCreateSpan ¶ added in v1.6.0
func (s *AdaptiveSampler) OnCreateSpan(span *Span) SamplingDecision
type BinaryPropagator ¶ added in v1.0.0
type BinaryPropagator struct {
// contains filtered or unexported fields
}
func (*BinaryPropagator) Extract ¶ added in v1.0.0
func (p *BinaryPropagator) Extract(carrier interface{}) (SpanContext, error)
func (*BinaryPropagator) Inject ¶ added in v1.0.0
func (p *BinaryPropagator) Inject(ctx SpanContext, carrier interface{}) error
type ConstSampler ¶ added in v1.0.0
type ConstSampler struct {
// contains filtered or unexported fields
}
ConstSampler
func (*ConstSampler) Close ¶ added in v1.0.0
func (s *ConstSampler) Close() error
func (*ConstSampler) IsSampled ¶ added in v1.0.0
func (s *ConstSampler) IsSampled(span *Span) (bool, []opentracing.Tag)
func (*ConstSampler) OnCreateSpan ¶ added in v1.0.0
func (s *ConstSampler) OnCreateSpan(_ *Span) SamplingDecision
func (*ConstSampler) String ¶ added in v1.0.0
func (s *ConstSampler) String() string
type DynamicSampler ¶ added in v1.6.0
type DynamicSampler struct {
ProbabilitySampler
}
func (*DynamicSampler) OnCreateSpan ¶ added in v1.6.0
func (s *DynamicSampler) OnCreateSpan(span *Span) SamplingDecision
type Extractor ¶ added in v1.0.0
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 Factory ¶
type Factory interface { InitFromViper(*viper.Viper) CreateTracer(serviceName string, logger *zap.Logger) (opentracing.Tracer, io.Closer) }
func NewTracerFactory ¶ added in v1.1.0
func NewTracerFactory() Factory
type HttpHeadersPropagator ¶ added in v1.0.0
type HttpHeadersPropagator struct{}
func (*HttpHeadersPropagator) Extract ¶ added in v1.0.0
func (p *HttpHeadersPropagator) Extract(carrier interface{}) (SpanContext, error)
func (*HttpHeadersPropagator) Inject ¶ added in v1.0.0
func (p *HttpHeadersPropagator) Inject(ctx SpanContext, carrier interface{}) error
type Injector ¶ added in v1.0.0
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 Operation ¶ added in v1.0.0
type Options ¶
type PerOperationSampler ¶ added in v1.0.0
type PerOperationSampler struct {
// contains filtered or unexported fields
}
PerOperationSampler
func (*PerOperationSampler) Close ¶ added in v1.0.0
func (s *PerOperationSampler) Close() error
func (*PerOperationSampler) IsSampled ¶ added in v1.0.0
func (s *PerOperationSampler) IsSampled(span *Span) (bool, []opentracing.Tag)
func (*PerOperationSampler) OnCreateSpan ¶ added in v1.0.0
func (s *PerOperationSampler) OnCreateSpan(span *Span) SamplingDecision
func (*PerOperationSampler) String ¶ added in v1.0.0
func (s *PerOperationSampler) String() string
type ProbabilitySampler ¶ added in v1.0.0
type ProbabilitySampler struct {
// contains filtered or unexported fields
}
ProbabilitySampler
func (*ProbabilitySampler) Close ¶ added in v1.0.0
func (s *ProbabilitySampler) Close() error
func (*ProbabilitySampler) IsSampled ¶ added in v1.0.0
func (s *ProbabilitySampler) IsSampled(span *Span) (bool, []opentracing.Tag)
func (*ProbabilitySampler) OnCreateSpan ¶ added in v1.0.0
func (s *ProbabilitySampler) OnCreateSpan(span *Span) SamplingDecision
func (*ProbabilitySampler) String ¶ added in v1.0.0
func (s *ProbabilitySampler) String() string
type RateLimitingSampler ¶ added in v1.0.0
type RateLimitingSampler struct {
// contains filtered or unexported fields
}
RateLimitingSampler
func (*RateLimitingSampler) Close ¶ added in v1.0.0
func (s *RateLimitingSampler) Close() error
func (*RateLimitingSampler) IsSampled ¶ added in v1.0.0
func (s *RateLimitingSampler) IsSampled(span *Span) (bool, []opentracing.Tag)
func (*RateLimitingSampler) OnCreateSpan ¶ added in v1.0.0
func (s *RateLimitingSampler) OnCreateSpan(_ *Span) SamplingDecision
func (*RateLimitingSampler) String ¶ added in v1.0.0
func (s *RateLimitingSampler) String() string
type RemoteReporterParams ¶ added in v1.1.0
type RemoteSampler ¶ added in v1.0.0
RemoteSampler implements a type of sampler that pulls sampling strategies from remote strategy manger.
func (*RemoteSampler) Close ¶ added in v1.0.0
func (s *RemoteSampler) Close() error
func (*RemoteSampler) IsSampled ¶ added in v1.0.0
func (s *RemoteSampler) IsSampled(span *Span) (bool, []opentracing.Tag)
func (*RemoteSampler) OnCreateSpan ¶ added in v1.0.0
func (s *RemoteSampler) OnCreateSpan(span *Span) SamplingDecision
func (*RemoteSampler) String ¶ added in v1.0.0
func (s *RemoteSampler) String() string
type RemoteSamplerParams ¶ added in v1.0.0
type Reporter ¶ added in v1.0.0
func NewLogReporter ¶ added in v1.0.0
func NewNullReporter ¶ added in v1.0.0
func NewNullReporter() Reporter
func NewRemoteReporter ¶ added in v1.0.0
func NewRemoteReporter(params *RemoteReporterParams) Reporter
type Sampler ¶ added in v1.0.0
type Sampler interface { OnCreateSpan(span *Span) SamplingDecision IsSampled(span *Span) (bool, []opentracing.Tag) fmt.Stringer io.Closer }
func NewAdaptiveSampler ¶ added in v1.6.0
func NewConstSampler ¶ added in v1.0.0
func NewDynamicSampler ¶ added in v1.6.0
func NewProbabilitySampler ¶ added in v1.0.0
func NewRateLimitingSampler ¶ added in v1.0.0
func NewRemoteSampler ¶ added in v1.0.0
func NewRemoteSampler(params *RemoteSamplerParams) Sampler
type SamplerUpdater ¶ added in v1.0.0
type SamplerUpdater interface {
Update(sampler *RemoteSampler, strategies *api_v1.StrategiesResponse) error
}
func NewSamplerUpdater ¶ added in v1.6.0
func NewSamplerUpdater(logger *zap.Logger) SamplerUpdater
type SamplingDecision ¶ added in v1.0.0
type SamplingDecision struct { Sampled bool Tag []opentracing.Tag }
type SamplingStrategyFetcher ¶ added in v1.0.0
type SamplingStrategyFetcher interface {
Fetch(service string, operations []Operation) (*api_v1.StrategiesResponse, error)
}
func NewSamplingStrategyFetcher ¶ added in v1.0.0
func NewSamplingStrategyFetcher(agentEp routing.Endpoint) SamplingStrategyFetcher
type Span ¶ added in v1.0.0
type Span struct {
// contains filtered or unexported fields
}
func (*Span) BaggageItem ¶ added in v1.0.0
func (*Span) FinishWithOptions ¶ added in v1.0.0
func (s *Span) FinishWithOptions(options opentracing.FinishOptions)
func (*Span) LogEventWithPayload ¶ added in v1.0.0
func (*Span) OperationName ¶ added in v1.0.0
func (*Span) References ¶ added in v1.0.0
func (s *Span) References() []opentracing.SpanReference
func (*Span) SetBaggageItem ¶ added in v1.0.0
func (*Span) SetOperationName ¶ added in v1.0.0
func (*Span) SpanContext ¶ added in v1.0.0
func (s *Span) SpanContext() SpanContext
type SpanContext ¶ added in v1.0.0
type SpanContext struct {
// contains filtered or unexported fields
}
func NewSpanContext ¶ added in v1.0.0
func (SpanContext) ForeachBaggageItem ¶ added in v1.0.0
func (s SpanContext) ForeachBaggageItem(handler func(k string, v string) bool)
func (SpanContext) IsSampled ¶ added in v1.0.0
func (s SpanContext) IsSampled() bool
func (SpanContext) ParentID ¶ added in v1.0.0
func (s SpanContext) ParentID() SpanID
func (SpanContext) SpanID ¶ added in v1.0.0
func (s SpanContext) SpanID() SpanID
func (SpanContext) String ¶ added in v1.0.0
func (s SpanContext) String() string
func (SpanContext) TraceID ¶ added in v1.0.0
func (s SpanContext) TraceID() TraceID
type Throughput ¶ added in v1.0.0
type Tracer ¶ added in v1.0.0
func NewTracer ¶ added in v1.0.0
func NewTracer(serviceName string, params *TracerParams) Tracer
type TracerParams ¶ added in v1.0.0
type Transport ¶ added in v1.0.0
type Transport interface { // Append appends a span into transport but the span would not be reported to agent until // cache is full. Append(span *Span) (int, error) // Flush would immediately transport all spans in cache to agent. Flush() (int, error) io.Closer }
Transport is to provide robust communication with agent for reporter.
func NewTransport ¶ added in v1.0.0
func NewTransport(params *TransportParams) Transport