Differentiate between target and target average value

This commit is contained in:
Beata Skiba
2018-02-26 18:27:14 +01:00
parent afe1724695
commit d003550bd2
3 changed files with 5 additions and 5 deletions

View File

@@ -2830,13 +2830,13 @@ func describeHorizontalPodAutoscaler(hpa *autoscaling.HorizontalPodAutoscaler, e
hpa.Status.CurrentMetrics[i].External.CurrentAverageValue != nil {
current = hpa.Status.CurrentMetrics[i].External.CurrentAverageValue.String()
}
w.Write(LEVEL_1, "%q:\t%s / %s\n", metric.External.MetricName, current, metric.External.TargetAverageValue.String())
w.Write(LEVEL_1, "%q (target average value):\t%s / %s\n", metric.External.MetricName, current, metric.External.TargetAverageValue.String())
} else {
current := "<unknown>"
if len(hpa.Status.CurrentMetrics) > i && hpa.Status.CurrentMetrics[i].External != nil {
current = hpa.Status.CurrentMetrics[i].External.CurrentValue.String()
}
w.Write(LEVEL_1, "%q:\t%s / %s\n", metric.External.MetricName, current, metric.External.TargetValue.String())
w.Write(LEVEL_1, "%q (target value):\t%s / %s\n", metric.External.MetricName, current, metric.External.TargetValue.String())
}
case autoscaling.PodsMetricSourceType:

View File

@@ -1497,7 +1497,7 @@ func formatHPAMetrics(specs []autoscaling.MetricSpec, statuses []autoscaling.Met
if len(statuses) > i && statuses[i].External != nil && statuses[i].External.CurrentAverageValue != nil {
current = statuses[i].External.CurrentAverageValue.String()
}
list = append(list, fmt.Sprintf("%s/%s", current, spec.External.TargetAverageValue.String()))
list = append(list, fmt.Sprintf("%s/%s (avg)", current, spec.External.TargetAverageValue.String()))
} else {
current := "<unknown>"
if len(statuses) > i && statuses[i].External != nil {

View File

@@ -2200,7 +2200,7 @@ func TestPrintHPA(t *testing.T) {
DesiredReplicas: 5,
},
},
"some-hpa\tReplicationController/some-rc\t<unknown>/100m\t2\t10\t4\t<unknown>\n",
"some-hpa\tReplicationController/some-rc\t<unknown>/100m (avg)\t2\t10\t4\t<unknown>\n",
},
// external source type, target average value
{
@@ -2247,7 +2247,7 @@ func TestPrintHPA(t *testing.T) {
},
},
},
"some-hpa\tReplicationController/some-rc\t50m/100m\t2\t10\t4\t<unknown>\n",
"some-hpa\tReplicationController/some-rc\t50m/100m (avg)\t2\t10\t4\t<unknown>\n",
},
// external source type, target value (no current)
{