metrics

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExporterTest

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

func NewExporterTest

func NewExporterTest(url string) ExporterTest

func (*ExporterTest) FindOneMetric

func (m *ExporterTest) FindOneMetric(
	allMetrics map[string]*dto.MetricFamily,
	name string,
	labels map[string]string,
) (*Metric, error)

FindOneMetric expects to find exactly one metric with the given name, resource name, resource namespace, and labels. If no such metric is found, or if more than one is found, an error is returned.

`resourceName` and `resourceNamespace` are the values of the `name` and `namespace` labels, respectively.

If labels is nil, only the name and namespace labels are checked.

func (*ExporterTest) Get

func (et *ExporterTest) Get() (map[string]*dto.MetricFamily, error)

Get fetches the metrics from the Prometheus endpoint and returns them as a map of metric families.

type Metric

type Metric struct {
	*dto.Metric
}

func (*Metric) LabelValue

func (m *Metric) LabelValue(name string) string

LabelValue returns the value of the label with the given name. If no such label is found, an empty string is returned.

Jump to

Keyboard shortcuts

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