diff options
author | Brian Brazil <brian.brazil@boxever.com> | 2014-10-29 14:16:43 +0000 |
---|---|---|
committer | Brian Brazil <brian.brazil@boxever.com> | 2014-10-29 17:00:36 +0000 |
commit | 1c17481a4289a81b70e482fcf1d4a432da87c5de (patch) | |
tree | 04a2cab6137c5fcb34e1322dfdaac084306df8e7 /collector/time.go | |
parent | 5c15c86f77de70cbcc586a72612562eb9a966dda (diff) | |
download | prometheus_node_collector-1c17481a4289a81b70e482fcf1d4a432da87c5de.tar.bz2 prometheus_node_collector-1c17481a4289a81b70e482fcf1d4a432da87c5de.tar.xz prometheus_node_collector-1c17481a4289a81b70e482fcf1d4a432da87c5de.zip |
Collect at every scrape, rather than at regular intervals.
Switch to Update using the Collecter Collect interface, due to not knowing all
metricnames in all modules beforehand we can't use Describe and thus the full
Collecter interface.
Remove 'updates', it's meaning varies by module and doesn't add much.
Diffstat (limited to 'collector/time.go')
-rw-r--r-- | collector/time.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/collector/time.go b/collector/time.go index 172de88..e63efaf 100644 --- a/collector/time.go +++ b/collector/time.go | |||
@@ -32,16 +32,13 @@ func NewTimeCollector(config Config) (Collector, error) { | |||
32 | config: config, | 32 | config: config, |
33 | } | 33 | } |
34 | 34 | ||
35 | if _, err := prometheus.RegisterOrGet(systemTime); err != nil { | ||
36 | return nil, err | ||
37 | } | ||
38 | return &c, nil | 35 | return &c, nil |
39 | } | 36 | } |
40 | 37 | ||
41 | func (c *timeCollector) Update() (updates int, err error) { | 38 | func (c *timeCollector) Update(ch chan<- prometheus.Metric) (err error) { |
42 | updates++ | ||
43 | now := time.Now() | 39 | now := time.Now() |
44 | glog.V(1).Infof("Set time: %f", now.Unix()) | 40 | glog.V(1).Infof("Set time: %f", now.Unix()) |
45 | systemTime.Set(float64(now.Unix())) | 41 | systemTime.Set(float64(now.Unix())) |
46 | return updates, err | 42 | systemTime.Collect(ch) |
43 | return err | ||
47 | } | 44 | } |