Documentation
¶
Index ¶
- Constants
- Variables
- func ContextWithSpanRewinder(ctx context.Context, finisher SpanRewinder) context.Context
- 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 LogValuers
- 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 (
TracingPropertiesPrefix = "tracing"
)
Variables ¶
var DefaultLogValuers = LogValuers{ TraceIDValuer: func(context.Context) interface{} { return nil }, SpanIDValuer: func(context.Context) interface{} { return nil }, ParentIDValuer: func(context.Context) interface{} { return nil }, }
DefaultLogValuers is used by log package to extract tracing information in log templates. This variable is properly set by "tracing/init".
Functions ¶
func ContextWithSpanRewinder ¶
func ContextWithSpanRewinder(ctx context.Context, finisher SpanRewinder) context.Context
func ParentIdFromContext ¶
func SpanFromContext ¶
func SpanIdFromContext ¶
func TraceIdFromContext ¶
Types ¶
type JaegerProperties ¶
type LogValuers ¶ added in v0.14.0
type LogValuers struct { TraceIDValuer log.ContextValuer SpanIDValuer log.ContextValuer ParentIDValuer log.ContextValuer }
func (LogValuers) ContextValuers ¶ added in v0.14.0
func (v LogValuers) ContextValuers() log.ContextValuers
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
NewSpanOrFollows 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
BindTracingProperties create and bind SessionProperties, with a optional prefix
func NewTracingProperties ¶
func NewTracingProperties() *TracingProperties
NewTracingProperties create a SessionProperties with default values
type ZipkinProperties ¶
type ZipkinProperties struct {
Enabled bool `json:"enabled"`
}