INNER CODE UNIT · Go
typeof
projectcontour/contour · hack/generate-metrics-doc.go:45
func typeof(mf *dto.MetricFamily) string {
switch t := mf.GetType(); t {
case dto.MetricType_COUNTER, dto.MetricType_GAUGE,
dto.MetricType_SUMMARY, dto.MetricType_HISTOGRAM:
return fmt.Sprintf(
"[%s](https://prometheus.io/docs/concepts/metric_types/#%s)",
t.String(), strings.ToLower(t.String()))
default:
return t.String()
}
}
// Executes promlint for metrics static analysis
func runPromlint(family []*dto.MetricFamily) {
linter := promlint.NewWithMetricFamilies(family)
problems, err := linter.Lint()
if err != nil {
log.Fatalf("promlint failed: %s", err)