interceptor

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ClientHandleCounter ...
	RedisHandleCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "",
			Name:      "redis_handle_total",
		}, []string{"name", "method", "addr", "result"})

	// ClientHandleHistogram ...
	RedisHandleHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: "",
		Name:      "redis_handle_seconds",
	}, []string{"name", "method", "addr"})
)

Functions

func GetDuration

func GetDuration(ctx context.Context) time.Duration

func GetDurationMilliseconds

func GetDurationMilliseconds(ctx context.Context) float64

func GetStartTime

func GetStartTime(ctx context.Context) time.Time

func LogHook

func LogHook(config *eredis_config.Config) redis.Hook

func MetricHook

func MetricHook(config *eredis_config.Config) redis.Hook

func StartTimeHook

func StartTimeHook() redis.Hook

StartTimeHook

Types

type RedisHook

type RedisHook struct {
	redis.Hook
	// contains filtered or unexported fields
}

func NewRedisHook

func NewRedisHook() *RedisHook

func (*RedisHook) AfterProcess

func (i *RedisHook) AfterProcess(ctx context.Context, cmd redis.Cmder) error

func (*RedisHook) AfterProcessPipeline

func (i *RedisHook) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error

func (*RedisHook) BeforeProcess

func (i *RedisHook) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error)

func (*RedisHook) BeforeProcessPipeline

func (i *RedisHook) BeforeProcessPipeline(ctx context.Context, cmds []redis.Cmder) (context.Context, error)

func (*RedisHook) SetAfterProcess

func (i *RedisHook) SetAfterProcess(p func(ctx context.Context, cmd redis.Cmder) error) *RedisHook

func (*RedisHook) SetAfterProcessPipeline

func (i *RedisHook) SetAfterProcessPipeline(p func(ctx context.Context, cmds []redis.Cmder) error) *RedisHook

func (*RedisHook) SetBeforeProcess

func (i *RedisHook) SetBeforeProcess(p func(ctx context.Context, cmd redis.Cmder) (context.Context, error)) *RedisHook

func (*RedisHook) SetBeforeProcessPipeline

func (i *RedisHook) SetBeforeProcessPipeline(p func(ctx context.Context, cmds []redis.Cmder) (context.Context, error)) *RedisHook

type TraceOption

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

TraceOption specifies instrumentation configuration options.

func WithAttributes

func WithAttributes(attrs ...attribute.KeyValue) TraceOption

WithAttributes specifies additional attributes to be added to the span.

func WithTracerProvider

func WithTracerProvider(provider trace.TracerProvider) TraceOption

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

type TracingHook

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

func NewTracingHook

func NewTracingHook(opts ...TraceOption) *TracingHook

func (*TracingHook) AfterProcess

func (th *TracingHook) AfterProcess(ctx context.Context, cmd redis.Cmder) error

func (*TracingHook) AfterProcessPipeline

func (th *TracingHook) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error

func (*TracingHook) BeforeProcess

func (th *TracingHook) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error)

func (*TracingHook) BeforeProcessPipeline

func (th *TracingHook) BeforeProcessPipeline(ctx context.Context, cmds []redis.Cmder) (context.Context, error)

Jump to

Keyboard shortcuts

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