Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot: statistics of APIs using http.server.requests

I want to statistics API requests in my Spring Boot 2 application,

Total number of requests processed

Total number of requests resulted in an OK response

Total number of requests resulted in a 4xx response

Total number of requests resulted in a 5xx response

Average response time of all requests

Max response time of all requests

I want to use Spring Boot Actuator and Micrometer, specifically, actuator/metrics/http.server.requests

But I have issues working with tag, Do I need any special configuration for the tag working? Thanks in advance.

enter image description here

enter image description here

enter image description here


UPDATE:

Finally, Both http://localhost:8080/travel/actuator/metrics/http.server.requests?tag=uri:/test/1 and http://localhost:8080/travel/actuator/metrics/http.server.requests?tag=status:200 work, by removing the second context path, /travel.

like image 216
Vikki Avatar asked Nov 15 '25 15:11

Vikki


1 Answers

While making a request to /http.server.requests which only requires the endpoint of API to get the metrics for the particular endpoint.

As the application has a context path defined as the i.e /travel which is only required for making a request to endpoints.

Will work fine

http://localhost:8080/travel/actuator/metrics/http.server.requests?tag=uri:/test/1

do not work because of the context path in tag=uri

http://localhost:8080/travel/actuator/metrics/http.server.requests?tag=uri:/travel/test/1

like image 94
Romil Patel Avatar answered Nov 18 '25 05:11

Romil Patel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!