Skip to content

Commit

Permalink
added build info to metrics
Browse files Browse the repository at this point in the history
Signed-off-by: Kris Budde <Kris.Budde@gmail.com>
  • Loading branch information
kbudde committed Jul 17, 2016
1 parent 3b8784d commit 48a239a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,6 @@ func (e *exporter) Collect(ch chan<- prometheus.Metric) {
for _, countervec := range e.queueMetricsCounter {
countervec.Collect(ch)
}

BuildInfo.Collect(ch)
}
21 changes: 21 additions & 0 deletions version.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
package main

import "github.com/prometheus/client_golang/prometheus"

var (
Version string
Revision string
Branch string
BuildDate string
)

//BuildInfo is a metric with a constant '1' value labeled by version, revision, branch and build date on which the rabbitmq_exporter was built
var BuildInfo *prometheus.GaugeVec

func init() {
BuildInfo = newBuildInfo()
}

func newBuildInfo() *prometheus.GaugeVec {
metric := prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "rabbitmq_exporter_build_info",
Help: "A metric with a constant '1' value labeled by version, revision, branch and build date on which the rabbitmq_exporter was built.",
},
[]string{"version", "revision", "branch", "builddate"},
)
metric.WithLabelValues(Version, Revision, Branch, BuildDate).Set(1)
return metric
}

0 comments on commit 48a239a

Please sign in to comment.