Rakesh
Rakesh

Reputation: 93

I want Grafana to calculate the ratio of Successful vs Failed HTTP responses and plot these 2 metrics in a single graph. How can I achieve this?

I'm using Grafana-v6.4.0 (CloudWatch datasource) and it currently supports plotting all the HTTP responses but I want to graph the RATIO of Successful vs Failed HTTP responses. How can Grafana calculate this in the background and plot the result in a single graph? Any leads is appreciated.

Upvotes: 2

Views: 2934

Answers (2)

pavol.kutaj
pavol.kutaj

Reputation: 539

I'm still on Grafana 6.7.x while writing this and if just an "overview" is good enough, you can use the combination of stacking and percentage + set the Y-Max value to 100. We use it for storage (used + free); can be done for failed responses, too, and is source-agnostic (no need for CW math, etc); just use built-in visualization features. E.g., see one of the spikes of 500s resulting in ~70%s success rate (granularity of course defined elsewhere)

enter image description here

Upvotes: 0

Jan Garaj
Jan Garaj

Reputation: 28676

Calculation on the Grafana side is wrong idea generally. What if user selects time range&aggregation which returns 1M+ datapoints. All of them then will be processed by Grafana frontend = browser = very likely problem with memory usage on the user device.

The best option is to do calculation directly with used datasource. In your case CloudWatch supports metric math, so use that and let Grafana to visualize only results from that math.

Doc: https://grafana.com/docs/grafana/latest/features/datasources/cloudwatch/#metric-math-expressions

Upvotes: 2

Related Questions