mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-11-24 16:53:14 +08:00
refactoring
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user