add nodeName and path properly for os/storage calls (#3670)

This commit is contained in:
Harshavardhana
2021-03-28 08:07:34 -07:00
committed by GitHub
parent 9914d28527
commit 6074aa43ff
3 changed files with 22 additions and 22 deletions
+19 -19
View File
@@ -353,14 +353,14 @@ func shortTrace(ti madmin.ServiceTraceInfo) shortTraceMsg {
switch t.TraceType {
case trace.Storage:
s.Path = t.StorageStats.Path
s.Host = t.NodeName
s.StorageStats.Duration = t.StorageStats.Duration
case trace.OS:
s.Path = t.OSStats.Path
s.Host = t.NodeName
s.OSStats.Duration = t.OSStats.Duration
case trace.HTTP:
if host, ok := t.ReqInfo.Headers["Host"]; ok {
s.Host = strings.Join(host, "")
}
s.Host = t.NodeName
s.Path = t.ReqInfo.Path
s.Query = t.ReqInfo.RawQuery
s.StatusCode = t.RespInfo.StatusCode
@@ -389,26 +389,26 @@ func (s shortTraceMsg) String() string {
var hostStr string
var b = &strings.Builder{}
switch s.Type {
case trace.Storage:
fmt.Fprintf(b, "[%s] %s %s %2s", console.Colorize("RespStatus", "STORAGE"), console.Colorize("FuncName", s.FuncName),
s.Path,
console.Colorize("HeaderValue", s.StorageStats.Duration))
return b.String()
case trace.OS:
fmt.Fprintf(b, "[%s] %s %s %2s", console.Colorize("RespStatus", "OS"), console.Colorize("FuncName", s.FuncName),
s.Path,
console.Colorize("HeaderValue", s.OSStats.Duration))
return b.String()
}
// HTTP trace
if s.Host != "" {
hostStr = colorizedNodeName(s.Host)
}
fmt.Fprintf(b, "%s ", s.Time.Format(timeFormat))
switch s.Type {
case trace.Storage:
fmt.Fprintf(b, "[%s] %s %s %s %2s", console.Colorize("RespStatus", "STORAGE"), console.Colorize("FuncName", s.FuncName),
hostStr,
s.Path,
console.Colorize("HeaderValue", s.StorageStats.Duration))
return b.String()
case trace.OS:
fmt.Fprintf(b, "[%s] %s %s %s %2s", console.Colorize("RespStatus", "OS"), console.Colorize("FuncName", s.FuncName),
hostStr,
s.Path,
console.Colorize("HeaderValue", s.OSStats.Duration))
return b.String()
}
statusStr := fmt.Sprintf("%d %s", s.StatusCode, s.StatusMsg)
if s.StatusCode >= http.StatusBadRequest {
statusStr = console.Colorize("ErrStatus", statusStr)
@@ -518,7 +518,7 @@ func (t traceMessage) String() string {
fmt.Fprintf(b, "%s %s [%s] %s %s", nodeNameStr, console.Colorize("Request", fmt.Sprintf("[STORAGE %s]", trc.FuncName)), trc.Time.Format(timeFormat), trc.StorageStats.Path, trc.StorageStats.Duration)
return b.String()
case trace.OS:
fmt.Fprintf(b, "%s %s [%s] %s %s", nodeNameStr, console.Colorize("Request", fmt.Sprintf("[POSIX %s]", trc.FuncName)), trc.Time.Format(timeFormat), trc.OSStats.Path, trc.OSStats.Duration)
fmt.Fprintf(b, "%s %s [%s] %s %s", nodeNameStr, console.Colorize("Request", fmt.Sprintf("[OS %s]", trc.FuncName)), trc.Time.Format(timeFormat), trc.OSStats.Path, trc.OSStats.Duration)
return b.String()
}
+1 -1
View File
@@ -14,7 +14,7 @@ require (
github.com/mattn/go-isatty v0.0.12
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/minio/cli v1.22.0
github.com/minio/minio v0.0.0-20210327062407-d8b5adfd1013
github.com/minio/minio v0.0.0-20210327170707-07ab4d1250b7
github.com/minio/minio-go/v7 v7.0.11-0.20210319012211-5a0d16291a2e
github.com/minio/sha256-simd v1.0.0
github.com/mitchellh/go-homedir v1.1.0
+2 -2
View File
@@ -332,8 +332,8 @@ github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLT
github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw=
github.com/minio/md5-simd v1.1.1 h1:9ojcLbuZ4gXbB2sX53MKn8JUZ0sB/2wfwsEcRw+I08U=
github.com/minio/md5-simd v1.1.1/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw=
github.com/minio/minio v0.0.0-20210327062407-d8b5adfd1013 h1:5949AasP1UUih05Gsgm8lOTSIFnPHmTniiOI/Dh4XXY=
github.com/minio/minio v0.0.0-20210327062407-d8b5adfd1013/go.mod h1:UZQwUr4doAT+EfExXJDdOBGhnnas1/97/WPdUGQpG7g=
github.com/minio/minio v0.0.0-20210327170707-07ab4d1250b7 h1:7MyfU27pOxETXjVeNFlg3ucs583jTu772LVjBifFSNw=
github.com/minio/minio v0.0.0-20210327170707-07ab4d1250b7/go.mod h1:UZQwUr4doAT+EfExXJDdOBGhnnas1/97/WPdUGQpG7g=
github.com/minio/minio-go/v7 v7.0.11-0.20210302210017-6ae69c73ce78/go.mod h1:mTh2uJuAbEqdhMVl6CMIIZLUeiMiWtJR4JB8/5g2skw=
github.com/minio/minio-go/v7 v7.0.11-0.20210319012211-5a0d16291a2e h1:IH4CNckd+Z+h5W9ee4QEoRD/fyw9o330PVy9l5Ogd4U=
github.com/minio/minio-go/v7 v7.0.11-0.20210319012211-5a0d16291a2e/go.mod h1:mTh2uJuAbEqdhMVl6CMIIZLUeiMiWtJR4JB8/5g2skw=