prometheus

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMetric

func GetMetric(url, name string, labels map[string]string) (*io_prometheus_client.Metric, error)

GetMetric is a convenience function to issue a web request to the specified url and then select a particular metric that exactly matches the name and labels. The metric is then returned and values can be retrieved based on what type of metric it is, for example .GetCounter().GetValue()

func GetMetrics

func GetMetrics(url string) (map[string]*io_prometheus_client.MetricFamily, error)

GetMetrics issues a web request to the specified url and parses any metrics returned

func ParseReaderMetrics

func ParseReaderMetrics(input io.Reader) (map[string]*io_prometheus_client.MetricFamily, error)

func ParseStringMetrics

func ParseStringMetrics(input string) (map[string]*io_prometheus_client.MetricFamily, error)

func SelectMetric

func SelectMetric(metrics map[string]*io_prometheus_client.MetricFamily, name string, matchLabels map[string]string) (*io_prometheus_client.Metric, error)

SelectMetric retrieves a particular metric from a map of MetricFamily based on the name (key) and the provided label kv pairs. Every label kv pair on the metric must match for it to be returned For example, to match the following metric: my_metric{a="1",b="udp"} 7 name must be "my_metric", and the map of matchLabels must be exactly {"a": "1", "b": "udp"}

Types

This section is empty.

Jump to

Keyboard shortcuts

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