mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
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:
@@ -127,7 +127,7 @@ func WebTrace(ri *jsonrpc.RequestInfo) trace.Info {
|
||||
t := trace.Info{FuncName: name}
|
||||
t.NodeName = r.Host
|
||||
if globalIsDistErasure {
|
||||
t.NodeName = GetLocalPeer(globalEndpoints)
|
||||
t.NodeName = globalLocalNodeName
|
||||
}
|
||||
|
||||
// strip port from the host address
|
||||
@@ -191,7 +191,7 @@ func Trace(f http.HandlerFunc, logBody bool, w http.ResponseWriter, r *http.Requ
|
||||
r.Body = ioutil.NopCloser(reqBodyRecorder)
|
||||
t.NodeName = r.Host
|
||||
if globalIsDistErasure {
|
||||
t.NodeName = GetLocalPeer(globalEndpoints)
|
||||
t.NodeName = globalLocalNodeName
|
||||
}
|
||||
// strip port from the host address
|
||||
if host, _, err := net.SplitHostPort(t.NodeName); err == nil {
|
||||
|
||||
Reference in New Issue
Block a user