'Grafana duplicates labels based on all possible labels permutations
I have Prometheus + Grafana setup. Prometheus collects Counter and gives it two labels:
- Message_Type - from 1 to 27
- Provider - one from
['A', 'B', 'C', ... , 'I'](length is 9)
I imported it into Grafana and applied Labels to fields transformation on Message_Type and expected to see 27 lines.
What I actually see is 27*9 = 243 entries! I think Grafana created all possible permutations:
+-----+--------------+----------+
| NUM | Message_Type | Provider |
+-----+--------------+----------+
| 1 | 1 | A |
| 2 | 1 | B |
| 3 | 1 | C |
| ... | ... | ... |
| 9 | 1 | I |
| 10 | 2 | A |
| ... | ... | ... |
| 243 | 9 | I |
+-----+--------------+----------+
This is how it looks in Grafana:

How to merge these labels so that there are no duplicates?
Solution 1:[1]
It would help if you added your Prometheus query to your question. In order to group metrics by the same field Message_Type in the legend you can do something like the following:
count(<your_query>) by (Message_Type)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | qq4 |
