Skip to content

ObservationRegistry is never post-processed #15658

Closed
@mmoayyed

Description

@mmoayyed

Describe the bug

I am running a Spring Boot web application with JDK 21 with the following versions/components:

springBootVersion=3.3.2
springVersion=6.1.12
micrometerVersion=1.13.3
springSecurityVersion=6.3.2

This application is tasked to simply review metrics produced by the metrics endpoint. With the above components, I begin to see warnings like this:

2024-08-20 19:21:58,213 WARN [org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker] - 
<Bean 'org.springframework.boot.actuate.autoconfigure.observation.ObservationAutoConfiguration' of type [org.springframework.boot.actuate.autoconfigure.observation.ObservationAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [casBeanValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.>

2024-08-20 19:21:58,298 WARN [org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker] - 
<Bean 'observationRegistry' of type [io.micrometer.observation.SimpleObservationRegistry] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [casBeanValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.>

Furthermore, the observation registry created by Spring Boot,

    @Bean
	@ConditionalOnMissingBean
	ObservationRegistry observationRegistry() {
		return ObservationRegistry.create();
	}

...is never post-processed via ObservationRegistryPostProcessor, and as a result quite a number of metrics end up missing, particularly those that deal with http.server.requests and family.

Why Spring Security?

If I keep everything EXACTLY THE SAME and only go back to springSecurityVersion=6.3.1,

  • All warnings disappear
  • The missing metrics are restored.

I am not seeing anything relevant from the commit log, but I could be missing something. Again, the only thing that I do change from run to run is the Spring Security version; everything else is exactly the same as before.

Expected behavior

Http exchanges should be collected and exported as metrics.

Sample

I am working on a sample that would hopefully produce this but this might do, although I have to apologize as it's not really a lightweight thing:

git clone [email protected]:mmoayyed/cas.git cas
cd cas
cd webapp/cas-server-webapp-tomcat
casmodules="reports"
./gradlew bootRun \
	--configure-on-demand --build-cache \
	--parallel -DskipAot=true -x test -x javadoc -x check -DenableRemoteDebugging=true \
	--stacktrace -DskipNestedConfigMetadataGen=true \
	-DcasModules=${casmodules}

The application settings that control default SSL settings, etc with Spring Boot are defined in:

cas/webapp/cas-server-webapp-resources/src/main/resources/application.properties

If I can help further, please let me know.

Metadata

Metadata

Assignees

Labels

in: configAn issue in spring-security-configtype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions