Hey,

We've encountered an issue, that started once upgrading to spring-boot 3.X.X, in which the statsdMeterRegistry is not being added to the globalRegistry.

The expected behavior (which is what actually happened before upgrading to version 3.X.X) is that once you set management.statsd.metrics.export.enabled=true then the StatsdMeterRegistry bean would be created ONLY AFTER the MeterRegistryPostProcessor bean would be created. From my understanding (and maybe I'm wrong here) this is what the after settings here should enforce.

This is important because the MeterRegistryPostProcessor is the one's responsible for adding the StatsdMeterRegistry to the globalRegistry (you can see it here), but if the StatsdMeterRegistry bean is being created BEFORE the MeterRegistryPostProcessor then this doesn't happen.

Example logs:

01-08-2023 11:03:21.262 [restartedMain] DEBUG o.s.b.f.s.DefaultListableBeanFactory     : [] - Creating shared instance of singleton bean 'statsdMeterRegistry'
.
.
.

01-08-2023 11:03:21.771 [restartedMain] DEBUG o.s.b.f.s.DefaultListableBeanFactory     : [] - Creating shared instance of singleton bean 'meterRegistryPostProcessor'

I tried to troubleshoot it and understand what is causing the change in order in versions 3.X.X but so far couldn't find it.

Please let me know if there's any other info you need me to provide.

Thanks!

Comment From: wilkinsona

This typically happens when something in the application has caused the meter registry to be created prematurely. Unfortunately, we can't figure out what the cause is with the information you've provided thus far. If you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.