diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-09-07 16:43:54 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-09-07 16:43:54 -0700 |
| commit | 0128239c0f8829bb20edd1df257840dcbfa37c0e (patch) | |
| tree | 4bf3d7a7ffc313d2c8a8547326204a632d48c4a4 /weed/stats/metrics.go | |
| parent | 35c8ea495fd21f7f10343717a5e1275782b7cae0 (diff) | |
| download | seaweedfs-0128239c0f8829bb20edd1df257840dcbfa37c0e.tar.xz seaweedfs-0128239c0f8829bb20edd1df257840dcbfa37c0e.zip | |
handle ipv6 addresses
Diffstat (limited to 'weed/stats/metrics.go')
| -rw-r--r-- | weed/stats/metrics.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/weed/stats/metrics.go b/weed/stats/metrics.go index 48d964418..1e1681f9a 100644 --- a/weed/stats/metrics.go +++ b/weed/stats/metrics.go @@ -3,8 +3,10 @@ package stats import ( "fmt" "log" + "net" "net/http" "os" + "strconv" "strings" "time" @@ -180,5 +182,5 @@ func SourceName(port uint32) string { if err != nil { return "unknown" } - return fmt.Sprintf("%s:%d", hostname, port) + return net.JoinHostPort(hostname, strconv.Itoa(int(port))) } |
