fixed no metric data when length of metric item equals 1
This commit is contained in:
parent
5ef6bc1965
commit
bfd79d751b
|
@ -655,11 +655,19 @@ func getRuleMetricData( rule *alerting.Rule, filterParam *alerting.FilterParam)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
//filteredMetricData = append(filteredMetricData, md)
|
//filteredMetricData = append(filteredMetricData, md)
|
||||||
|
|
||||||
|
targetData := md.Data["result"]
|
||||||
|
if len(rule.Metrics.Items) == 1 {
|
||||||
|
for k, _ := range md.Data {
|
||||||
|
targetData = md.Data[k]
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
if sampleData == nil {
|
if sampleData == nil {
|
||||||
sampleData = md.Data["result"]
|
sampleData = targetData
|
||||||
}
|
}
|
||||||
metricItem.Lines = append(metricItem.Lines, &common.MetricLine{
|
metricItem.Lines = append(metricItem.Lines, &common.MetricLine{
|
||||||
Data: md.Data["result"],
|
Data: targetData,
|
||||||
BucketSize: filterParam.BucketSize,
|
BucketSize: filterParam.BucketSize,
|
||||||
Metric: common.MetricSummary{
|
Metric: common.MetricSummary{
|
||||||
Label: strings.Join(md.GroupValues, "-"),
|
Label: strings.Join(md.GroupValues, "-"),
|
||||||
|
|
Loading…
Reference in New Issue