instrument

package
v0.0.0-...-ae8e89f Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wrap

func Wrap(
	scope tally.Scope,
	name string,
	ctx context.Context,
	operation OperationFn,
	opts ...Option,
) error

func WrapWithResult

func WrapWithResult[T any](
	scope tally.Scope,
	name string,
	ctx context.Context,
	operation OperationWithResultFn[T],
	opts ...Option,
) (T, error)

Types

type FilterFn

type FilterFn func(err error) bool

type Instrument

type Instrument interface {
	Instrument(ctx context.Context, operation OperationFn, opts ...InstrumentOption) error
	WithRetry(retry retry.Retry) Instrument
}

func New

func New(scope tally.Scope, name string, opts ...Option) Instrument

type InstrumentOption

type InstrumentOption func(options *instrumentOptions)

func WithLoggerFields

func WithLoggerFields(fields ...zap.Field) InstrumentOption

type InstrumentWithResult

type InstrumentWithResult[T any] interface {
	Instrument(ctx context.Context, operation OperationWithResultFn[T], opts ...InstrumentOption) (T, error)
	WithRetry(retry retry.RetryWithResult[T]) InstrumentWithResult[T]
}

func NewWithResult

func NewWithResult[T any](scope tally.Scope, name string, opts ...Option) InstrumentWithResult[T]

type OperationFn

type OperationFn func(ctx context.Context) error

type OperationWithResultFn

type OperationWithResultFn[T any] func(ctx context.Context) (T, error)

type Option

type Option func(c *options)

func WithFilter

func WithFilter(filter FilterFn) Option

func WithLogger

func WithLogger(logger *zap.Logger, msg string) Option

func WithTimeSource

func WithTimeSource(timeSource timesource.TimeSource) Option

func WithTracer

func WithTracer(msg string, tags map[string]string) Option

Jump to

Keyboard shortcuts

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