Search code examples
prometheusgrafanametrics

how to display the rate at which requests are being received over a certain time interval in grafana


right now this widget reports the number of responses given by the the API as a cumulative amount. Because of this, differences in the rate is not immediately clear. How to change the graph to display the rate? eg: at 10am-4pm the request I got is 1000, 4pm-10pm is 500, it go up and down, not cumulative.

This is right now enter image description here

This is Prometheus endpoints:

# HELP get_tax_requests_seconds Response latency(seconds) of gRPC.
# TYPE get_tax_requests_seconds histogram
get_tax_requests_seconds{m_application="adapter-mvp",method = "GetData", m_env="test",quantile="0.5",} 0.0

After I add rate, it shows like this, not the number of request

enter image description here


Solution

  • Use the rate function, like in the following example:

    sum(rate(get_tax_requests_seconds_count{<labels>}[1h])) * 60 * 60