diff --git a/Makefile b/Makefile index 0a1f102..eda1bea 100644 --- a/Makefile +++ b/Makefile @@ -13,5 +13,6 @@ VERSION := 0.1.0 TARGET := memcache_exporter +GOFLAGS := -ldflags "-X main.Version=$(VERSION)" include Makefile.COMMON diff --git a/main.go b/main.go index c2f6849..125788c 100644 --- a/main.go +++ b/main.go @@ -8,8 +8,8 @@ import ( "sync" "github.com/Snapbug/gomemcache/memcache" - "github.com/golang/glog" "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/log" ) const ( @@ -17,6 +17,8 @@ const ( ) var ( + Version = "0.0.0" + cacheOperations = []string{"get", "delete", "incr", "decr", "cas", "touch"} cacheStatuses = []string{"hits", "misses"} usageTimes = []string{"curr", "total"} @@ -125,7 +127,7 @@ func (e *Exporter) Collect(ch chan<- prometheus.Metric) { if err != nil { e.up.Set(0) ch <- e.up - glog.Infof("Failed to collect stats from memcache: %s", err) + log.Infof("Failed to collect stats from memcache: %s", err) return } @@ -198,7 +200,6 @@ func main() { listenAddress = flag.String("web.listen-address", ":9106", "Address to listen on for web interface and telemetry.") metricsPath = flag.String("web.telemetry-path", "/metrics", "Path under which to expose metrics.") ) - flag.Parse() for _, server := range flag.Args() { @@ -216,5 +217,6 @@ func main() { `)) }) - glog.Fatal(http.ListenAndServe(*listenAddress, nil)) + log.Infof("Starting memcache_exporter v%s at %s", Version, *listenAddress) + log.Fatal(http.ListenAndServe(*listenAddress, nil)) }