Issue
I have a Spring boot 2.7.14 + Java 11 application which acts like a proxy (it's a gateway) between client A and target X.
Currently I'm using spring actuator just to do health checks, all the telemetry of the application is done with Opentelemetry + Elastic APM, consequently, I do not need any metrics such as http client requests.
As my application is a proxy, it calls a huge amount of differents targets. The problem is that all requests URIs and URLs are being stored in a HashMap in the application and we are not able to figure out (with a simple configuration) a way to avoid this.
This is the Heap dump:
As you can see, more then 50% of my heap is being used to store a metric that I do not use, and of course this is a problem. My application ends up running out of memory to handle requests and I experience downtime because of this.
What I have did trying to solve it
I have added the following configuration on my application.yaml to prevent the application adding these metrics on the HashMap (without success):
management:
metrics:
enable:
http:
server:
requests: false
client:
requests: false
As you could see on the prints, it didn't worked.
I've debugged the code and reached a piece of code that seems like to do the decision if it should or not save the Metric:
When I added metrics.enable.http.client.requests=false it stopped adding the metric on the meterMap, so it looked like was ok, but is not.
Expected Behavior
When metrics.enable.http.client.requests=false is added in application.yaml it stops storing metrics on the HashMap meterMap.
Comment From: bclozel
Thanks for the report, but Spring Boot 2.7.x is out of open source support. We will reopen this issue if you can reproduce the problem with a supported version.