elastic: backend: handle naming bucket_scripts (#60460)

This commit is contained in:
Gábor Farkas
2023-01-04 15:26:57 +01:00
committed by GitHub
parent 72d257ed4f
commit 12c4098bcd
3 changed files with 13 additions and 14 deletions

View File

@ -592,8 +592,8 @@ func getFieldName(dataField data.Field, target *Query, metricTypeCount int) stri
return frameName
}
// todo, if field and pipelineAgg
if field != "" && isPipelineAgg(metricType) {
if isPipelineAggWithMultipleBucketPaths(metricType) {
if isPipelineAgg(metricType) {
if metricType != "" && isPipelineAggWithMultipleBucketPaths(metricType) {
metricID := ""
if v, ok := dataField.Labels["metricId"]; ok {
metricID = v
@ -612,15 +612,17 @@ func getFieldName(dataField data.Field, target *Query, metricTypeCount int) stri
}
}
} else {
found := false
for _, metric := range target.Metrics {
if metric.ID == field {
metricName += " " + describeMetric(metric.Type, field)
found = true
if field != "" {
found := false
for _, metric := range target.Metrics {
if metric.ID == field {
metricName += " " + describeMetric(metric.Type, field)
found = true
}
}
if !found {
metricName = "Unset"
}
}
if !found {
metricName = "Unset"
}
}
} else if field != "" {