Reputation: 4319
I have a use case in grafana. I have a speed vs Time graph. I would like to show a histogram in grafana with 15 buckets each. The 'Y' axis instead of showing the count, should show the percentage of the total count.
How is this possible?
Upvotes: 4
Views: 11464
Reputation:
I don't know what database you are using but lets assume you are using Prometheus and your promql is similar to below:
sum (rate (container_cpu_usage_seconds_total{id!="/",namespace=~"$Namespace",pod_name=~"^$Deployment.*$"}[1m])) by (pod_name)
This gives you the cpu usage of pods in milliunite which is 1/1000 of a cpu capacity. For changing it to percent I just need to multiply it by 100 and for that I will add * 100
to the end of query.
Now the solution to your answer: if q
is your current query then you can get the percent by changing the query like this: ((q)/total) * 100
At the end as @Phil said change the units to percent.
Upvotes: 1
Reputation: 3746
In the graph panel go into the metrics pane and do the following:
This will display the left Y axis in percent.
Upvotes: 1