Closed
Description
Though Spring Boot provides the configuration property to disable certain management endpoints, all of them are instantiated no matter whether they are enabled or disabled via configuration. Especially looking at the TraceEndpoint
which holds an instance of TraceRepository
which again references objects representing the last 100 HTTP requests, we seem to be looking at memory hogs here.
A very naive idea to avoid this would be something like this (from org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration
)
@Bean
@ConditionalOnMissingBean
@ConditionalOnExpression("${endpoints.trace.enabled}")
public TraceEndpoint traceEndpoint(@Value("${trace.repository.capacity}") int capacity) {
this.traceRepository.setCapacity(capacity);
return new TraceEndpoint(this.traceRepository);
}
but I'm not sure about the side effects this might introduce. And this doesn't prevent the TraceRepository
and the WebRequestTraceFilter
from being instantiated.