aboutsummaryrefslogtreecommitdiff
path: root/weed/stats/metrics.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/stats/metrics.go')
-rw-r--r--weed/stats/metrics.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/weed/stats/metrics.go b/weed/stats/metrics.go
index 46a2a43ec..a6e96d496 100644
--- a/weed/stats/metrics.go
+++ b/weed/stats/metrics.go
@@ -1,6 +1,8 @@
package stats
import (
+ "fmt"
+ "os"
"time"
"github.com/chrislusf/seaweedfs/weed/glog"
@@ -87,3 +89,11 @@ func loopPushMetrics(name, instance string, gatherer *prometheus.Registry, addr
time.Sleep(time.Duration(intervalSeconds) * time.Second)
}
}
+
+func SourceName(port int) string {
+ hostname, err := os.Hostname()
+ if err != nil {
+ return "unknown"
+ }
+ return fmt.Sprintf("%s_%d", hostname, port)
+}