tracer

package
v2.3.4 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SpanListenerConstructorMap = make(map[string]func(map[string]interface{}) ThundraSpanListener, 0)

Functions

func ClearSpanListeners

func ClearSpanListeners()

func New

func New(recorder SpanRecorder) ot.Tracer

New creates and returns a standard Tracer which defers completed Spans to `recorder`.

func OnSpanStarted

func OnSpanStarted(ots ot.Span)

func ParseSpanListeners

func ParseSpanListeners()

func RegisterSpanListener

func RegisterSpanListener(listener ThundraSpanListener)

Types

type CompositeSpanFilter

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

func (*CompositeSpanFilter) Accept

func (f *CompositeSpanFilter) Accept(span *spanImpl) bool

type ErrorInjectorSpanListener

type ErrorInjectorSpanListener struct {
	ErrorMessage    string
	ErrorType       error
	InjectOnFinish  bool
	InjectCountFreq int64

	AddInfoTags bool
	// contains filtered or unexported fields
}

func (*ErrorInjectorSpanListener) OnSpanFinished

func (e *ErrorInjectorSpanListener) OnSpanFinished(span *spanImpl)

func (*ErrorInjectorSpanListener) OnSpanStarted

func (e *ErrorInjectorSpanListener) OnSpanStarted(span *spanImpl)

func (*ErrorInjectorSpanListener) PanicOnError

func (e *ErrorInjectorSpanListener) PanicOnError() bool

type FilteringSpanListener

type FilteringSpanListener struct {
	Listener ThundraSpanListener
	Filterer SpanFilterer
}

func (*FilteringSpanListener) OnSpanFinished

func (f *FilteringSpanListener) OnSpanFinished(span *spanImpl)

func (*FilteringSpanListener) OnSpanStarted

func (f *FilteringSpanListener) OnSpanStarted(span *spanImpl)

func (*FilteringSpanListener) PanicOnError

func (f *FilteringSpanListener) PanicOnError() bool

type InMemorySpanRecorder

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

InMemorySpanRecorder stores spans using a slice in a thread-safe way

func NewInMemoryRecorder

func NewInMemoryRecorder() *InMemorySpanRecorder

NewInMemoryRecorder creates new InMemorySpanRecorder

func (*InMemorySpanRecorder) GetSpans

func (r *InMemorySpanRecorder) GetSpans() []*RawSpan

GetSpans returns a copy of the array of spans accumulated so far.

func (*InMemorySpanRecorder) RecordSpan

func (r *InMemorySpanRecorder) RecordSpan(span *RawSpan)

RecordSpan implements the respective method of SpanRecorder.

func (*InMemorySpanRecorder) Reset

func (r *InMemorySpanRecorder) Reset()

Reset clears the internal array of spans.

type LatencyInjectorSpanListener

type LatencyInjectorSpanListener struct {
	Delay          int64
	InjectOnFinish bool
	RandomizeDelay bool
	AddInfoTags    bool
}

func (*LatencyInjectorSpanListener) OnSpanFinished

func (l *LatencyInjectorSpanListener) OnSpanFinished(span *spanImpl)

func (*LatencyInjectorSpanListener) OnSpanStarted

func (l *LatencyInjectorSpanListener) OnSpanStarted(span *spanImpl)

func (*LatencyInjectorSpanListener) PanicOnError

func (l *LatencyInjectorSpanListener) PanicOnError() bool

type Operation

type Operation struct {
	ClassName string              `json:"className"`
	Tags      map[string][]string `json:"tags"`
}

type RawSpan

type RawSpan struct {
	Context        SpanContext
	ParentSpanID   string
	OperationName  string
	StartTimestamp int64
	EndTimestamp   int64
	DomainName     string
	ClassName      string
	Tags           ot.Tags
	Logs           []ot.LogRecord
}

RawSpan encapsulates all state associated with a (finished) Span.

func GetRaw

func GetRaw(ots ot.Span) (*RawSpan, bool)

GetRaw casts opentracing span interface to spanImpl struct

func (*RawSpan) Duration

func (s *RawSpan) Duration() int64

Duration calculates the spans duration

func (*RawSpan) GetTag

func (s *RawSpan) GetTag(key string) interface{}

GetTag returns the value for key

func (*RawSpan) GetTags

func (s *RawSpan) GetTags() ot.Tags

GetTags filters the thundra tags and returns the remainings

type SecurityAwareSpanListener

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

func (*SecurityAwareSpanListener) OnSpanFinished

func (s *SecurityAwareSpanListener) OnSpanFinished(span *spanImpl)

func (*SecurityAwareSpanListener) OnSpanStarted

func (s *SecurityAwareSpanListener) OnSpanStarted(span *spanImpl)

func (*SecurityAwareSpanListener) PanicOnError

func (s *SecurityAwareSpanListener) PanicOnError() bool

type SpanContext

type SpanContext struct {
	TransactionID string
	// A probabilistically unique identifier for a [multi-span] trace.
	TraceID string
	// A probabilistically unique identifier for a span.
	SpanID string
	// The span's associated baggage.
	Baggage map[string]string
}

SpanContext holds the basic Span metadata.

func (SpanContext) ForeachBaggageItem

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

ForeachBaggageItem belongs to the opentracing.SpanContext interface

func (SpanContext) WithBaggageItem

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

WithBaggageItem returns an entirely new basictracer SpanContext with the given key:value baggage pair set.

type SpanFilter

type SpanFilter interface {
	Accept(*spanImpl) bool
}

type SpanFilterer

type SpanFilterer interface {
	Accept(*spanImpl) bool
}

type SpanRecorder

type SpanRecorder interface {
	GetSpans() []*RawSpan
	RecordSpan(span *RawSpan)
	Reset()
}

SpanRecorder handles all of the `RawSpan` data generated via an associated `Tracer`

type TagInjectorSpanListener

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

func (*TagInjectorSpanListener) OnSpanFinished

func (t *TagInjectorSpanListener) OnSpanFinished(span *spanImpl)

func (*TagInjectorSpanListener) OnSpanStarted

func (t *TagInjectorSpanListener) OnSpanStarted(span *spanImpl)

func (*TagInjectorSpanListener) PanicOnError

func (t *TagInjectorSpanListener) PanicOnError() bool

type ThundraSpanFilter

type ThundraSpanFilter struct {
	DomainName    string
	ClassName     string
	OperationName string
	Reverse       bool
	Tags          ot.Tags
}

func NewThundraSpanFilter

func NewThundraSpanFilter(config map[string]interface{}) *ThundraSpanFilter

NewThundraSpanFilter creates and returns a new ThundraSpanFilter from config

func (*ThundraSpanFilter) Accept

func (t *ThundraSpanFilter) Accept(span *spanImpl) bool

type ThundraSpanFilterer

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

func (*ThundraSpanFilterer) Accept

func (t *ThundraSpanFilterer) Accept(span *spanImpl) bool

func (*ThundraSpanFilterer) AddFilter

func (t *ThundraSpanFilterer) AddFilter(sf SpanFilter)

func (*ThundraSpanFilterer) ClearFilters

func (t *ThundraSpanFilterer) ClearFilters()

type ThundraSpanListener

type ThundraSpanListener interface {
	OnSpanStarted(*spanImpl)
	OnSpanFinished(*spanImpl)
	PanicOnError() bool
}

func GetSpanListeners

func GetSpanListeners() []ThundraSpanListener

func NewErrorInjectorSpanListener

func NewErrorInjectorSpanListener(config map[string]interface{}) ThundraSpanListener

NewErrorInjectorSpanListener creates and returns a new ErrorInjectorSpanListener from config

func NewFilteringSpanListener

func NewFilteringSpanListener(config map[string]interface{}) ThundraSpanListener

NewFilteringSpanListener creates and returns a new FilteringSpanListener from config

func NewLatencyInjectorSpanListener

func NewLatencyInjectorSpanListener(config map[string]interface{}) ThundraSpanListener

NewLatencyInjectorSpanListener creates and returns a new LatencyInjectorSpanListener from config

func NewSecurityAwareSpanListener

func NewSecurityAwareSpanListener(config map[string]interface{}) ThundraSpanListener

func NewTagInjectorSpanListener

func NewTagInjectorSpanListener(config map[string]interface{}) ThundraSpanListener

Jump to

Keyboard shortcuts

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