I'm using spring boot 2.x & using micrometer to record inbound http request metrics to PrometheusMeterRegistry.
Spring boot metrics actuator endpoint displayed the metric as below
http_server_requests_seconds_count{exception="None",method="GET",status="200",uri="/v2/endpoint1",} 272.0
http_server_requests_seconds_count{exception="SomeException",method="GET",status="400",uri="/v2/endpoint1",} 8.0
http_server_requests_seconds_count{exception="SomeOtherException",method="GET",status="422",uri="/v2/endpoint1",} 5.0
http_server_requests_seconds_count{exception="None",method="GET",status="200",uri="/v2/endpoint2",} 472.0
http_server_requests_seconds_count{exception="SomeException",method="GET",status="400",uri="/v2/endpoint2",} 11.0
http_server_requests_seconds_count{exception="SomeOtherException",method="GET",status="422",uri="/v2/endpoint2",} 7.0
I'm interested in the below outcome
Output: (top 10 in last x minutes)
1, /v2/endpoint2, {actual count of non 200 status codes in last minutes or so}
2, /v2/endpoint1, {actual count of non 200 status codes in last minutes or so}
I tried with a count function something similar to below. However it doesn't let me provide the time range. I couldn't get it work the way i mentioned above. Appreciate any help on this.
count(http_server_requests_seconds_count{status!="200"}) by (uri, method)