mikrotik-exporter/collector/helper.go

30 lines
628 B
Go
Raw Normal View History

package collector
import (
"strings"
"github.com/prometheus/client_golang/prometheus"
)
func metricStringCleanup(in string) string {
return strings.Replace(in, "-", "_", -1)
}
func descriptionForPropertyName(prefix, property string, labelNames []string) *prometheus.Desc {
return prometheus.NewDesc(
prometheus.BuildFQName(namespace, prefix, metricStringCleanup(property)),
property,
labelNames,
nil,
)
}
func description(prefix, name, helpText string, labelNames []string) *prometheus.Desc {
return prometheus.NewDesc(
prometheus.BuildFQName(namespace, prefix, name),
helpText,
labelNames,
nil,
)
}