mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-11-13 17:14:23 -08:00
Cache metricsfamily help text (#3175)
Some checks failed
golangci-lint / lint (push) Has been cancelled
Some checks failed
golangci-lint / lint (push) Has been cancelled
Signed-off-by: Mark Knapp <mknapp@hudson-trading.com>
This commit is contained in:
parent
07ee8efaa4
commit
0fddfd1ba5
|
@ -253,10 +253,16 @@ func (c *textFileCollector) Update(ch chan<- prometheus.Metric) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mfHelp := make(map[string]*string)
|
||||||
for _, mf := range parsedFamilies {
|
for _, mf := range parsedFamilies {
|
||||||
if mf.Help == nil {
|
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], ", "))
|
help := fmt.Sprintf("Metric read from %s", strings.Join(metricsNamesToFiles[*mf.Name], ", "))
|
||||||
mf.Help = &help
|
mf.Help = &help
|
||||||
|
mfHelp[*mf.Name] = &help
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue