I want to calculate the number of requests per second for a particular URL from a Spring Boot 2 application, also the time taken for each request (latency) in milliseconds. We can see the following metrics from Actuator/Prometheus:
http_server_request_config_seconds_count
http_server_request_config_seconds_sum
I'm confused how to plot this in Prometheus to get my result. Do I need to add a histogram or quantiles?
If you only care about the request per seconds, you don't need anything related to the quantiles.
irate(http_server_requests_seconds_count{uri="/your-uri"}[5m])
And if your are interested in the response time overall:
irate(http_server_request_duration_seconds_sum{exception="None", uri = "/your-url"}[5m]) / irate(http_server_requests_duration_seconds_count{exception="None", uri = "/your-url"}[5m])
If you want more precised metrics (quantiles) you can refer to the Prometheus documentation.
e.g:
histogram_quantile(0.99, sum(rate(http_server_requests_seconds_bucket{exception="None", uri = "/your-uri"}[5m])) by (le))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With