Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Grigory Ignatyev committed Jul 6, 2018
1 parent 3e4a811 commit 2b757ac
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cmd/bash-exporter/bash-exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
)

var (
webapiMetrics *prometheus.GaugeVec
verbMetrics *prometheus.GaugeVec
)

func main() {
Expand All @@ -27,14 +27,14 @@ func main() {
flag.Parse()
pathArray := strings.Split(*path, "/")
name := strings.Split(pathArray[len(pathArray)-1], ".")[0]
webapiMetrics = prometheus.NewGaugeVec(
verbMetrics = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: fmt.Sprintf("%s_%s", *prefix, name),
Help: "tests",
},
[]string{"kind"},
[]string{"verb"},
)
prometheus.MustRegister(webapiMetrics)
prometheus.MustRegister(verbMetrics)
http.Handle("/metrics", prometheus.Handler())
go Run(int(*interval), *path, *debug)
log.Fatal(http.ListenAndServe(*addr, nil))
Expand All @@ -55,9 +55,9 @@ func Run(interval int, path string, debug bool) {
}
log.Println(string(ser))
}
webapiMetrics.Reset()
verbMetrics.Reset()
for metric, value := range o.Result {
webapiMetrics.With(prometheus.Labels{"kind": metric}).Set(float64(value))
verbMetrics.With(prometheus.Labels{"verb": metric}).Set(float64(value))
}
time.Sleep(time.Duration(interval) * time.Second)
}
Expand Down

0 comments on commit 2b757ac

Please sign in to comment.