package metrics

import "k8s.io/kubernetes/pkg/controller/podautoscaler/metrics"

Index

Constants

const (
	DefaultHeapsterNamespace = "kube-system"
	DefaultHeapsterScheme    = "http"
	DefaultHeapsterService   = "heapster"
	DefaultHeapsterPort      = "" // use the first exposed port on the service
)

Functions

func GetMetricUtilizationRatio

func GetMetricUtilizationRatio(metrics PodMetricsInfo, targetUtilization float64) (float64, float64)

GetMetricUtilizationRatio takes in a set of metrics and a target utilization value, and calcuates the ratio of desired to actual utilization (returning that and the actual utilization)

func GetResourceUtilizationRatio

func GetResourceUtilizationRatio(metrics PodResourceInfo, requests map[string]int64, targetUtilization int32) (float64, int32, error)

GetResourceUtilizationRatio takes in a set of metrics, a set of matching requests, and a target utilization percentage, and calcuates the the ratio of desired to actual utilization (returning that and the actual utilization)

Types

type HeapsterMetricsClient

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

func (*HeapsterMetricsClient) GetRawMetric

func (h *HeapsterMetricsClient) GetRawMetric(metricName string, namespace string, selector labels.Selector) (PodMetricsInfo, time.Time, error)

func (*HeapsterMetricsClient) GetResourceMetric

func (h *HeapsterMetricsClient) GetResourceMetric(resource api.ResourceName, namespace string, selector labels.Selector) (PodResourceInfo, time.Time, error)

type MetricsClient

type MetricsClient interface {
	// GetResourceMetric gets the given resource metric (and an associated oldest timestamp)
	// for all pods matching the specified selector in the given namespace
	GetResourceMetric(resource api.ResourceName, namespace string, selector labels.Selector) (PodResourceInfo, time.Time, error)

	// GetRawMetric gets the given metric (and an associated oldest timestamp)
	// for all pods matching the specified selector in the given namespace
	GetRawMetric(metricName string, namespace string, selector labels.Selector) (PodMetricsInfo, time.Time, error)
}

MetricsClient knows how to query a remote interface to retrieve container-level resource metrics as well as pod-level arbitrary metrics

func NewHeapsterMetricsClient

func NewHeapsterMetricsClient(client clientset.Interface, namespace, scheme, service, port string) MetricsClient

type PodMetricsInfo

type PodMetricsInfo map[string]float64

PodMetricsInfo contains pod resourcemetric values as a map from pod names to metric values

type PodResourceInfo

type PodResourceInfo map[string]int64

PodResourceInfo contains pod resourcemetric values as a map from pod names to metric values

Source Files

metrics_client.go utilization.go

Version
v1.5.8-beta.0
Published
Apr 27, 2017
Platform
js/wasm
Imports
12 packages
Last checked
4 minutes ago

Tools for package owners.