Documentation ¶
Index ¶
- func BuildCompliantName(metric pmetric.Metric, namespace string, addMetricSuffixes bool) string
- func CleanUpString(s string) string
- func NormalizeLabel(label string) string
- func RemovePromForbiddenRunes(s string) string
- func TrimPromSuffixes(promName string, metricType pmetric.MetricType, unit string) string
- func UnitWordToUCUM(unit string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildCompliantName ¶
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 ¶
Clean up specified string so it's Prometheus compliant
func NormalizeLabel ¶
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 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 ¶
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.