From 467e83722a35e81d067eee5b51d3a417cf2a2feb Mon Sep 17 00:00:00 2001 From: Calle Pettersson Date: Sun, 29 Apr 2018 16:53:34 +0200 Subject: [PATCH] Add process_start_time_seconds for the exporter itself --- exporter.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/exporter.go b/exporter.go index 203baf5a..94586c9a 100644 --- a/exporter.go +++ b/exporter.go @@ -44,6 +44,16 @@ var ( []string{"collector"}, nil, ) + + // This can be removed when client_golang exposes this on Windows + // (See https://github.com/prometheus/client_golang/issues/376) + startTime = float64(time.Now().Unix()) + startTimeDesc = prometheus.NewDesc( + "process_start_time_seconds", + "Start time of the process since unix epoch in seconds.", + nil, + nil, + ) ) // Describe sends all the descriptors of the collectors included to @@ -65,6 +75,12 @@ func (coll WmiCollector) Collect(ch chan<- prometheus.Metric) { wg.Done() }(name, c) } + + ch <- prometheus.MustNewConstMetric( + startTimeDesc, + prometheus.CounterValue, + startTime, + ) wg.Wait() }