Set Istio request duration to milliseconds

This commit is contained in:
stefanprodan
2019-05-15 20:01:27 +03:00
parent fd44f1fabf
commit 5b3fd0efca
2 changed files with 11 additions and 2 deletions
+10 -1
View File
@@ -581,12 +581,19 @@ func (c *Controller) analyseCanary(r *flaggerv1.Canary) bool {
r.Name, r.Namespace, val, metric.Threshold)
return false
}
//c.recordEventInfof(r, "Check %s passed %.2f%% > %v%%", metric.Name, val, metric.Threshold)
}
if metric.Name == "request-duration" {
val, err := observer.GetRequestDuration(r.Spec.TargetRef.Name, r.Namespace, metric.Interval)
if err != nil {
c.recordEventErrorf(r, "Metrics server %s query failed: %v", c.observerFactory.Client.GetMetricsServer(), err)
if strings.Contains(err.Error(), "no values found") {
c.recordEventWarningf(r, "Halt advancement no values found for metric %s probably %s.%s is not receiving traffic",
metric.Name, r.Spec.TargetRef.Name, r.Namespace)
} else {
c.recordEventErrorf(r, "Metrics server %s query failed: %v", c.observerFactory.Client.GetMetricsServer(), err)
}
return false
}
t := time.Duration(metric.Threshold) * time.Millisecond
@@ -595,6 +602,8 @@ func (c *Controller) analyseCanary(r *flaggerv1.Canary) bool {
r.Name, r.Namespace, val, t)
return false
}
//c.recordEventInfof(r, "Check %s passed %v < %v", metric.Name, val, metric.Threshold)
}
// custom checks
+1 -1
View File
@@ -71,6 +71,6 @@ func (ob *IstioObserver) GetRequestDuration(name string, namespace string, inter
return 0, err
}
ms := time.Duration(int64(value)) * time.Millisecond
ms := time.Duration(int64(value*1000)) * time.Millisecond
return ms, nil
}