redis

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Version

func Version() string

Version is the current release version of otel redis in use.

func Wrap

func Wrap(client Client, opts ...Option)

Wrap .

Types

type Client

type Client interface {
	WrapProcess(fn func(oldProcess func(redis.Cmder) error) func(redis.Cmder) error)
	WrapProcessPipeline(fn func(oldProcess func([]redis.Cmder) error) func([]redis.Cmder) error)
}

Client .

type Option

type Option interface {
	// Apply sets the Option value of a config.
	Apply(*config)
}

Option is the interface that applies a configuration option.

func WithAttributes

func WithAttributes(attributes ...attribute.KeyValue) Option

WithAttributes specifies attributes that will be set to each span.

func WithSpanNameFormatter

func WithSpanNameFormatter(spanNameFormatter SpanNameFormatter) Option

WithSpanNameFormatter takes an interface that will be called on every operation and the returned string will become the span name.

func WithSpanOptions

func WithSpanOptions(opts SpanOptions) Option

WithSpanOptions specifies configuration for span to decide whether to enable some features.

func WithTracerProvider

func WithTracerProvider(provider trace.TracerProvider) Option

WithTracerProvider specifies a tracer provider to use for creating a tracer. If none is specified, the global provider is used.

type OptionFunc

type OptionFunc func(*config)

OptionFunc implements the Option interface.

func (OptionFunc) Apply

func (f OptionFunc) Apply(c *config)

Apply .

type SpanNameFormatter

type SpanNameFormatter interface {
	Format(ctx context.Context, cmd redis.Cmder) string
	FormatBatch(ctx context.Context, cmds []redis.Cmder) string
}

SpanNameFormatter is an interface that used to format span names.

type SpanOptions

type SpanOptions struct {
	// Ping, if set to true, will enable the creation of spans on Ping requests.
	Ping bool

	// DisableStatement if set to true, will suppress db.statement in spans.
	DisableStatement bool

	// RecordError, if set, will be invoked with the current error, and if the func returns true
	// the record will be recorded on the current span.
	RecordError func(err error) bool

	// AllowRoot, if set to true, will create root spans in absence of existing spans or even context.
	AllowRoot bool
}

SpanOptions holds configuration of tracing span to decide whether to enable some features. by default all options are set to false intentionally when creating a wrapped driver and provide the most sensible default with both performance and security in mind.

Jump to

Keyboard shortcuts

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