spring-integration: missing metrics after update from 5.3.2 to 5.3.3
Update from 5.3.2 to 5.3.3 (via Spring Boot Update from 2.3.4 to 2.3.5)
Describe the bug
Metrics for channels etc. are not provided by Prometheus endpoint /actuator/prometheus anymore.
To Reproduce
Metrics are missing if
@Bean
public MeterRegistry meterRegistry(PrometheusMeterRegistry registry) {
return registry;
}
is not present (config/ApplicationConfiguration.java). The bean must be added explicit after update to 5.3.3 to enable metrics again.
Expected behavior
Not yes sure.
Sample
A almost simple sample is from a presentation demo
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 15 (15 by maintainers)
It looks like we also need to fix Spring Boot and make an
IntegrationAutoConfigurationto be auto-configured after aCompositeMeterRegistryAutoConfiguration. Or vise-versa.For time being the workaround is:
Place into a
resources/META-INFthespring-autoconfigure-metadata.propertiesfile with content:This way Spring Boot builds for us its
MeterRegistrybean and only after thatIntegrationAutoConfiguration.IntegrationManagementConfigurationdoes its job with the mentionedMicrometerMetricsCaptorRegistrarlogic. So, the conditionregistry.containsBeanDefinition(MicrometerMetricsCaptor.MICROMETER_CAPTOR_NAME)turnstrueand meters for Spring Integration components are registered with the Prometheus.Now all your tests are passing, even without that custom
registerconfiguration property and thoseMeterRegistryexplicit beans.