redis

package
v0.0.0-...-50dcf71 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2021 License: Apache-2.0, BSD-3-Clause, MIT, + 1 more Imports: 9 Imported by: 0

Documentation

Overview

Package redis provides tracing functions for tracing the go-redis/redis package (https://github.com/go-redis/redis). This package supports go-redis/redis v7.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(opt *redis.Options, opts ...ClientOption) *redis.Client

NewClient returns a new Client that is traced with the default tracer under the service name "redis".

func WrapClient

func WrapClient(c *redis.Client, opts ...ClientOption) *redis.Client

WrapClient wraps a given redis.Client with a tracer under the given service name.

Types

type ClientOption

type ClientOption func(*clientConfig)

ClientOption represents an option that can be used to create or wrap a client.

func WithAnalytics

func WithAnalytics(on bool) ClientOption

WithAnalytics enables Trace Analytics for all started spans.

func WithAnalyticsRate

func WithAnalyticsRate(rate float64) ClientOption

WithAnalyticsRate sets the sampling rate for Trace Analytics events correlated to started spans.

func WithDB

func WithDB(db string) ClientOption

WithDB sets the db for the client.

func WithHost

func WithHost(host string) ClientOption

WithHost sets the host for the client.

func WithPort

func WithPort(port string) ClientOption

WithPort sets the port for the client.

func WithRedisOptions

func WithRedisOptions(opts *redis.Options) ClientOption

WithRedisOptions sets the redis.Option for the client.

func WithServiceName

func WithServiceName(name string) ClientOption

WithServiceName sets the given service name for the client.

type Hook

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

Hook imprements redis.Hook.

func NewHook

func NewHook(opts ...ClientOption) *Hook

NewHook returns a new Hook.

func (*Hook) AfterProcess

func (h *Hook) AfterProcess(ctx context.Context, cmd redis.Cmder) error

func (*Hook) AfterProcessPipeline

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

func (*Hook) BeforeProcess

func (h *Hook) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error)

func (*Hook) BeforeProcessPipeline

func (h *Hook) 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