I have a Spring Boot project exposing Micrometer metrics for Prometheus. I notice from some Prometheus / AlertManager alarms that we are having some server errors (500) in our Spring Boot application. In the daily use of the application we did not realize of any error or malfunction and in the Spring Boot application logs we are not able to find those errors (in debug mode).
If I check the metrics exposed by Micrometer (in the endpoint /actuator/prometheus) I can see in the metrics that apparently there are some exceptions:
...
http_server_requests_seconds_bucket{exception="BadSqlGrammarException",method="GET",outcome="SERVER_ERROR",status="500",uri="/path/to/my/endpoint",le="17.179869184",} 3.0
http_server_requests_seconds_bucket{exception="BadSqlGrammarException",method="GET",outcome="SERVER_ERROR",status="500",uri="/path/to/my/endpoint",le="22.906492245",} 3.0
http_server_requests_seconds_bucket{exception="BadSqlGrammarException",method="GET",outcome="SERVER_ERROR",status="500",uri="/path/to/my/endpoint",le="28.633115306",} 3.0
http_server_requests_seconds_bucket{exception="BadSqlGrammarException",method="GET",outcome="SERVER_ERROR",status="500",uri="/path/to/my/endpoint",le="30.0",} 3.0
http_server_requests_seconds_bucket{exception="BadSqlGrammarException",method="GET",outcome="SERVER_ERROR",status="500",uri="/path/to/my/endpoint",le="+Inf",} 3.0
http_server_requests_seconds_count{exception="BadSqlGrammarException",method="GET",outcome="SERVER_ERROR",status="500",uri="/path/to/my/endpoint",} 3.0
...
or
http_server_requests_seconds_bucket{exception="ServiceException",method="PATCH",outcome="SERVER_ERROR",status="500",uri="/path/to/my/endpoint",le="28.633115306",} 3.0
http_server_requests_seconds_bucket{exception="ServiceException",method="PATCH",outcome="SERVER_ERROR",status="500",uri="/path/to/my/endpoint",le="30.0",} 3.0
http_server_requests_seconds_bucket{exception="ServiceException",method="PATCH",outcome="SERVER_ERROR",status="500",uri="/path/to/my/endpoint",le="+Inf",} 3.0
http_server_requests_seconds_count{exception="ServiceException",method="PATCH",outcome="SERVER_ERROR",status="500",uri="/path/to/my/endpoint",} 3.0
http_server_requests_seconds_sum{exception="ServiceException",method="PATCH",outcome="SERVER_ERROR",status="500",uri="/path/to/my/endpoint",} 0.294431952
Am I probably missing some configuration in the Spring Boot Application? Do I have to make some customization in the Spring Boot Application? Why are not we having that information in the application logs?
I did not customize any metrics and all the configuration is as by default. The versions we are using are:
- Micrometer:
- micrometer-core 1.1.5
- micrometer-registry-prometheus 1.1.5
- Spring Boot Suite 2.1.6
Thanks a lot in advance.
Best regards