counter

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

type Counter struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Counter is a plugin that

func New

func New(ctx context.Context, config *client.Config, options ...Option) (*Counter, error)

New returns a new Counter instance.

func (*Counter) PostRun

func (c *Counter) PostRun(ctx context.Context, log *logger.Entry, n string, f events.Action, actErr error) error

func (*Counter) PreRun

func (c *Counter) PreRun(ctx context.Context, log *logger.Entry, n string, f events.Action) (err error)

type Option

type Option func(*Counter) error

Option is a functional option for extractors.

func WithActions

func WithActions(actions map[string]events.Action) Option

func WithDryRun added in v0.7.0

func WithDryRun(dryRun bool) Option

func WithHumanize added in v0.6.0

func WithHumanize(humanize bool) Option

func WithLogger

func WithLogger(l *logger.Logger) Option

func WithLoop

func WithLoop(loop bool) Option

func WithPid

func WithPid(pid int) Option

func WithPollingTimeout

func WithPollingTimeout(timeout time.Duration) Option

func WithRoundDuration

func WithRoundDuration(duration time.Duration) Option

func WithSleep

func WithSleep(sleep time.Duration) Option

type Options

type Options []Option

Options is a slice of Option.

func (Options) Apply

func (o Options) Apply(c *Counter) error

Apply interates over Options and calls each functional option with a given Counter.

Jump to

Keyboard shortcuts

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