promutil

package
v0.0.0-...-a95d382 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnyToLabels

func AnyToLabels(a interface{}) (map[string]string, error)

AnyToLabels will create prometheus labels based on the fields of the interface passed. Note that this method is quite expensive and should only be used when absolutely necessary.

func KubeAnnotationsToLabels

func KubeAnnotationsToLabels(labels map[string]string) ([]string, []string)

Converts kubernetes annotations into prometheus labels.

func KubeLabelsToLabels

func KubeLabelsToLabels(labels map[string]string) ([]string, []string)

Converts kubernetes labels into prometheus labels.

func KubePrependQualifierToLabels

func KubePrependQualifierToLabels(m map[string]string, qualifier string) ([]string, []string)

Prepends a qualifier string to the keys provided in the m map and returns the new keys and values.

func LabelNamesFrom

func LabelNamesFrom(labels map[string]string) []string

LabelNamesFrom accepts a mapping of labels to values and returns the label names.

func MapToLabels

func MapToLabels(m interface{}) map[string]string

MapToLabels accepts a map type, and will return a new map containing all the nested fields separated by _ with string versions of the values.

func SanitizeLabelName

func SanitizeLabelName(s string) string

Replaces all illegal prometheus label characters with _

func SanitizeLabels

func SanitizeLabels(labels map[string]string) map[string]string

SanitizeLabels sanitizes all label names in the given map. This may cause collisions, which is intentional as collisions that are not caught prior to attempted emission will cause fatal errors. In the case of a collision, the last value seen will be set, and all previous values will be overwritten.

Types

This section is empty.

Jump to

Keyboard shortcuts

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