2018-03-21 02:28:10 +01:00
|
|
|
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,
|
|
|
|
)
|
|
|
|
}
|
2018-04-11 15:21:38 +02:00
|
|
|
|
|
|
|
func description(prefix, name, helpText string, labelNames []string) *prometheus.Desc {
|
|
|
|
return prometheus.NewDesc(
|
|
|
|
prometheus.BuildFQName(namespace, prefix, name),
|
|
|
|
helpText,
|
|
|
|
labelNames,
|
|
|
|
nil,
|
|
|
|
)
|
|
|
|
}
|