In Grafana Cloud I have an Elasticsearch data source.
I want to get a success percentage value displayed from 2 queries:
A: count of all logs where the field ‘action’ equals ‘advance’ (total)
B: count of all logs where ‘action’ = ‘advance’ AND http.status_code = 200 (total success)
Then in the expression I want to do the basic Math: ($B / $A) * 100
I have also tried using a Binary Operation Transformation to add a new field from Calculation, but this has the same result.
I suspect that it could be influenced by the Value Options settings for my original 2 queries. Here I need to use a “Total” calculation to get the actual log counts for the queries:
And if we look at the table view it looks like the final calculation is just summed after being applied to each time series interval:
I need to find a way to isolate the totals for the original queries and then be able to get the “success percentage” for the totals, effectively bypassing the individual timeseries transform values.
Has anyone managed to get this to work?