clients

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPort    = 2112
	DefaultTimeout = 15
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Daemon

type Daemon struct {
	Logger                *zap.SugaredLogger
	Server                *http.Server
	Trashcan              *tmo.Trashcan
	PollTimeout           time.Duration
	FastmileReturnChannel chan *models.FastmileReturn
	HttpErrorChannel      chan error
	Signals               chan os.Signal
}

Daemon is the central daemon which surfaces metrics from the tmo trashcan

func NewDaemon

func NewDaemon(hostname string, port int, timeout int) (*Daemon, error)

New returns a newly configured daemon ready to start A port or timeout of 0 will use default values (2112 & 15 respectively)

func (*Daemon) BackgroundHTTPServer

func (d *Daemon) BackgroundHTTPServer()

func (*Daemon) Hello

func (d *Daemon) Hello(w http.ResponseWriter, r *http.Request)

func (*Daemon) RegisterMetrics

func (d *Daemon) RegisterMetrics()

RegisterMetrics registers various metrics with prometheus_client to be surfaced

func (*Daemon) Run

func (d *Daemon) Run() error

type OneShot

type OneShot struct {
	Trashcan              *tmo.Trashcan
	FastmileReturnChannel chan *models.FastmileReturn
}

OneShot is a client for making single requests without polling

func NewOneShot

func NewOneShot(hostname string, timeout int) (*OneShot, error)

func (*OneShot) Fetch

func (o *OneShot) Fetch() *models.FastmileReturn

Fetch requests a set of metrics from the trashcan

type Polling

type Polling struct {
	Trashcan              *tmo.Trashcan
	PollTimeout           time.Duration
	Signals               chan os.Signal
	FastmileReturnChannel chan *models.FastmileReturn
}

Polling is a client for injecting a return channel and leaving it run in a loop

func NewPolling

func NewPolling(hostname string, timeout int, pollFrequency int) (*Polling, error)

func (*Polling) Start

func (p *Polling) Start(ret chan *models.FastmileReturn, signal chan interface{})

Start launches a poller which will return results on ret and terminate on signal

Jump to

Keyboard shortcuts

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