Calculate percentage along with groupBy in Grafana

1.2k Views Asked by At

I am logging a success count metric and failure count metric for every 30 seconds into graphite. In the Grafana, I am using per second and hitCount(1minute) that aggregates the count(success and failure) for every minute. Now I need to calculate the percentage of success for every minute? Any advice on how to proceed?

Also, I am using groupbyNode on the fourth metric * mentioned below.

Success metric : api.server.metric.*.success.count
Failure metric : api.server.metric.*.failure.count
1

There are 1 best solutions below

0
Jean On BEST ANSWER

Try something like this:

asPercent(api.server.metric.*.success.count,sumSeries(api.server.metric.*success.count, api.server.metric.*.failure.count),0)

or if you just have failure and success as values :

asPercent(api.server.metric.*.success.count,api.server.metric.*.*.count,0)