Merge pull request #1148 from cdlliuy/add_canary_analysis_result_as_metric

Add canary analysis result as Prometheus metrics
This commit is contained in:
Stefan Prodan
2022-04-06 07:57:23 +03:00
committed by GitHub
3 changed files with 22 additions and 1 deletions
+5 -1
View File
@@ -146,7 +146,7 @@ func (c *Controller) runBuiltinMetricChecks(canary *flaggerv1.Canary) bool {
}
return false
}
c.recorder.SetAnalysis(canary, metric.Name, val)
if metric.ThresholdRange != nil {
tr := *metric.ThresholdRange
if tr.Min != nil && val < *tr.Min {
@@ -177,6 +177,7 @@ func (c *Controller) runBuiltinMetricChecks(canary *flaggerv1.Canary) bool {
}
return false
}
c.recorder.SetAnalysis(canary, metric.Name, val.Seconds())
if metric.ThresholdRange != nil {
tr := *metric.ThresholdRange
if tr.Min != nil && val < time.Duration(*tr.Min)*time.Millisecond {
@@ -209,6 +210,7 @@ func (c *Controller) runBuiltinMetricChecks(canary *flaggerv1.Canary) bool {
}
return false
}
c.recorder.SetAnalysis(canary, metric.Name, val)
if metric.ThresholdRange != nil {
tr := *metric.ThresholdRange
if tr.Min != nil && val < *tr.Min {
@@ -283,6 +285,8 @@ func (c *Controller) runMetricChecks(canary *flaggerv1.Canary) bool {
return false
}
c.recorder.SetAnalysis(canary, metric.Name, val)
if metric.ThresholdRange != nil {
tr := *metric.ThresholdRange
if tr.Min != nil && val < *tr.Min {