Browse Source

Don;t launch Prometheus server if Prometheus binding is not provided

DarthSim 6 years ago
parent
commit
08c9077fe4
1 changed files with 4 additions and 0 deletions
  1. 4 0
      prometheus.go

+ 4 - 0
prometheus.go

@@ -20,6 +20,10 @@ var (
 )
 )
 
 
 func initPrometheus() {
 func initPrometheus() {
+	if len(conf.PrometheusBind) == 0 {
+		return
+	}
+
 	prometheusRequestsTotal = prometheus.NewCounter(prometheus.CounterOpts{
 	prometheusRequestsTotal = prometheus.NewCounter(prometheus.CounterOpts{
 		Name: "requests_total",
 		Name: "requests_total",
 		Help: "A counter of the total number of HTTP requests imgproxy processed.",
 		Help: "A counter of the total number of HTTP requests imgproxy processed.",