Skip to content

Commit

Permalink
Refactor internal stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
wi1dcard committed Dec 29, 2020
1 parent 9ccc42a commit 74f4fbb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"v2ray.com/core/app/stats/command"

"github.com/prometheus/client_golang/prometheus"
log "github.com/sirupsen/logrus"
grpc "google.golang.org/grpc"
"github.com/sirupsen/logrus"
"google.golang.org/grpc"
)

type Exporter struct {
Expand Down Expand Up @@ -66,7 +66,7 @@ func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
var up float64 = 1
if err := e.scrapeV2Ray(ch); err != nil {
up = 0
log.Warnf("Scrape failed! %s", err)
logrus.Warnf("Scrape failed: %s", err)
}

e.registerConstMetricGauge(ch, "up", up)
Expand Down Expand Up @@ -171,7 +171,7 @@ func (e *Exporter) registerConstMetric(ch chan<- prometheus.Metric, metric strin
if m, err := prometheus.NewConstMetric(descr, valType, val, labelValues...); err == nil {
ch <- m
} else {
log.Debugf("NewConstMetric() err: %s", err)
logrus.Debugf("NewConstMetric() err: %s", err)
}
}

Expand Down
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

flags "github.com/jessevdk/go-flags"
"github.com/prometheus/client_golang/prometheus/promhttp"
log "github.com/sirupsen/logrus"
"github.com/sirupsen/logrus"
)

var opts struct {
Expand Down Expand Up @@ -60,10 +60,10 @@ func main() {
</html>
`))
if err != nil {
log.Debugf("Write() err: %s", err)
logrus.Debugf("Write() err: %s", err)
}
})

log.Infof("Server is ready to handle incoming scrape requests.")
log.Fatal(http.ListenAndServe(opts.Listen, nil))
logrus.Infof("Server is ready to handle incoming scrape requests.")
logrus.Fatal(http.ListenAndServe(opts.Listen, nil))
}

0 comments on commit 74f4fbb

Please sign in to comment.