metrics

package
v0.0.0-...-386b7fa Latest Latest
Warning

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

Go to latest
Published: May 14, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package metrics - common code for metrics of all 3 VPA components

Index

Constants

View Source
const (
	// TopMetricsNamespace is a prefix for all VPA-related metrics namespaces
	TopMetricsNamespace = "vpa_"
)

Variables

This section is empty.

Functions

func CreateExecutionTimeMetric

func CreateExecutionTimeMetric(namespace string, help string) *prometheus.HistogramVec

CreateExecutionTimeMetric prepares a new histogram labeled with execution step

func Initialize

func Initialize(address string, healthCheck *HealthCheck)

Initialize sets up Prometheus to expose metrics & (optionally) health-check on the given address

Types

type ExecutionTimer

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

ExecutionTimer measures execution time of a computation, split into major steps usual usage pattern is: timer := NewExecutionTimer(...) ; compute ; timer.ObserveStep() ; ... ; timer.ObserveTotal()

func NewExecutionTimer

func NewExecutionTimer(histo *prometheus.HistogramVec) *ExecutionTimer

NewExecutionTimer provides a timer for admission latency; call ObserveXXX() on it to measure

func (*ExecutionTimer) ObserveStep

func (t *ExecutionTimer) ObserveStep(step string)

ObserveStep measures the execution time from the last call to the ExecutionTimer

func (*ExecutionTimer) ObserveTotal

func (t *ExecutionTimer) ObserveTotal()

ObserveTotal measures the execution time from the creation of the ExecutionTimer

type HealthCheck

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

HealthCheck contains information about last activity time of the monitored component. NOTE: This started as a simplified version of ClusterAutoscaler's HealthCheck.

func NewHealthCheck

func NewHealthCheck(activityTimeout time.Duration, checkTimeout bool) *HealthCheck

NewHealthCheck builds new HealthCheck object with given timeout.

func (*HealthCheck) ServeHTTP

func (hc *HealthCheck) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler interface to provide a health-check endpoint.

func (*HealthCheck) UpdateLastActivity

func (hc *HealthCheck) UpdateLastActivity()

UpdateLastActivity updates last time of activity to now

Directories

Path Synopsis
Package admission (aka metrics_admission) - code for metrics of VPA Admission Controller plugin
Package admission (aka metrics_admission) - code for metrics of VPA Admission Controller plugin
Package recommender (aka metrics_recommender) - code for metrics of VPA Recommender
Package recommender (aka metrics_recommender) - code for metrics of VPA Recommender
Package updater (aka metrics_updater) - code for metrics of VPA Updater
Package updater (aka metrics_updater) - code for metrics of VPA Updater

Jump to

Keyboard shortcuts

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