supervisor

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Initializes supervision over cluster and controller metrics uses prometheus gauges and counters

Index

Constants

View Source
const (
	// HeartBeatGraceSeconds is an added grace-period that a heartbeat signal has
	// to come back successfully.
	HeartBeatGraceSeconds int64 = 180
)

Variables

View Source
var (
	// Heartbeat global heartbeat variable
	Heartbeat = time.Now()
	// Healthy global health variable
	Healthy = true
)

Functions

func Check

func Check(e error)

Check examins an error. On nil it returns and on not-nil it logs the error and calls Fatal (corresponding to os.Exit(1))

func UpdateHeartbeat added in v0.0.7

func UpdateHeartbeat()

Types

type ClusterMetrics

type ClusterMetrics struct {
	ExcessNodes             prometheus.Gauge
	NumberOfNonTaintedNodes prometheus.Gauge
	NumberOfNodes           prometheus.Gauge
	NumberOfPods            prometheus.Gauge
	UnschedulableNodes      prometheus.Gauge
	CPUUtilization          prometheus.Gauge
	RAMUtilization          prometheus.Gauge
}

ClusterMetrics is struct of prometheus metrics to be exported

func InitClusterMetrics

func InitClusterMetrics(prefix string) *ClusterMetrics

InitClusterMetrics initializes these metrics

func (*ClusterMetrics) PublishClusterMetrics

func (cm *ClusterMetrics) PublishClusterMetrics(clusterState *types.ClusterManifest)

PublishClusterMetrics updates the exported metrics

func (*ClusterMetrics) PublishNodeUnschedulable

func (cm *ClusterMetrics) PublishNodeUnschedulable(nodesMap map[string]types.NodeManifest)

PublishNodeUnschedulable updates the number of unschedulable nodes

type DrainerMetrics

type DrainerMetrics struct {
	// Drainer Metrics
	NodesCordoned   prometheus.Counter
	NodesDrained    prometheus.Counter
	NodesUncordoned prometheus.Counter
}

DrainerMetrics is struct of prometheus metrics to be exported

func InitDrainerMetrics

func InitDrainerMetrics(prefix string) *DrainerMetrics

InitDrainerMetrics initializes these metrics

type Handler

type Handler struct {
	MaxLoopTime time.Duration
}

Handler implements a HTTP response handler that reports on the current liveness status of the controller

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(res http.ResponseWriter, req *http.Request)

type Supervisor

type Supervisor struct {
	Prefix string

	DrainerMetrics *DrainerMetrics
	ClusterMetrics *ClusterMetrics
}

Supervisor is an object to manage the exported prometheus metrics

func InitSupervisor

func InitSupervisor(prefix string) *Supervisor

InitSupervisor initializes the supervisor using the two contexts, drainer metrics and cluster metrics

func (*Supervisor) StartSupervising

func (s *Supervisor) StartSupervising()

StartSupervising opens a web port that can be used by prometheus to track the metrics we are exposing

Jump to

Keyboard shortcuts

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