Simplify access to local node name (#11907)

The local node name is heavily used in tracing, create a new global 
variable to store it. Multiple goroutines can access it since it won't be
changed later.
This commit is contained in:
Anis Elleuch
2021-03-26 19:37:58 +01:00
committed by GitHub
parent 9efcb9e15c
commit 2c296652f7
16 changed files with 48 additions and 53 deletions
+2 -2
View File
@@ -30,7 +30,7 @@ import (
func getLocalDiskHwInfo(ctx context.Context, r *http.Request) madmin.ServerDiskHwInfo {
addr := r.Host
if globalIsDistErasure {
addr = GetLocalPeer(globalEndpoints)
addr = globalLocalNodeName
}
return madmin.ServerDiskHwInfo{
@@ -42,7 +42,7 @@ func getLocalDiskHwInfo(ctx context.Context, r *http.Request) madmin.ServerDiskH
func getLocalOsInfo(ctx context.Context, r *http.Request) madmin.ServerOsInfo {
addr := r.Host
if globalIsDistErasure {
addr = GetLocalPeer(globalEndpoints)
addr = globalLocalNodeName
}
return madmin.ServerOsInfo{