Grafana Table not showing the percentage correctly

Hi,

I’m trying to setup a table panel in Grafana (version 8.0.5) that shows the percentage of our CPU and Memory usages. For example I’m using the following prometheus query:

(quantile by (pod) (0.90, (container_memory_working_set_bytes{container!="",namespace!~"kube-system|monitoring",image!=""})))
/
(sum by(pod) (kube_pod_container_resource_requests{container!="",namespace!~"kube-system|monitoring",resource="memory"}))

And I’ve also put an override on that field stating it should use percent (0.0-1.0), with 2 decimals.

However it looks like I’m still doing something wrong as it’s not working correctly (see Request % in last column):

Any help would be appreciated!
Thx in advance!

Jeff Van Nijlen

welcome to the :grafana: forum, @jeffvannijlen

what does the raw data look like when it comes into Grafana? Do you need to change unit to Percent (0.0-1.0). As it is, 0.9 is between 0 and 75, so I’m not surprised it shows green. Have you tried setting the unit as Percent 0-100?

Hello @mattabrams,

The raw data is 0.96875. To my understanding selecting Percent (0.0-1.0) would have this shown as 96,87% or 96,88% (depending on the rounding). The fact that the color is still green is not one of my concerns yet. First of all I’m trying grafana to show the data correctly in a percentage way. I’ll adjust the color scheme afterwards.

And yes, I already tried setting it to Percent (0 - 100), but it still shows it the same way.
Looks like the conversion to percentage and decimals isn’t done correctly.

Best regards,

Jeff

I would inspect this panel and see how yours differs. Seems to work on our sandbox instance.
https://play.grafana.org/d/8B57fXL7k/value-mapping-color-in-table?orgId=1

Hi @mattabrams,

Thx for this. I’ve been experimenting with the same values as on your sandbox.
And I’ve noticed it might be the version of grafana (v8.0.5) what is causing the problem.

In this version I’m able to show the percentages Percent (0.0-1.0) correctly. But as soon as I add a value mapping for the colors, it doesn’t show the colors correctly anymore.

I will take a look to upgrade our grafana and come back to you.

1 Like

please do! thx @jeffvannijlen

After upgrading Grafana it did work.
Thx @mattabrams