diff options
author | Johannes 'fish' Ziemke <github@freigeist.org> | 2016-12-22 17:38:25 +0100 |
---|---|---|
committer | Johannes 'fish' Ziemke <github@freigeist.org> | 2017-01-03 14:03:23 +0100 |
commit | 3db2f442ae3abffed4fec28438b4883854601131 (patch) | |
tree | 80c6ae66b6500a1ed0a3bbecd795b1e8f9fc27e7 /collector/collector.go | |
parent | 269ee7a7b467e37d88621ac798d28284b1e28ae3 (diff) | |
download | prometheus_node_collector-3db2f442ae3abffed4fec28438b4883854601131.tar.bz2 prometheus_node_collector-3db2f442ae3abffed4fec28438b4883854601131.tar.xz prometheus_node_collector-3db2f442ae3abffed4fec28438b4883854601131.zip |
Limit node-exporter scope, deprecated collectors
Diffstat (limited to 'collector/collector.go')
-rw-r--r-- | collector/collector.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/collector/collector.go b/collector/collector.go index da109c9..8757f15 100644 --- a/collector/collector.go +++ b/collector/collector.go | |||
@@ -16,20 +16,19 @@ package collector | |||
16 | 16 | ||
17 | import ( | 17 | import ( |
18 | "github.com/prometheus/client_golang/prometheus" | 18 | "github.com/prometheus/client_golang/prometheus" |
19 | "github.com/prometheus/common/log" | ||
19 | ) | 20 | ) |
20 | 21 | ||
21 | const Namespace = "node" | 22 | const Namespace = "node" |
22 | 23 | ||
23 | var Factories = make(map[string]func() (Collector, error)) | 24 | var Factories = make(map[string]func() (Collector, error)) |
24 | 25 | ||
26 | func warnDeprecated(collector string) { | ||
27 | log.Warnf("The %s collector is deprecated and will be removed in the future!", collector) | ||
28 | } | ||
29 | |||
25 | // Interface a collector has to implement. | 30 | // Interface a collector has to implement. |
26 | type Collector interface { | 31 | type Collector interface { |
27 | // Get new metrics and expose them via prometheus registry. | 32 | // Get new metrics and expose them via prometheus registry. |
28 | Update(ch chan<- prometheus.Metric) (err error) | 33 | Update(ch chan<- prometheus.Metric) (err error) |
29 | } | 34 | } |
30 | |||
31 | // TODO: Instead of periodically call Update, a Collector could be implemented | ||
32 | // as a real prometheus.Collector that only gathers metrics when | ||
33 | // scraped. (However, for metric gathering that takes very long, it might | ||
34 | // actually be better to do them proactively before scraping to minimize scrape | ||
35 | // time.) | ||