Skip to content

Commit

Permalink
🚨remove warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bzd111 committed Nov 20, 2020
1 parent 4abb765 commit 74e47c4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
5 changes: 0 additions & 5 deletions exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,6 @@ func (e *Exporter) registerConstMetricGauge(ch chan<- prometheus.Metric, metric
e.registerConstMetric(ch, metric, val, prometheus.GaugeValue, labels...)
}

// register Const Metric Counter
func (e *Exporter) registerConstMetricCounter(ch chan<- prometheus.Metric, metric string, val float64, labels ...string) {
e.registerConstMetric(ch, metric, val, prometheus.CounterValue, labels...)
}

// register Const Metric
func (e *Exporter) registerConstMetric(ch chan<- prometheus.Metric, metric string, val float64, valType prometheus.ValueType, labelValues ...string) {
descr := e.metricDescriptions[metric]
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/p4gefau1t/trojan-go v0.8.2
github.com/prometheus/client_golang v1.7.1
github.com/prometheus/common v0.10.0
github.com/sirupsen/logrus v1.7.0 // indirect
github.com/sirupsen/logrus v1.7.0
golang.org/x/net v0.0.0-20200822124328-c89045814202 // indirect
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 // indirect
golang.org/x/sys v0.0.0-20201018230417-eeed37f84f13 // indirect
Expand Down
11 changes: 3 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package main

import (
"log"
"net/http"
"os"
"os/exec"
"time"

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

var opts struct {
Expand All @@ -29,19 +28,15 @@ func scrapeHandler(w http.ResponseWriter, r *http.Request) {
}

func main() {
opts.Call = func(num string) {
cmd := exec.Command("open", "callto:"+num)
cmd.Start()
cmd.Process.Release()
}

if _, err := flags.Parse(&opts); err != nil {
os.Exit(0)
}

scrapeTimeout := time.Duration(opts.ScrapeTimeoutInSeconds) * time.Second
exporter = NewExporter(opts.V2RayEndpoint, scrapeTimeout)
http.Handle("/metrics", promhttp.Handler())
http.HandleFunc("/scrape", scrapeHandler)

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

0 comments on commit 74e47c4

Please sign in to comment.