Browse Source

Cache metricsfamily help text (#3175)

Signed-off-by: Mark Knapp <mknapp@hudson-trading.com>
pull/3178/head
mknapphrt 2 weeks ago committed by GitHub
parent
commit
0fddfd1ba5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      collector/textfile.go

6
collector/textfile.go

@ -253,10 +253,16 @@ func (c *textFileCollector) Update(ch chan<- prometheus.Metric) error {
}
}
mfHelp := make(map[string]*string)
for _, mf := range parsedFamilies {
if mf.Help == nil {
if help, ok := mfHelp[*mf.Name]; ok {
mf.Help = help
continue
}
help := fmt.Sprintf("Metric read from %s", strings.Join(metricsNamesToFiles[*mf.Name], ", "))
mf.Help = &help
mfHelp[*mf.Name] = &help
}
}

Loading…
Cancel
Save