monitor

package
v0.0.0-...-a8f6685 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UrlGetterProvider = HttpUrlGetterProvider

Functions

func ChooseActiveBackend

func ChooseActiveBackend(backendHealths map[*domain.Backend]*BackendStatus, useLowestIndex bool) *domain.Backend

Types

type BackendStatus

type BackendStatus struct {
	Index    int
	Healthy  bool
	Counters *DecisionCounters
}

type ClusterMonitor

type ClusterMonitor struct {
	// contains filtered or unexported fields
}

func NewClusterMonitor

func NewClusterMonitor(
	backends []*domain.Backend,
	healthcheckTimeout time.Duration,
	logger lager.Logger,
	useLowestIndex bool,
) *ClusterMonitor

func (*ClusterMonitor) Monitor

func (c *ClusterMonitor) Monitor(stopChan <-chan interface{})

func (*ClusterMonitor) QueryBackendHealth

func (c *ClusterMonitor) QueryBackendHealth(backend *domain.Backend, healthMonitor *BackendStatus, client UrlGetter)

func (*ClusterMonitor) RegisterBackendSubscriber

func (c *ClusterMonitor) RegisterBackendSubscriber(newSubscriber chan<- *domain.Backend)

func (*ClusterMonitor) SetupCounters

func (c *ClusterMonitor) SetupCounters() *DecisionCounters

type DecisionCounters

type DecisionCounters struct {
	// contains filtered or unexported fields
}

func NewDecisionCounters

func NewDecisionCounters() *DecisionCounters

func (*DecisionCounters) AddCondition

func (c *DecisionCounters) AddCondition(taskName string, predicate func() bool)

func (*DecisionCounters) GetCount

func (c *DecisionCounters) GetCount(name string) uint64

func (*DecisionCounters) IncrementCount

func (c *DecisionCounters) IncrementCount(name string)

func (*DecisionCounters) ResetCount

func (c *DecisionCounters) ResetCount(name string)

func (*DecisionCounters) Should

func (c *DecisionCounters) Should(taskName string) bool

type Monitor

type Monitor interface {
	Monitor(<-chan interface{})
}

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

func NewRunner

func NewRunner(monitor Monitor, logger lager.Logger) Runner

func (Runner) Run

func (pr Runner) Run(signals <-chan os.Signal, ready chan<- struct{}) error

type UrlGetter

type UrlGetter interface {
	Get(url string) (*http.Response, error)
}

func HttpUrlGetterProvider

func HttpUrlGetterProvider(healthcheckTimeout time.Duration) UrlGetter

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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