instrumenter

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 12 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCachedAttrs added in v0.4.0

func GetCachedAttrs() []attribute.KeyValue

func PutCachedAttrs added in v0.4.0

func PutCachedAttrs(attrs []attribute.KeyValue)

Types

type AlwaysClientExtractor

type AlwaysClientExtractor[REQUEST any] struct {
}

func (*AlwaysClientExtractor[any]) Extract

func (a *AlwaysClientExtractor[any]) Extract(request any) trace.SpanKind

type AlwaysConsumerExtractor

type AlwaysConsumerExtractor[REQUEST any] struct {
}

func (*AlwaysConsumerExtractor[any]) Extract

func (a *AlwaysConsumerExtractor[any]) Extract(request any) trace.SpanKind

type AlwaysInternalExtractor

type AlwaysInternalExtractor[REQUEST any] struct {
}

func (*AlwaysInternalExtractor[any]) Extract

func (a *AlwaysInternalExtractor[any]) Extract(request any) trace.SpanKind

type AlwaysProducerExtractor

type AlwaysProducerExtractor[REQUEST any] struct {
}

func (*AlwaysProducerExtractor[any]) Extract

func (a *AlwaysProducerExtractor[any]) Extract(request any) trace.SpanKind

type AlwaysServerExtractor

type AlwaysServerExtractor[REQUEST any] struct {
}

func (*AlwaysServerExtractor[any]) Extract

func (a *AlwaysServerExtractor[any]) Extract(request any) trace.SpanKind

type AttributesExtractor

type AttributesExtractor[REQUEST any, RESPONSE any] interface {
	OnStart(attributes []attribute.KeyValue, parentContext context.Context, request REQUEST) ([]attribute.KeyValue, context.Context)
	OnEnd(attributes []attribute.KeyValue, ctx context.Context, request REQUEST, response RESPONSE, err error) ([]attribute.KeyValue, context.Context)
}

type AttrsShadower

type AttrsShadower interface {
	Shadow(attrs []attribute.KeyValue) (int, []attribute.KeyValue)
}

type Builder

type Builder[REQUEST any, RESPONSE any] struct {
	Enabler              InstrumentEnabler
	SpanNameExtractor    SpanNameExtractor[REQUEST]
	SpanKindExtractor    SpanKindExtractor[REQUEST]
	SpanStatusExtractor  SpanStatusExtractor[REQUEST, RESPONSE]
	AttributesExtractors []AttributesExtractor[REQUEST, RESPONSE]
	OperationListeners   []OperationListener
	ContextCustomizers   []ContextCustomizer[REQUEST]
	SpanSuppressor       SpanSuppressor
	InstVersion          string
	Scope                instrumentation.Scope
}

func (*Builder[REQUEST, RESPONSE]) AddAttributesExtractor

func (b *Builder[REQUEST, RESPONSE]) AddAttributesExtractor(attributesExtractor ...AttributesExtractor[REQUEST, RESPONSE]) *Builder[REQUEST, RESPONSE]

func (*Builder[REQUEST, RESPONSE]) AddContextCustomizers

func (b *Builder[REQUEST, RESPONSE]) AddContextCustomizers(contextCustomizers ...ContextCustomizer[REQUEST]) *Builder[REQUEST, RESPONSE]

func (*Builder[REQUEST, RESPONSE]) AddOperationListeners

func (b *Builder[REQUEST, RESPONSE]) AddOperationListeners(operationListener ...OperationListener) *Builder[REQUEST, RESPONSE]

func (*Builder[REQUEST, RESPONSE]) BuildInstrumenter

func (b *Builder[REQUEST, RESPONSE]) BuildInstrumenter() *InternalInstrumenter[REQUEST, RESPONSE]

func (*Builder[REQUEST, RESPONSE]) BuildPropagatingFromUpstreamInstrumenter

func (b *Builder[REQUEST, RESPONSE]) BuildPropagatingFromUpstreamInstrumenter(carrierGetter func(REQUEST) propagation.TextMapCarrier, prop propagation.TextMapPropagator) *PropagatingFromUpstreamInstrumenter[REQUEST, RESPONSE]

func (*Builder[REQUEST, RESPONSE]) BuildPropagatingToDownstreamInstrumenter

func (b *Builder[REQUEST, RESPONSE]) BuildPropagatingToDownstreamInstrumenter(carrierGetter func(REQUEST) propagation.TextMapCarrier, prop propagation.TextMapPropagator) *PropagatingToDownstreamInstrumenter[REQUEST, RESPONSE]

func (*Builder[REQUEST, RESPONSE]) Init

func (b *Builder[REQUEST, RESPONSE]) Init() *Builder[REQUEST, RESPONSE]

func (*Builder[REQUEST, RESPONSE]) SetInstrumentEnabler

func (b *Builder[REQUEST, RESPONSE]) SetInstrumentEnabler(enabler InstrumentEnabler) *Builder[REQUEST, RESPONSE]

func (*Builder[REQUEST, RESPONSE]) SetInstrumentationScope added in v0.4.0

func (b *Builder[REQUEST, RESPONSE]) SetInstrumentationScope(scope instrumentation.Scope) *Builder[REQUEST, RESPONSE]

func (*Builder[REQUEST, RESPONSE]) SetSpanKindExtractor

func (b *Builder[REQUEST, RESPONSE]) SetSpanKindExtractor(spanKindExtractor SpanKindExtractor[REQUEST]) *Builder[REQUEST, RESPONSE]

func (*Builder[REQUEST, RESPONSE]) SetSpanNameExtractor

func (b *Builder[REQUEST, RESPONSE]) SetSpanNameExtractor(spanNameExtractor SpanNameExtractor[REQUEST]) *Builder[REQUEST, RESPONSE]

func (*Builder[REQUEST, RESPONSE]) SetSpanStatusExtractor

func (b *Builder[REQUEST, RESPONSE]) SetSpanStatusExtractor(spanStatusExtractor SpanStatusExtractor[REQUEST, RESPONSE]) *Builder[REQUEST, RESPONSE]

type ContextCustomizer

type ContextCustomizer[REQUEST interface{}] interface {
	OnStart(context context.Context, request REQUEST, startAttributes []attribute.KeyValue) context.Context
}

type InstrumentEnabler

type InstrumentEnabler interface {
	Enable() bool
}

func NewDefaultInstrumentEnabler

func NewDefaultInstrumentEnabler() InstrumentEnabler

type Instrumenter

type Instrumenter[REQUEST any, RESPONSE any] interface {
	ShouldStart(parentContext context.Context, request REQUEST) bool
	StartAndEnd(parentContext context.Context, request REQUEST, response RESPONSE, err error, startTime, endTime time.Time)
	StartAndEndWithOptions(parentContext context.Context, request REQUEST, response RESPONSE, err error, startTime, endTime time.Time, startOptions []trace.SpanStartOption, endOptions []trace.SpanEndOption)
	Start(parentContext context.Context, request REQUEST, options ...trace.SpanStartOption) context.Context
	End(ctx context.Context, request REQUEST, response RESPONSE, err error, options ...trace.SpanEndOption)
}

type InternalInstrumenter added in v0.0.2

type InternalInstrumenter[REQUEST any, RESPONSE any] struct {
	// contains filtered or unexported fields
}

func (*InternalInstrumenter[REQUEST, RESPONSE]) End added in v0.0.2

func (i *InternalInstrumenter[REQUEST, RESPONSE]) End(ctx context.Context, request REQUEST, response RESPONSE, err error, options ...trace.SpanEndOption)

func (*InternalInstrumenter[REQUEST, RESPONSE]) ShouldStart added in v0.6.0

func (i *InternalInstrumenter[REQUEST, RESPONSE]) ShouldStart(parentContext context.Context, request REQUEST) bool

func (*InternalInstrumenter[REQUEST, RESPONSE]) Start added in v0.0.2

func (i *InternalInstrumenter[REQUEST, RESPONSE]) Start(parentContext context.Context, request REQUEST, options ...trace.SpanStartOption) context.Context

func (*InternalInstrumenter[REQUEST, RESPONSE]) StartAndEnd added in v0.0.2

func (i *InternalInstrumenter[REQUEST, RESPONSE]) StartAndEnd(parentContext context.Context, request REQUEST, response RESPONSE, err error, startTime, endTime time.Time)

func (*InternalInstrumenter[REQUEST, RESPONSE]) StartAndEndWithOptions added in v0.4.0

func (i *InternalInstrumenter[REQUEST, RESPONSE]) StartAndEndWithOptions(parentContext context.Context, request REQUEST, response RESPONSE, err error, startTime, endTime time.Time, startOptions []trace.SpanStartOption, endOptions []trace.SpanEndOption)

type NoneStrategy added in v0.6.0

type NoneStrategy struct{}

type NoopAttrsShadower

type NoopAttrsShadower struct{}

func (NoopAttrsShadower) Shadow

func (n NoopAttrsShadower) Shadow(attrs []attribute.KeyValue) (int, []attribute.KeyValue)

type NoopSpanSuppressor

type NoopSpanSuppressor struct {
}

func NewNoopSpanSuppressor

func NewNoopSpanSuppressor() *NoopSpanSuppressor

func (*NoopSpanSuppressor) ShouldSuppress

func (n *NoopSpanSuppressor) ShouldSuppress(parentContext context.Context, spanKind trace.SpanKind) bool

func (*NoopSpanSuppressor) StoreInContext

func (n *NoopSpanSuppressor) StoreInContext(context context.Context, spanKind trace.SpanKind, span trace.Span) context.Context

type OperationListener

type OperationListener interface {
	OnBeforeStart(parentContext context.Context, startTimestamp time.Time) context.Context
	OnBeforeEnd(context context.Context, startAttributes []attribute.KeyValue, startTimestamp time.Time) context.Context
	OnAfterStart(context context.Context, endTimestamp time.Time)
	OnAfterEnd(context context.Context, endAttributes []attribute.KeyValue, endTimestamp time.Time)
}

type PropagatingFromUpstreamInstrumenter

type PropagatingFromUpstreamInstrumenter[REQUEST any, RESPONSE any] struct {
	// contains filtered or unexported fields
}

func (*PropagatingFromUpstreamInstrumenter[REQUEST, RESPONSE]) End

func (p *PropagatingFromUpstreamInstrumenter[REQUEST, RESPONSE]) End(ctx context.Context, request REQUEST, response RESPONSE, err error, options ...trace.SpanEndOption)

func (*PropagatingFromUpstreamInstrumenter[REQUEST, RESPONSE]) ShouldStart added in v0.6.0

func (p *PropagatingFromUpstreamInstrumenter[REQUEST, RESPONSE]) ShouldStart(parentContext context.Context, request REQUEST) bool

func (*PropagatingFromUpstreamInstrumenter[REQUEST, RESPONSE]) Start

func (p *PropagatingFromUpstreamInstrumenter[REQUEST, RESPONSE]) Start(parentContext context.Context, request REQUEST, options ...trace.SpanStartOption) context.Context

func (*PropagatingFromUpstreamInstrumenter[REQUEST, RESPONSE]) StartAndEnd added in v0.0.2

func (p *PropagatingFromUpstreamInstrumenter[REQUEST, RESPONSE]) StartAndEnd(parentContext context.Context, request REQUEST, response RESPONSE, err error, startTime, endTime time.Time)

func (*PropagatingFromUpstreamInstrumenter[REQUEST, RESPONSE]) StartAndEndWithOptions added in v0.4.0

func (p *PropagatingFromUpstreamInstrumenter[REQUEST, RESPONSE]) StartAndEndWithOptions(parentContext context.Context, request REQUEST, response RESPONSE, err error, startTime, endTime time.Time, startOptions []trace.SpanStartOption, endOptions []trace.SpanEndOption)

type PropagatingToDownstreamInstrumenter

type PropagatingToDownstreamInstrumenter[REQUEST any, RESPONSE any] struct {
	// contains filtered or unexported fields
}

func (*PropagatingToDownstreamInstrumenter[REQUEST, RESPONSE]) End

func (p *PropagatingToDownstreamInstrumenter[REQUEST, RESPONSE]) End(ctx context.Context, request REQUEST, response RESPONSE, err error, options ...trace.SpanEndOption)

func (*PropagatingToDownstreamInstrumenter[REQUEST, RESPONSE]) ShouldStart added in v0.6.0

func (p *PropagatingToDownstreamInstrumenter[REQUEST, RESPONSE]) ShouldStart(parentContext context.Context, request REQUEST) bool

func (*PropagatingToDownstreamInstrumenter[REQUEST, RESPONSE]) Start

func (p *PropagatingToDownstreamInstrumenter[REQUEST, RESPONSE]) Start(parentContext context.Context, request REQUEST, options ...trace.SpanStartOption) context.Context

func (*PropagatingToDownstreamInstrumenter[REQUEST, RESPONSE]) StartAndEnd added in v0.0.2

func (p *PropagatingToDownstreamInstrumenter[REQUEST, RESPONSE]) StartAndEnd(parentContext context.Context, request REQUEST, response RESPONSE, err error, startTime, endTime time.Time)

func (*PropagatingToDownstreamInstrumenter[REQUEST, RESPONSE]) StartAndEndWithOptions added in v0.4.0

func (p *PropagatingToDownstreamInstrumenter[REQUEST, RESPONSE]) StartAndEndWithOptions(parentContext context.Context, request REQUEST, response RESPONSE, err error, startTime, endTime time.Time, startOptions []trace.SpanStartOption, endOptions []trace.SpanEndOption)

type SemConvStrategy added in v0.6.0

type SemConvStrategy struct{}

type SpanKeyProvider

type SpanKeyProvider interface {
	GetSpanKey() attribute.Key
}

type SpanKeySuppressor

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

func NewSpanKeySuppressor

func NewSpanKeySuppressor(spanKeys []attribute.Key) *SpanKeySuppressor

func (*SpanKeySuppressor) ShouldSuppress

func (s *SpanKeySuppressor) ShouldSuppress(parentContext context.Context, spanKind trace.SpanKind) bool

func (*SpanKeySuppressor) StoreInContext

func (s *SpanKeySuppressor) StoreInContext(ctx context.Context, spanKind trace.SpanKind, span trace.Span) context.Context

type SpanKindExtractor

type SpanKindExtractor[REQUEST any] interface {
	Extract(request REQUEST) trace.SpanKind
}

type SpanKindStrategy added in v0.6.0

type SpanKindStrategy struct{}

type SpanKindSuppressor added in v0.6.0

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

func NewSpanKindSuppressor added in v0.6.0

func NewSpanKindSuppressor() *SpanKindSuppressor

func (*SpanKindSuppressor) ShouldSuppress added in v0.6.0

func (s *SpanKindSuppressor) ShouldSuppress(parentContext context.Context, spanKind trace.SpanKind) bool

func (*SpanKindSuppressor) StoreInContext added in v0.6.0

func (s *SpanKindSuppressor) StoreInContext(context context.Context, spanKind trace.SpanKind, span trace.Span) context.Context

type SpanNameExtractor

type SpanNameExtractor[REQUEST any] interface {
	Extract(request REQUEST) string
}

type SpanStatusExtractor

type SpanStatusExtractor[REQUEST any, RESPONSE any] interface {
	Extract(span trace.Span, request REQUEST, response RESPONSE, err error)
}

type SpanSuppressor

type SpanSuppressor interface {
	StoreInContext(context context.Context, spanKind trace.SpanKind, span trace.Span) context.Context
	ShouldSuppress(parentContext context.Context, spanKind trace.SpanKind) bool
}

type SpanSuppressorStrategy added in v0.6.0

type SpanSuppressorStrategy interface {
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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