I use Spring Boot 1.5 with micrometer-spring-legacy:1.1.4 and micrometer-registry-cloudwatch:1.1.4 on the classpath. According to the docs it should pick up this registry automatically:
Having a dependency on micrometer-registry-{system} in your runtime classpath is enough for Spring Boot to configure the registry.
However when I look at the registered Spring beans when the app starts, there is only "simpleMeterRegistry" (which I assume is the default).
Why does it not pick up the CloudWatchMeterRegistry
? How to troubleshoot? thank you!!!
From the log:
Condition CompositeMeterRegistryConfiguration.MultipleNonPrimaryMeterRegistriesCondition on io.micrometer.spring.autoconfigure.CompositeMeterRegistryConfiguration did not match due to NoneNestedConditions 1 matched 1 did not; NestedCondition on CompositeMeterRegistryConfiguration.MultipleNonPrimaryMeterRegistriesCondition.SingleInjectableMeterRegistry @ConditionalOnSingleCandidate (types: io.micrometer.core.instrument.MeterRegistry; SearchStrategy: all) found a primary bean from beans 'simpleMeterRegistry'; NestedCondition on CompositeMeterRegistryConfiguration.MultipleNonPrimaryMeterRegistriesCondition.NoMeterRegistryCondition @ConditionalOnMissingBean (types: io.micrometer.core.instrument.MeterRegistry; SearchStrategy: all) found bean 'simpleMeterRegistry'
Condition DataSourcePoolMetricsAutoConfiguration.DataSourcePoolMetricsConditionalOnBeans on io.micrometer.spring.autoconfigure.jdbc.DataSourcePoolMetricsAutoConfiguration matched due to AllNestedConditions 2 matched 0 did not; NestedCondition on DataSourcePoolMetricsAutoConfiguration.DataSourcePoolMetricsConditionalOnBeans.ConditionalOnMeterRegistryBean @ConditionalOnBean (types: io.micrometer.core.instrument.MeterRegistry; SearchStrategy: all) found bean 'simpleMeterRegistry'; NestedCondition on DataSourcePoolMetricsAutoConfiguration.DataSourcePoolMetricsConditionalOnBeans.ConditionalOnDataSourceBean @ConditionalOnBean (types: javax.sql.DataSource; SearchStrategy: all) found bean 'dataSource'
Filter 'webMetricsFilter' configured successfully
Update
I see there is CloudWatchMetricAutoConfiguration
and I would expect it to produce a CloudWatchMetricWriter
Bean but there is no such bean. It should also create a AmazonCloudWatchAsync
bean but it doesn't - the only "amazon" bean we have is amazonS3
.
Likely cause
I have discovered that micrometer-spring-legacy:1.1.4
has the package io.micrometer.spring.autoconfigure.export.<system>
with <system>MetricsExportAutoConfiguration
, <system>Properties
, <system>PropertiesConfigAdapter
for every supported system - but not CloudWatch. These classes make the *Registry available as a Spring bean and since there is no support for the cloudwatch registry, it is not available as a spring bean.