agent

package
v2.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cancel

func Cancel(err error) error

func Do

func Do(minDelay, maxDelay time.Duration, fn func() error) error

func DoAttempts

func DoAttempts(minDelay, maxDelay time.Duration, attempts int, fn func() error) error

Types

type Agent

type Agent struct {
	CPUProfile           bool
	CPUProfileDuration   time.Duration
	TraceProfile         bool
	TraceProfileDuration time.Duration
	HeapProfile          bool
	BlockProfile         bool
	MutexProfile         bool
	GoroutineProfile     bool
	ThreadcreateProfile  bool
	// contains filtered or unexported fields
}

func New

func New(addr, service string, opts ...Option) *Agent

func Start

func Start(addr, service string, opts ...Option) (*Agent, error)

func (*Agent) Start

func (a *Agent) Start(ctx context.Context) error

func (*Agent) Stop

func (a *Agent) Stop() error

type Option

type Option func(a *Agent)

func WithBlockProfile

func WithBlockProfile() Option

func WithCPUProfile

func WithCPUProfile(duration time.Duration) Option

func WithGoroutineProfile

func WithGoroutineProfile() Option

func WithHTTPClient

func WithHTTPClient(c *http.Client) Option

func WithHeapProfile

func WithHeapProfile() Option

func WithLabels

func WithLabels(args ...string) Option

func WithLogger

func WithLogger(logf func(string, ...interface{})) Option

func WithMutexProfile

func WithMutexProfile() Option

func WithThreadcreateProfile

func WithThreadcreateProfile() Option

func WithTickInterval

func WithTickInterval(interval time.Duration) Option

func WithTraceProfile

func WithTraceProfile(duration time.Duration) Option

type Retry

type Retry struct {
	MinDelay    time.Duration
	MaxDelay    time.Duration
	MaxAttempts int
}

func (*Retry) Check

func (r *Retry) Check(err error) (bool, error)

func (*Retry) Do

func (r *Retry) Do(fn func() error) (err error)

Jump to

Keyboard shortcuts

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