ocket8888 commented on code in PR #7608:
URL: https://github.com/apache/trafficcontrol/pull/7608#discussion_r1251100251


##########
traffic_monitor/cache/cache_test.go:
##########
@@ -95,3 +100,37 @@ func TestComputeStatGbps(t *testing.T) {
                }
        }
 }
+
+func TestParseAndDecode(t *testing.T) {
+       file, err := ioutil.ReadFile("stats_over_http.json")
+       if err != nil {
+               t.Fatal(err)
+       }
+
+       pl := &poller.HTTPPollCtx{HTTPHeader: http.Header{}}
+       ctx := interface{}(pl)
+       ctx.(*poller.HTTPPollCtx).HTTPHeader.Set("Content-Type", "text/json")

Review Comment:
   `text/json` is not an IANA-standard MIME-type. I think you mean 
`application/json`.
   
   Which is a nice segue into mentioning that these should be using the 
relevant constants from the [`github.com/apache/trafficcontrol/lib/go-rfc` 
package](https://pkg.go.dev/github.com/apache/trafficcontrol/lib/go-rfc#pkg-constants)



##########
traffic_monitor/cache/cache.go:
##########
@@ -306,6 +307,17 @@ func (handler Handler) Handle(id string, rdr io.Reader, 
format string, reqTime t
                handler.resultChan <- result
                return
        }
+       if val, ok := miscStats["plugin.system_stats.timestamp_ms"]; ok {
+               valString := fmt.Sprintf("%s", val)

Review Comment:
   If you're doing `%s` successfully, then `val` must be either a string or a 
`fmt.Stringer` - why not just use the string value instead of relying on 
reflective formatting?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to