aboutsummaryrefslogtreecommitdiff
path: root/collector/collector.go
diff options
context:
space:
mode:
authorJohannes 'fish' Ziemke <github@freigeist.org>2016-12-22 17:38:25 +0100
committerJohannes 'fish' Ziemke <github@freigeist.org>2017-01-03 14:03:23 +0100
commit3db2f442ae3abffed4fec28438b4883854601131 (patch)
tree80c6ae66b6500a1ed0a3bbecd795b1e8f9fc27e7 /collector/collector.go
parent269ee7a7b467e37d88621ac798d28284b1e28ae3 (diff)
downloadprometheus_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.go11
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
17import ( 17import (
18 "github.com/prometheus/client_golang/prometheus" 18 "github.com/prometheus/client_golang/prometheus"
19 "github.com/prometheus/common/log"
19) 20)
20 21
21const Namespace = "node" 22const Namespace = "node"
22 23
23var Factories = make(map[string]func() (Collector, error)) 24var Factories = make(map[string]func() (Collector, error))
24 25
26func 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.
26type Collector interface { 31type 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.)