metrics

package
v0.13.10 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CounterForLabels

func CounterForLabels(metricName string, labels map[string]string, metrics map[string]*dto.MetricFamily) (int, error)

CounterForLabels retrieves the value of the Counter matching the given set of labels.

func ForPod

func ForPod(controller, target *corev1.Pod, namespace string) ([]map[string]*dto.MetricFamily, error)

MetricsForPod returns the parsed metrics for the given pod, scraping them from the source pod.

func GaugeForLabels

func GaugeForLabels(metricName string, labels map[string]string, metrics map[string]*dto.MetricFamily) (int, error)

GaugeForLabels retrieves the value of the Gauge matching the given set of labels.

func GreaterOrEqualThan added in v0.13.10

func GreaterOrEqualThan(min int) func(value int) error

func PrometheusPod added in v0.13.5

func PrometheusPod(cs clientset.Interface, namespace string) (*corev1.Pod, error)

PrometheusPod returns a prometheus pod.

func ValidateCounterValue added in v0.12.0

func ValidateCounterValue(check func(int) error, metricName string, labels map[string]string, allMetrics []map[string]*dto.MetricFamily) error

ValidateCounterValue checks that the value related to the given metric is at most the expectedMax value.

func ValidateGaugeValue added in v0.12.0

func ValidateGaugeValue(expectedValue int, metricName string, labels map[string]string, allMetrics []map[string]*dto.MetricFamily) error

ValidateGaugeValue checks that the value corresponding to the given metric is the same as expected value.

func ValidateGaugeValueCompare added in v0.13.10

func ValidateGaugeValueCompare(check func(int) error, metricName string, labels map[string]string, allMetrics []map[string]*dto.MetricFamily) error

ValidateGaugeValueCompare checks that the value corresponding to the given metric against the given compare function.

func ValidateOnPrometheus added in v0.13.5

func ValidateOnPrometheus(prometheusPod *corev1.Pod, query string, expected CheckType) error

ValidateOnPrometheus checks the existence of the given metric directly on prometheus pods.

Types

type CheckType added in v0.13.5

type CheckType bool
const (
	NotThere CheckType = false
	There    CheckType = true
)

type PrometheusResponse added in v0.13.5

type PrometheusResponse struct {
	Status string                 `json:"status"`
	Data   prometheusResponseData `json:"data"`
}

Jump to

Keyboard shortcuts

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