浏览代码

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

DarthSim 6 年之前
父节点
当前提交
08c9077fe4
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      prometheus.go

+ 4 - 0
prometheus.go

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