trace: enhance trace experience further

This commit is contained in:
Harshavardhana 2021-03-27 13:19:14 -07:00
parent 07ab4d1250
commit 7c5b35d20f
2 changed files with 19 additions and 7 deletions

View file

@ -130,10 +130,15 @@ func WebTrace(ri *jsonrpc.RequestInfo) trace.Info {
if globalIsDistErasure {
t.NodeName = globalLocalNodeName
}
if t.NodeName == "" {
t.NodeName = globalLocalNodeName
}
// strip port from the host address
if host, _, err := net.SplitHostPort(t.NodeName); err == nil {
t.NodeName = host
// strip only standard port from the host address
if host, port, err := net.SplitHostPort(t.NodeName); err == nil {
if port == "443" || port == "80" {
t.NodeName = host
}
}
vars := mux.Vars(r)
@ -196,9 +201,16 @@ func Trace(f http.HandlerFunc, logBody bool, w http.ResponseWriter, r *http.Requ
if globalIsDistErasure {
t.NodeName = globalLocalNodeName
}
// strip port from the host address
if host, _, err := net.SplitHostPort(t.NodeName); err == nil {
t.NodeName = host
if t.NodeName == "" {
t.NodeName = globalLocalNodeName
}
// strip only standard port from the host address
if host, port, err := net.SplitHostPort(t.NodeName); err == nil {
if port == "443" || port == "80" {
t.NodeName = host
}
}
rq := trace.RequestInfo{

View file

@ -66,7 +66,7 @@ func updateOSMetrics(s osMetric, paths ...string) func() {
return func() {
duration := time.Since(startTime)
globalTrace.Publish(osTrace(s, startTime, duration, strings.Join(paths, " ")))
globalTrace.Publish(osTrace(s, startTime, duration, strings.Join(paths, " -> ")))
}
}