prometheus

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCompliantName added in v0.49.0

func BuildCompliantName(metric pmetric.Metric, namespace string, addMetricSuffixes bool) string

BuildCompliantName builds a Prometheus-compliant metric name for the specified metric

Metric name is prefixed with specified namespace and underscore (if any). Namespace is not cleaned up. Make sure specified namespace follows Prometheus naming convention.

See rules at https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels and https://prometheus.io/docs/practices/naming/#metric-and-label-naming

func CleanUpString

func CleanUpString(s string) string

Clean up specified string so it's Prometheus compliant

func NormalizeLabel

func NormalizeLabel(label string) string

Normalizes the specified label to follow Prometheus label names standard

See rules at https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels

Labels that start with non-letter rune will be prefixed with "key_"

Exception is made for double-underscores which are allowed

func RemovePromForbiddenRunes

func RemovePromForbiddenRunes(s string) string

func TrimPromSuffixes

func TrimPromSuffixes(promName string, metricType pmetric.MetricType, unit string) string

TrimPromSuffixes trims type and unit prometheus suffixes from a metric name. Following the OpenTelemetry specs for converting Prometheus Metric points to OTLP.

func UnitWordToUCUM added in v0.49.0

func UnitWordToUCUM(unit string) string

UnitWordToUCUM converts english unit words to UCUM units: https://ucum.org/ucum#section-Alphabetic-Index-By-Symbol It also handles rates, such as meters_per_second, by translating the first word to UCUM, and the "per" word to UCUM. It joins them with a "/" between.

Types

This section is empty.

Jump to

Keyboard shortcuts

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