tracing

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TracingPropertiesPrefix = "tracing"
)

Variables

View Source
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 ParentIdFromContext(ctx context.Context) (ret interface{})

func SpanFromContext

func SpanFromContext(ctx context.Context) (span opentracing.Span)

func SpanIdFromContext

func SpanIdFromContext(ctx context.Context) (ret interface{})

func TraceIdFromContext

func TraceIdFromContext(ctx context.Context) (ret interface{})

Types

type JaegerProperties

type JaegerProperties struct {
	Enabled bool   `json:"enabled"`
	Host    string `json:"host"`
	Port    int    `json:"port"`
}

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 SamplerProperties struct {
	Enabled     bool    `json:"enabled"`
	RateLimit   float64 `json:"limit-per-second"`
	Probability float64 `json:"probability"`
	LowestRate  float64 `json:"lowest-per-second"`
}

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

type SpanRewinder func() context.Context

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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