instrumenter

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2024 License: Apache-2.0 Imports: 9 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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
	OnEnd(attributes []attribute.KeyValue, context context.Context, request REQUEST, response RESPONSE, err error) []attribute.KeyValue
}

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   []*OperationListenerWrapper
	OperationMetrics     []OperationMetrics
	ContextCustomizers   []ContextCustomizer[REQUEST]
	SpanSuppressor       SpanSuppressor
	Tracer               trace.Tracer
	InstVersion          string
}

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 ...*OperationListenerWrapper) *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]) BuildPropagatingFromUpstreamInstrumenterWithProp added in v0.0.2

func (b *Builder[REQUEST, RESPONSE]) BuildPropagatingFromUpstreamInstrumenterWithProp(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]) BuildPropagatingToDownstreamInstrumenterWithProp added in v0.0.2

func (b *Builder[REQUEST, RESPONSE]) BuildPropagatingToDownstreamInstrumenterWithProp(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]) SetInstVersion

func (b *Builder[REQUEST, RESPONSE]) SetInstVersion(instVersion string) *Builder[REQUEST, RESPONSE]

func (*Builder[REQUEST, RESPONSE]) SetInstrumentEnabler

func (b *Builder[REQUEST, RESPONSE]) SetInstrumentEnabler(enabler InstrumentEnabler) *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 {
	IsEnabled() bool
}

func NewDefaultInstrumentEnabler

func NewDefaultInstrumentEnabler() InstrumentEnabler

type Instrumenter

type Instrumenter[REQUEST any, RESPONSE any] interface {
	StartAndEnd(parentContext context.Context, request REQUEST, response RESPONSE, err error, startTime, endTime time.Time)
	Start(parentContext context.Context, request REQUEST) context.Context
	End(ctx context.Context, request REQUEST, response RESPONSE, err error)
}

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)

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

func (i *InternalInstrumenter[REQUEST, RESPONSE]) Start(parentContext context.Context, request REQUEST) 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)

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 OperationListenerWrapper

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

func (*OperationListenerWrapper) OnAfterEnd

func (w *OperationListenerWrapper) OnAfterEnd(context context.Context, endAttributes []attribute.KeyValue, endTimestamp time.Time)

func (*OperationListenerWrapper) OnAfterStart

func (w *OperationListenerWrapper) OnAfterStart(context context.Context, endTimestamp time.Time)

func (*OperationListenerWrapper) OnBeforeEnd

func (w *OperationListenerWrapper) OnBeforeEnd(context context.Context, startAttributes []attribute.KeyValue, startTimestamp time.Time) context.Context

func (*OperationListenerWrapper) OnBeforeStart

func (w *OperationListenerWrapper) OnBeforeStart(parentContext context.Context, startTimestamp time.Time) context.Context

type OperationMetrics

type OperationMetrics interface {
	Create(meter metric.Meter) *OperationListenerWrapper
	Match(meta meter.MeterMeta) bool
}

TODO: add route updater here, now we do not support such controller layer to update route.

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)

func (*PropagatingFromUpstreamInstrumenter[REQUEST, RESPONSE]) Start

func (p *PropagatingFromUpstreamInstrumenter[REQUEST, RESPONSE]) Start(parentContext context.Context, request REQUEST) 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)

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)

func (*PropagatingToDownstreamInstrumenter[REQUEST, RESPONSE]) Start

func (p *PropagatingToDownstreamInstrumenter[REQUEST, RESPONSE]) Start(parentContext context.Context, request REQUEST) 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)

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

Jump to

Keyboard shortcuts

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