0

I'm using Grafana with prometheus datasource and I'm unable to calculate a success ration from 2 sums of rates. For example I have sum by (application) (rate(http_request_path_endpoint_responses{application="service1",request_path="/otp"}[5m])) / sum by (application) (rate(http_request_path_endpoint_responses{application="service1",request_path="/session"}[5m]))

it doesn't return anything

Each of them works just fine and it produces the expected values but I can't divide them in order to get the ratio. Any idea? Thanks

Catalin M
  • 31
  • 5
  • Have a read of this: https://stackoverflow.com/questions/51080209/prometheus-return-no-data-when-calculating-a-ratio-of-two-metrics And see if it helps. I believe for your example, it would be `ignoring(request_path)` or `on(request_path)` – Saf Nov 02 '20 at 13:31

1 Answers1

1

Yes, as suggested by Saf using ignoring() or on() does the trick. so sum by (application) (rate(http_request_path_endpoint_responses{application="service1",request_path="/otp"}[5m])) / ignoring(request_path) sum by (application) (rate(http_request_path_endpoint_responses{application="service1",request_path="/session"}[5m])) worked

Catalin M
  • 31
  • 5