ochook

package
v0.0.0-...-64673ea Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decider

type Decider func(cmd redis.Cmder) bool

type RedisHook

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

func New

func New(opts ...TraceOption) *RedisHook

func (*RedisHook) AfterProcess

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

func (*RedisHook) AfterProcessPipeline

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

func (*RedisHook) BeforeProcess

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

func (*RedisHook) BeforeProcessPipeline

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

type TraceOption

type TraceOption func(o *TraceOptions)

func WithAllowRoot

func WithAllowRoot(b bool) TraceOption

WithAllowRoot if set to true, will allow ocsql to create root spans in absence of exisiting spans or even context. Default is to not trace ocsql calls if no existing parent span is found in context or when using methods not taking context.

func WithDecider

func WithDecider(fn Decider) TraceOption

WithPing if set to true, will enable the creation of spans on Ping requests.

func WithDefaultAttributes

func WithDefaultAttributes(attrs ...trace.Attribute) TraceOption

WithDefaultAttributes will be set to each span as default.

type TraceOptions

type TraceOptions struct {
	// AllowRoot, if set to true, will allow hook to create root spans in
	// absence of existing spans or even context.
	// Default is to not trace hook calls if no existing parent span is found
	// in context or when using methods not taking context.
	AllowRoot bool

	// Enable decide which cmd should be traced
	// Default allow all cmd expect "ping"
	Enable Decider

	// DefaultAttributes will be set to each span as default.
	DefaultAttributes []trace.Attribute
}

Jump to

Keyboard shortcuts

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