db

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitDbMetrics added in v0.7.0

func InitDbMetrics(m metric.Meter)

InitDbMetrics so we need to make sure the otel_setup is executed before all the init() function related to issue Dbs://github.com/alibaba/opentelemetry-go-auto-instrumentation/issues/48

Types

type DBSpanNameExtractor

type DBSpanNameExtractor[REQUEST any] struct {
	Getter DbClientAttrsGetter[REQUEST]
}

func (*DBSpanNameExtractor[REQUEST]) Extract

func (d *DBSpanNameExtractor[REQUEST]) Extract(request REQUEST) string

type DbClientAttrsExtractor

type DbClientAttrsExtractor[REQUEST any, RESPONSE any, GETTER DbClientAttrsGetter[REQUEST]] struct {
	Base DbClientCommonAttrsExtractor[REQUEST, RESPONSE, GETTER]
}

func (*DbClientAttrsExtractor[REQUEST, RESPONSE, GETTER]) GetSpanKey

func (d *DbClientAttrsExtractor[REQUEST, RESPONSE, GETTER]) GetSpanKey() attribute.Key

func (*DbClientAttrsExtractor[REQUEST, RESPONSE, GETTER]) OnEnd

func (d *DbClientAttrsExtractor[REQUEST, RESPONSE, GETTER]) OnEnd(attrs []attribute.KeyValue, context context.Context, request REQUEST, response RESPONSE, err error) ([]attribute.KeyValue, context.Context)

func (*DbClientAttrsExtractor[REQUEST, RESPONSE, GETTER]) OnStart

func (d *DbClientAttrsExtractor[REQUEST, RESPONSE, GETTER]) OnStart(attrs []attribute.KeyValue, parentContext context.Context, request REQUEST) ([]attribute.KeyValue, context.Context)

type DbClientAttrsGetter

type DbClientAttrsGetter[REQUEST any] interface {
	DbClientCommonAttrsGetter[REQUEST]
	GetStatement(REQUEST) string
	GetOperation(REQUEST) string
	GetParameters(REQUEST) []any
}

type DbClientCommonAttrsExtractor

type DbClientCommonAttrsExtractor[REQUEST any, RESPONSE any, GETTER DbClientCommonAttrsGetter[REQUEST]] struct {
	Getter           GETTER
	AttributesFilter func(attrs []attribute.KeyValue) []attribute.KeyValue
}

func (*DbClientCommonAttrsExtractor[REQUEST, RESPONSE, GETTER]) GetSpanKey

func (d *DbClientCommonAttrsExtractor[REQUEST, RESPONSE, GETTER]) GetSpanKey() attribute.Key

func (*DbClientCommonAttrsExtractor[REQUEST, RESPONSE, GETTER]) OnEnd

func (d *DbClientCommonAttrsExtractor[REQUEST, RESPONSE, GETTER]) OnEnd(attrs []attribute.KeyValue, context context.Context, request REQUEST, response RESPONSE, err error) ([]attribute.KeyValue, context.Context)

func (*DbClientCommonAttrsExtractor[REQUEST, RESPONSE, GETTER]) OnStart

func (d *DbClientCommonAttrsExtractor[REQUEST, RESPONSE, GETTER]) OnStart(attributes []attribute.KeyValue, parentContext context.Context, request REQUEST) ([]attribute.KeyValue, context.Context)

type DbClientCommonAttrsGetter

type DbClientCommonAttrsGetter[REQUEST any] interface {
	GetSystem(REQUEST) string
	GetServerAddress(REQUEST) string
}

type DbClientMetric added in v0.7.0

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

func DbClientMetrics added in v0.7.0

func DbClientMetrics(key string) *DbClientMetric

func (DbClientMetric) OnAfterEnd added in v0.7.0

func (h DbClientMetric) OnAfterEnd(context context.Context, endAttributes []attribute.KeyValue, endTime time.Time)

func (DbClientMetric) OnAfterStart added in v0.7.0

func (h DbClientMetric) OnAfterStart(context context.Context, endTime time.Time)

func (DbClientMetric) OnBeforeEnd added in v0.7.0

func (h DbClientMetric) OnBeforeEnd(ctx context.Context, startAttributes []attribute.KeyValue, startTime time.Time) context.Context

func (DbClientMetric) OnBeforeStart added in v0.7.0

func (h DbClientMetric) OnBeforeStart(parentContext context.Context, startTime time.Time) context.Context

type DbExperimentalAttributesEnabler added in v0.4.0

type DbExperimentalAttributesEnabler interface {
	Enable() bool
}

type SqlClientAttributesGetter

type SqlClientAttributesGetter[REQUEST any] interface {
	DbClientCommonAttrsGetter[REQUEST]
	GetRawStatement(REQUEST) string
}

Jump to

Keyboard shortcuts

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