Set Envoy request duration to ms

This commit is contained in:
stefanprodan
2019-04-12 16:25:34 +03:00
parent c651ef00c9
commit e091d6a50d
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -114,6 +114,6 @@ func (c *Observer) GetEnvoyRequestDuration(name string, namespace string, metric
if rate == nil {
return 0, fmt.Errorf("no values found for metric %s", metric)
}
ms := time.Duration(int64(*rate*1000)) * time.Millisecond
ms := time.Duration(int64(*rate)) * time.Millisecond
return ms, nil
}
+1 -1
View File
@@ -29,7 +29,7 @@ func TestCanaryObserver_GetEnvoySuccessRate(t *testing.T) {
func TestCanaryObserver_GetEnvoyRequestDuration(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
json := `{"status":"success","data":{"resultType":"vector","result":[{"metric":{},"value":[1545905245.596,"0.2"]}]}}`
json := `{"status":"success","data":{"resultType":"vector","result":[{"metric":{},"value":[1545905245.596,"200"]}]}}`
w.Write([]byte(json))
}))
defer ts.Close()