aboutsummaryrefslogtreecommitdiff
path: root/weed/stats/metrics.go
diff options
context:
space:
mode:
authorJiffs Maverick <jiffsmaverick@gmail.com>2022-11-24 20:22:59 +0200
committerGitHub <noreply@github.com>2022-11-24 10:22:59 -0800
commit4b0430e71d097c0de1f848b09d7aa8b4a74cb4d7 (patch)
tree086cd97678732f6dc2057779d082f1f9f1c5e662 /weed/stats/metrics.go
parent15284e2beec73ed819c3e81db450f38c2732e680 (diff)
downloadseaweedfs-4b0430e71d097c0de1f848b09d7aa8b4a74cb4d7.tar.xz
seaweedfs-4b0430e71d097c0de1f848b09d7aa8b4a74cb4d7.zip
[metrics] Add the ability to control bind ip (#4012)
Diffstat (limited to 'weed/stats/metrics.go')
-rw-r--r--weed/stats/metrics.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/weed/stats/metrics.go b/weed/stats/metrics.go
index 9f9c0c18d..a9a24ce31 100644
--- a/weed/stats/metrics.go
+++ b/weed/stats/metrics.go
@@ -282,12 +282,12 @@ func LoopPushingMetric(name, instance, addr string, intervalSeconds int) {
}
}
-func StartMetricsServer(port int) {
+func StartMetricsServer(ip string, port int) {
if port == 0 {
return
}
http.Handle("/metrics", promhttp.HandlerFor(Gather, promhttp.HandlerOpts{}))
- log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", port), nil))
+ log.Fatal(http.ListenAndServe(fmt.Sprintf("%s:%d", ip, port), nil))
}
func SourceName(port uint32) string {