diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-06-15 21:46:55 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-06-15 21:46:55 -0700 |
| commit | ff6a6dd11e55e89dfeed0eb31da8a20a7e7e6e9f (patch) | |
| tree | f291098da59d78178238f26b3011d60c3811177a /weed/stats/metrics.go | |
| parent | 8b43679ae38c11b60678d6c93965227f84919b0b (diff) | |
| download | seaweedfs-ff6a6dd11e55e89dfeed0eb31da8a20a7e7e6e9f.tar.xz seaweedfs-ff6a6dd11e55e89dfeed0eb31da8a20a7e7e6e9f.zip | |
refactoring
Diffstat (limited to 'weed/stats/metrics.go')
| -rw-r--r-- | weed/stats/metrics.go | 10 |
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) +} |
