prometheus_helper

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractFqName

func ExtractFqName(metric string) (string, error)

ExtractFqName extracts the fqName from a prometheus.Desc string. This is useful for testing collectors.

func ExtractValueFromMetric added in v1.0.2

func ExtractValueFromMetric(metric prometheus.Metric) (float64, error)

ExtractValueFromMetric extracts the value from a prometheus.Metric object. It creates a custom collector and registry, registers the given metric, and then collects the metric value using the registry. Returns the extracted float64 value from the metric's Gauge.

Types

type SimpleDescHelper

type SimpleDescHelper struct {
	Namespace string
	Subsystem string
}

SimpleDescHelper is a helper struct that can be used to create prometheus.Desc objects

func (*SimpleDescHelper) NewDescWithHelp

func (h *SimpleDescHelper) NewDescWithHelp(name string, help string) *prometheus.Desc

NewDescWithHelp creates a new prometheus.Desc with the namespace and subsystem.

func (*SimpleDescHelper) NewDescWithHelpAndLabels added in v1.1.0

func (h *SimpleDescHelper) NewDescWithHelpAndLabels(name string, help string, labels ...string) *prometheus.Desc

NewDescWithLabel creates a new prometheus.Desc with the namespace and subsystem. Labels are used to differentiate between different sources of the same metric.

Jump to

Keyboard shortcuts

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