diff --git a/worker/main.go b/worker/main.go index 4c10848..d89d44a 100644 --- a/worker/main.go +++ b/worker/main.go @@ -16,6 +16,7 @@ import ( ) var config common.WorkerConf +var prometheusPort int var debug, trace bool func init() { @@ -28,6 +29,7 @@ func init() { func main() { var serverAddress string flag.StringVar(&serverAddress, "s", "", "Gosbench Server IP and Port in the form '192.168.1.1:2000'") + flag.IntVar(&prometheusPort, "p", 8888, "Port on which the Prometheus Exporter will be available. Default: 8888") flag.BoolVar(&debug, "d", false, "enable debug log output") flag.BoolVar(&trace, "t", false, "enable trace log output") flag.Parse() diff --git a/worker/s3.go b/worker/s3.go index b312f19..268f3ef 100644 --- a/worker/s3.go +++ b/worker/s3.go @@ -2,6 +2,7 @@ package main import ( "context" + "fmt" "io" "net/http" @@ -50,7 +51,8 @@ func init() { mux := http.NewServeMux() mux.Handle("/metrics", pe) // http://localhost:8888/metrics - if err := http.ListenAndServe(":8888", mux); err != nil { + log.Infof("Starting Prometheus Exporter on port %d", prometheusPort) + if err := http.ListenAndServe(fmt.Sprintf(":%d", prometheusPort), mux); err != nil { log.WithError(err).Fatalf("Failed to run Prometheus /metrics endpoint:") } }()