diff --git a/collector/textfile.go b/collector/textfile.go index ab0c3a7d..6d525ae2 100644 --- a/collector/textfile.go +++ b/collector/textfile.go @@ -56,7 +56,10 @@ func NewTextFileCollector() (Collector, error) { // the flag is not passed. log.Infof("No directory specified, see --collector.textfile.directory") } else { - prometheus.SetMetricFamilyInjectionHook(c.parseTextFiles) + prometheus.DefaultGatherer = prometheus.Gatherers{ + prometheus.DefaultGatherer, + prometheus.GathererFunc(func() ([]*dto.MetricFamily, error) { return c.parseTextFiles(), nil }), + } } return c, nil