healthmonitor

package
Version: v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MetricsServer

func MetricsServer(bind string)

MetricsServer launches the prometheus metrics server

Types

type BackendPort

type BackendPort struct {
	Name                string        `yaml:"name"`
	Host                string        `yaml:"host"`
	Port                int           `yaml:"port"`
	HealthCheckEndpoint string        `yaml:"health_check_endpoint"`
	HealthCheckInterval time.Duration `yaml:"health_check_interval"`
	URL                 *url.URL
}

BackendPort contains the options you can set for a backend server

type Config

type Config struct {
	Proxy struct {
		Bind              string        `yaml:"bind"`
		MetricsPort       string        `yaml:"metrics_server_port"`
		MaxConn           int           `yaml:"max_conn"`
		MinAlive          int           `yaml:"min_alive"`
		RecoverySleepTime time.Duration `yaml:"recovery_sleep_time"`
		Name              string        `yaml:"name"`
	} `yaml:"proxy"`
	Backend []BackendPort `yaml:"backend"`
}

Config contains the options you can set for the proxy

func ParseConfig

func ParseConfig(configLocation string) (Config, error)

ParseConfig parses the configuration file

type HealthMonitor

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

HealthMonitor is responsible for monitoring and reporting the health of the downstream ports

func NewHealthMonitor

func NewHealthMonitor(config *Config, proxy *ProxyServer) *HealthMonitor

NewHealthMonitor makes a HealthMonitor and returns it

func (*HealthMonitor) ConfirmHealth

func (hm *HealthMonitor) ConfirmHealth(id uint16)

ConfirmHealth starts the health check loop

func (*HealthMonitor) IsUnhealthy

func (hm *HealthMonitor) IsUnhealthy() bool

IsUnhealthy returns true if the server has more unhealthy downstreams than the threshold value

type HealthMonitorMetrics

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

HealthMonitorMetrics contains the health monitor metrics

func NewHealthMonitorMetrics

func NewHealthMonitorMetrics() HealthMonitorMetrics

NewHealthMonitorMetrics creates an instance of HealthMonitorMetrics

type ProxyHandlerMetrics

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

ProxyHandlerMetrics contains the proxy handler metrics

func NewProxyHandlerMetrics

func NewProxyHandlerMetrics() *ProxyHandlerMetrics

NewProxyHandlerMetrics creates an instance of ProxyHandlerMetrics

type ProxyServer

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

ProxyServer encapsulates the server and config for the proxy

func NewProxyServer

func NewProxyServer(config *Config) *ProxyServer

NewProxyServer builds a proxy server and returns it

func (*ProxyServer) IsInShutdown

func (proxyServer *ProxyServer) IsInShutdown() bool

IsInShutdown returns true if the server is in shutdown, else returns false

func (*ProxyServer) Start

func (proxyServer *ProxyServer) Start() error

Start starts the proxy server

type ProxyServerMetrics

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

ProxyServerMetrics contains the proxy server metrics

func NewProxyServerMetrics

func NewProxyServerMetrics() *ProxyServerMetrics

NewProxyServerMetrics creates an instance of ProxyServerMetrics

Jump to

Keyboard shortcuts

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