refactoring

This commit is contained in:
Chris Lu committed 2019-06-15 21:46:55 -07:00
1 parent 8b43679ae3
commit ff6a6dd11e
3 files changed
+17 -12

No files matched your search

+10
View File
@@ -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)
}