Documentation ¶
Index ¶
- Constants
- Variables
- func ContextWithSpanRewinder(ctx context.Context, finisher SpanRewinder) context.Context
- func NewDefaultTracer() (opentracing.Tracer, io.Closer)
- func NewJaegerTracer(ctx *bootstrap.ApplicationContext, jp *JaegerProperties, sp *SamplerProperties) (opentracing.Tracer, io.Closer)
- func ParentIdFromContext(ctx context.Context) (ret interface{})
- func SpanFromContext(ctx context.Context) (span opentracing.Span)
- func SpanIdFromContext(ctx context.Context) (ret interface{})
- func TraceIdFromContext(ctx context.Context) (ret interface{})
- type JaegerProperties
- type Option
- type Propagator
- type SamplerProperties
- type SpanOperator
- func (op SpanOperator) DescendantOrNoSpan(ctx context.Context) context.Context
- func (op SpanOperator) Finish(ctx context.Context)
- func (op SpanOperator) FinishAndRewind(ctx context.Context) context.Context
- func (op SpanOperator) FollowsOrNoSpan(ctx context.Context) context.Context
- func (op SpanOperator) ForceNewSpan(ctx context.Context) context.Context
- func (op SpanOperator) NewSpanOrDescendant(ctx context.Context) context.Context
- func (op SpanOperator) NewSpanOrFollows(ctx context.Context) context.Context
- func (op SpanOperator) UpdateCurrentSpan(ctx context.Context)
- func (op *SpanOperator) WithOpName(name string) *SpanOperator
- func (op *SpanOperator) WithOptions(exts ...SpanOption) *SpanOperator
- func (op *SpanOperator) WithStartOptions(options ...opentracing.StartSpanOption) *SpanOperator
- type SpanOption
- func SpanBaggageItem(restrictedKey string, s string) SpanOption
- func SpanComponent(v string) SpanOption
- func SpanHttpMethod(v string) SpanOption
- func SpanHttpStatusCode(v int) SpanOption
- func SpanHttpUrl(v string) SpanOption
- func SpanKind(v ext.SpanKindEnum) SpanOption
- func SpanTag(key string, v interface{}) SpanOption
- type SpanRewinder
- type TracingProperties
- type ZipkinProperties
Constants ¶
const ( OpNameBootstrap = "bootstrap" OpNameStart = "startup" OpNameStop = "shutdown" OpNameHttp = "http" OpNameRedis = "redis" OpNameVault = "vault" OpNameDB = "db" OpNameCli = "cli" OpNameHttpClient = "remote-http" OpNameSecScope = "security" OpNameKafka = "kafka" OpNameScheduler = "scheduler" )
const (
TracingPropertiesPrefix = "tracing"
)
Variables ¶
var TracingLogValuers = log.ContextValuers{
"traceId": traceIdContextValuer,
"spanId": spanIdContextValuer,
"parentId": parentIdContextValuer,
}
Functions ¶
func ContextWithSpanRewinder ¶
func ContextWithSpanRewinder(ctx context.Context, finisher SpanRewinder) context.Context
func NewDefaultTracer ¶
func NewJaegerTracer ¶
func NewJaegerTracer(ctx *bootstrap.ApplicationContext, jp *JaegerProperties, sp *SamplerProperties) (opentracing.Tracer, io.Closer)
func ParentIdFromContext ¶
func SpanFromContext ¶
func SpanIdFromContext ¶
func TraceIdFromContext ¶
Types ¶
type JaegerProperties ¶
type Option ¶
type Option func(propagator *Propagator)
Option is a function that sets an option on Propagator
func BaggagePrefix ¶
BaggagePrefix is a function that sets baggage prefix on Propagator
func SingleHeader ¶
func SingleHeader() Option
type Propagator ¶
type Propagator struct {
// contains filtered or unexported fields
}
Propagator is an extension of zipkin.Propagator that support Single Header propagation: See https://github.com/openzipkin/b3-propagation#single-header
func NewZipkinB3Propagator ¶
func NewZipkinB3Propagator(opts ...Option) *Propagator
NewZipkinB3Propagator creates a Propagator for extracting and injecting Zipkin B3 headers into SpanContexts. Baggage is by default enabled and uses prefix 'baggage-'.
func (Propagator) Extract ¶
func (p Propagator) Extract(abstractCarrier interface{}) (jaeger.SpanContext, error)
Extract conforms to the Extractor interface for encoding Zipkin HTTP B3 headers
func (Propagator) Inject ¶
func (p Propagator) Inject(sc jaeger.SpanContext, abstractCarrier interface{}) error
Inject conforms to the Injector interface for decoding Zipkin B3 headers
type SamplerProperties ¶
type SpanOperator ¶
type SpanOperator struct {
// contains filtered or unexported fields
}
func WithTracer ¶
func WithTracer(tracer opentracing.Tracer) *SpanOperator
func (SpanOperator) DescendantOrNoSpan ¶
func (op SpanOperator) DescendantOrNoSpan(ctx context.Context) context.Context
DescendantOrNoSpan spawn a child span using opentracing.ChildOf(span.Context()) if there is a span exists otherwise do nothing
func (SpanOperator) Finish ¶
func (op SpanOperator) Finish(ctx context.Context)
Finish finish current span if exist. Note: The finished span is still counted as "current span".
If caller want to rewind to previous span, use FinishAndRewind instead
func (SpanOperator) FinishAndRewind ¶
func (op SpanOperator) FinishAndRewind(ctx context.Context) context.Context
FinishAndRewind finish current span if exist and restore context with parent span if possible (no garantees) callers shall not continue to use the old context after this call Note: all values in given context added during the current span will be lost. It's like rewind operation
func (SpanOperator) FollowsOrNoSpan ¶
func (op SpanOperator) FollowsOrNoSpan(ctx context.Context) context.Context
FollowsOrNoSpan spawn a child span using opentracing.FollowsFrom(span.Context()) if there is a span exists otherwise do nothing
func (SpanOperator) ForceNewSpan ¶
func (op SpanOperator) ForceNewSpan(ctx context.Context) context.Context
ForceNewSpan force to create a new span and discard any existing span Warning: Internal usage, use with caution
func (SpanOperator) NewSpanOrDescendant ¶
func (op SpanOperator) NewSpanOrDescendant(ctx context.Context) context.Context
NewSpanOrDescendant create new span if not currently have one, spawn a child span using opentracing.ChildOf(span.Context()) if span exists
func (SpanOperator) NewSpanOrFollows ¶
func (op SpanOperator) NewSpanOrFollows(ctx context.Context) context.Context
NewSpanOrDescendant create new span if not currently have one, spawn a child span using opentracing.FollowsFrom(span.Context()) if span exists
func (SpanOperator) UpdateCurrentSpan ¶
func (op SpanOperator) UpdateCurrentSpan(ctx context.Context)
func (*SpanOperator) WithOpName ¶
func (op *SpanOperator) WithOpName(name string) *SpanOperator
func (*SpanOperator) WithOptions ¶
func (op *SpanOperator) WithOptions(exts ...SpanOption) *SpanOperator
func (*SpanOperator) WithStartOptions ¶
func (op *SpanOperator) WithStartOptions(options ...opentracing.StartSpanOption) *SpanOperator
type SpanOption ¶
type SpanOption func(opentracing.Span)
func SpanBaggageItem ¶
func SpanBaggageItem(restrictedKey string, s string) SpanOption
func SpanComponent ¶
func SpanComponent(v string) SpanOption
func SpanHttpMethod ¶
func SpanHttpMethod(v string) SpanOption
func SpanHttpStatusCode ¶
func SpanHttpStatusCode(v int) SpanOption
func SpanHttpUrl ¶
func SpanHttpUrl(v string) SpanOption
func SpanKind ¶
func SpanKind(v ext.SpanKindEnum) SpanOption
func SpanTag ¶
func SpanTag(key string, v interface{}) SpanOption
type SpanRewinder ¶
func SpanRewinderFromContext ¶
func SpanRewinderFromContext(ctx context.Context) SpanRewinder
type TracingProperties ¶
type TracingProperties struct { Enabled bool `json:"enabled"` Jaeger JaegerProperties `json:"jaeger"` Zipkin ZipkinProperties `json:"zipkin"` Sampler SamplerProperties `json:"sampler"` }
func BindTracingProperties ¶
func BindTracingProperties(ctx *bootstrap.ApplicationContext) TracingProperties
BindManagementProperties create and bind SessionProperties, with a optional prefix
func NewTracingProperties ¶
func NewTracingProperties() *TracingProperties
NewSessionProperties create a SessionProperties with default values
type ZipkinProperties ¶
type ZipkinProperties struct {
Enabled bool `json:"enabled"`
}