Prometheus: Fix field name setting for heatmap-cells type (#95097)

* add unit test

* ignore setting valueField name if the frame type is heatmap-cells

* return early
This commit is contained in:
ismail simsek
2024-10-23 16:07:00 +02:00
committed by GitHub
parent 61b9ffd324
commit 77cb47773f
2 changed files with 18 additions and 0 deletions
+6
View File
@@ -118,6 +118,12 @@ func addMetadataToMultiFrame(q *models.Query, frame *data.Frame) {
frame.Fields[1].Config = &data.FieldConfig{DisplayNameFromDS: customName}
}
// For heatmap-cells type we don't want to set field name
// prometheus native histograms have their own field name structure
if frame.Meta.Type == "heatmap-cells" {
return
}
valueField := frame.Fields[1]
if n, ok := valueField.Labels["__name__"]; ok {
valueField.Name = n