Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Grafana expression suddently says 2 items dropped from union(s)

After upgrading from Grafana 10.1 to 10.2, some panels stopped working.
More specifically, the expression $A + $B * -1 stopped working and gave a warning:

2 items dropped from union(s): ...

enter image description here
Any idea why?

I am no promql ninja, is there a way to get those metrics in a single query?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

I don’t know why it stopped working, and if I had to guess, I’d say it shouldn’t be working at all. Reasoning: your metrics have different labelsets.

If all you need is to get result of subtraction of metric with "positive" label from "negative" one, you can use following promql query:

badin42_energy_power{direction="negative"} - ignoring(direction) badin42_energy_power{direction="positive"}

Here we are using ignoring keyword, to make Prometheus match two metrics based on all labels except for the direction.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading