agent

package
Version: v0.0.0-...-18342f2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cancel

func Cancel(err error) error

func DoRetry

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

func DoRetryAttempts

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

Types

type Agent

type Agent struct {
	CPUProfile          bool
	CPUProfileDuration  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(tick 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