Skip to content

Commit

Permalink
Use prometheus/log for logging
Browse files Browse the repository at this point in the history
  • Loading branch information
grobie committed Apr 27, 2016
1 parent cb11044 commit 8f4163d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@

VERSION := 0.1.0
TARGET := memcache_exporter
GOFLAGS := -ldflags "-X main.Version=$(VERSION)"

include Makefile.COMMON
10 changes: 6 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ import (
"sync"

"github.com/Snapbug/gomemcache/memcache"
"github.com/golang/glog"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/log"
)

const (
namespace = "memcache"
)

var (
Version = "0.0.0"

cacheOperations = []string{"get", "delete", "incr", "decr", "cas", "touch"}
cacheStatuses = []string{"hits", "misses"}
usageTimes = []string{"curr", "total"}
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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() {
Expand All @@ -216,5 +217,6 @@ func main() {
</body>
</html>`))
})
glog.Fatal(http.ListenAndServe(*listenAddress, nil))
log.Infof("Starting memcache_exporter v%s at %s", Version, *listenAddress)
log.Fatal(http.ListenAndServe(*listenAddress, nil))
}

0 comments on commit 8f4163d

Please sign in to comment.