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)

Most upvoted comments

It looks like we also need to fix Spring Boot and make an IntegrationAutoConfiguration to be auto-configured after a CompositeMeterRegistryAutoConfiguration. Or vise-versa.

For time being the workaround is:

Place into a resources/META-INF the spring-autoconfigure-metadata.properties file with content:

org.springframework.boot.actuate.autoconfigure.metrics.CompositeMeterRegistryAutoConfiguration.AutoConfigureBefore=org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration

This way Spring Boot builds for us its MeterRegistry bean and only after that IntegrationAutoConfiguration.IntegrationManagementConfiguration does its job with the mentioned MicrometerMetricsCaptorRegistrar logic. So, the condition registry.containsBeanDefinition(MicrometerMetricsCaptor.MICROMETER_CAPTOR_NAME) turns true and meters for Spring Integration components are registered with the Prometheus.

Now all your tests are passing, even without that custom register configuration property and those MeterRegistry explicit beans.