Skip to content

Commit 234f223

Browse files
Aligning cloudwatch metric properties to spring boot 3.0 (#779)
* Aligning cloudwatch metric properties to spring boot 3.0 fixes #776 * Update config properties. --------- Co-authored-by: Maciej Walkowiak <[email protected]>
1 parent 58eeba4 commit 234f223

File tree

7 files changed

+22
-19
lines changed

7 files changed

+22
-19
lines changed

docs/src/main/asciidoc/_configprops.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
|spring.cloud.aws.cloudwatch.endpoint | | Overrides the default endpoint.
55
|spring.cloud.aws.cloudwatch.region | | Overrides the default region.
66
|spring.cloud.aws.credentials.access-key | | The access key to be used with a static provider.
7-
|spring.cloud.aws.credentials.instance-profile | | Configures an instance profile credentials provider with no further configuration.
7+
|spring.cloud.aws.credentials.instance-profile | `+++false+++` | Configures an instance profile credentials provider with no further configuration.
88
|spring.cloud.aws.credentials.profile | | The AWS profile.
99
|spring.cloud.aws.credentials.secret-key | | The secret key to be used with a static provider.
1010
|spring.cloud.aws.credentials.sts.async-credentials-update | |
@@ -33,10 +33,10 @@
3333
|spring.cloud.aws.fips-enabled | | Configure whether the SDK should use the AWS fips endpoints.
3434
|spring.cloud.aws.parameterstore.endpoint | | Overrides the default endpoint.
3535
|spring.cloud.aws.parameterstore.region | | Overrides the default region.
36-
|spring.cloud.aws.parameterstore.reload.max-wait-for-restart | | If {@link ReloadStrategy#RESTART_CONTEXT} is configured, maximum waiting time for server restart.
37-
|spring.cloud.aws.parameterstore.reload.period | | Refresh period for {@link PollingAwsPropertySourceChangeDetector}.
36+
|spring.cloud.aws.parameterstore.reload.max-wait-for-restart | `+++2s+++` | If {@link ReloadStrategy#RESTART_CONTEXT} is configured, maximum waiting time for server restart.
37+
|spring.cloud.aws.parameterstore.reload.period | `+++1m+++` | Refresh period for {@link PollingAwsPropertySourceChangeDetector}.
3838
|spring.cloud.aws.parameterstore.reload.strategy | | Reload strategy to run when properties change.
39-
|spring.cloud.aws.region.instance-profile | | Configures an instance profile region provider with no further configuration.
39+
|spring.cloud.aws.region.instance-profile | `+++false+++` | Configures an instance profile region provider with no further configuration.
4040
|spring.cloud.aws.region.profile | | The AWS profile.
4141
|spring.cloud.aws.region.static | |
4242
|spring.cloud.aws.s3.accelerate-mode-enabled | | Option to enable using the accelerate endpoint when accessing S3. Accelerate endpoints allow faster transfer of objects by using Amazon CloudFront's globally distributed edge locations.
@@ -55,8 +55,8 @@
5555
|spring.cloud.aws.s3.use-arn-region-enabled | | If an S3 resource ARN is passed in as the target of an S3 operation that has a different region to the one the client was configured with, this flag must be set to 'true' to permit the client to make a cross-region call to the region specified in the ARN otherwise an exception will be thrown.
5656
|spring.cloud.aws.secretsmanager.endpoint | | Overrides the default endpoint.
5757
|spring.cloud.aws.secretsmanager.region | | Overrides the default region.
58-
|spring.cloud.aws.secretsmanager.reload.max-wait-for-restart | | If {@link ReloadStrategy#RESTART_CONTEXT} is configured, maximum waiting time for server restart.
59-
|spring.cloud.aws.secretsmanager.reload.period | | Refresh period for {@link PollingAwsPropertySourceChangeDetector}.
58+
|spring.cloud.aws.secretsmanager.reload.max-wait-for-restart | `+++2s+++` | If {@link ReloadStrategy#RESTART_CONTEXT} is configured, maximum waiting time for server restart.
59+
|spring.cloud.aws.secretsmanager.reload.period | `+++1m+++` | Refresh period for {@link PollingAwsPropertySourceChangeDetector}.
6060
|spring.cloud.aws.secretsmanager.reload.strategy | | Reload strategy to run when properties change.
6161
|spring.cloud.aws.ses.enabled | `+++true+++` | Enables Simple Email Service integration.
6262
|spring.cloud.aws.ses.endpoint | | Overrides the default endpoint.

docs/src/main/asciidoc/cloudwatch.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ To send metrics to CloudWatch add a dependency to `micrometer-registry-cloudwatc
1010
</dependency>
1111
----
1212

13-
Additionally, CloudWatch integration requires a value provided for `management.metrics.export.cloudwatch.namespace` configuration property.
13+
Additionally, CloudWatch integration requires a value provided for `management.cloudwatch.metrics.export.namespace` configuration property.
1414

1515
Following configuration properties are available to configure CloudWatch integration:
1616

@@ -20,11 +20,11 @@ Following configuration properties are available to configure CloudWatch integra
2020
|default
2121
|description
2222

23-
|management.metrics.export.cloudwatch.namespace
23+
|management.cloudwatch.metrics.export.namespace
2424
|
2525
|The namespace which will be used when sending metrics to CloudWatch. This property is needed and must not be null.
2626

27-
|management.metrics.export.cloudwatch.step
27+
|management.cloudwatch.metrics.export.step
2828
|1m
2929
|The interval at which metrics are sent to CloudWatch. The default is 1 minute.
3030

docs/src/main/asciidoc/migration.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ Properties that have changed from 2.x to 3.x are listed below:
2626

2727
|`aws.secretsmanager.region`
2828
|`spring.cloud.aws.secretsmanager.region`
29+
30+
|`management.metrics.export.cloudwatch.*`
31+
|`management.cloudwatch.metrics.export.*`
2932
|===
3033

3134
Properties that have been removed in 3.x are listed below:

spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/metrics/CloudWatchExportAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
@AutoConfigureAfter({ CredentialsProviderAutoConfiguration.class, RegionProviderAutoConfiguration.class,
5353
MetricsAutoConfiguration.class })
5454
@EnableConfigurationProperties({ CloudWatchRegistryProperties.class, CloudWatchProperties.class })
55-
@ConditionalOnProperty(prefix = "management.metrics.export.cloudwatch", name = "namespace")
55+
@ConditionalOnProperty(prefix = "management.cloudwatch.metrics.export", name = "namespace")
5656
@ConditionalOnClass({ CloudWatchAsyncClient.class, CloudWatchMeterRegistry.class, AwsRegionProvider.class })
5757
public class CloudWatchExportAutoConfiguration {
5858

spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/metrics/CloudWatchRegistryProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* @author Eddú Meléndez
2828
* @since 2.0.0
2929
*/
30-
@ConfigurationProperties(prefix = "management.metrics.export.cloudwatch")
30+
@ConfigurationProperties(prefix = "management.cloudwatch.metrics.export")
3131
public class CloudWatchRegistryProperties extends StepRegistryProperties {
3232

3333
private static final int DEFAULT_BATCH_SIZE = 20;

spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/metrics/CloudWatchExportAutoConfigurationIntegrationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ void testCounter() {
7272
try (ConfigurableApplicationContext context = application.run(
7373
"--spring.cloud.aws.endpoint=" + localstack.getEndpointOverride(SSM).toString(),
7474
"--spring.cloud.aws.credentials.access-key=noop", "--spring.cloud.aws.credentials.secret-key=noop",
75-
"--spring.cloud.aws.region.static=us-east-1", "--management.metrics.export.cloudwatch.step=5s",
76-
"--management.metrics.export.cloudwatch.namespace=awspring/spring-cloud-aws",
75+
"--spring.cloud.aws.region.static=us-east-1", "--management.cloudwatch.metrics.export.step=5s",
76+
"--management.cloudwatch.metrics.export.namespace=awspring/spring-cloud-aws",
7777
"--management.metrics.enable.all=false", "--management.metrics.enable.test=true")) {
7878

7979
MeterRegistry meterRegistry = context.getBean(MeterRegistry.class);

spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/metrics/CloudWatchExportAutoConfigurationTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void testWithoutSettingAnyConfigProperties() {
6262

6363
@Test
6464
void enableAutoConfigurationSettingNamespace() {
65-
this.contextRunner.withPropertyValues("management.metrics.export.cloudwatch.namespace:test").run(context -> {
65+
this.contextRunner.withPropertyValues("management.cloudwatch.metrics.export.namespace:test").run(context -> {
6666
assertThat(context).hasSingleBean(CloudWatchMeterRegistry.class);
6767
assertThat(context).hasSingleBean(CloudWatchConfig.class);
6868
assertThat(context).hasSingleBean(Clock.class);
@@ -74,7 +74,7 @@ void enableAutoConfigurationSettingNamespace() {
7474

7575
@Test
7676
void enableAutoConfigurationWithSpecificRegion() {
77-
this.contextRunner.withPropertyValues("management.metrics.export.cloudwatch.namespace:test",
77+
this.contextRunner.withPropertyValues("management.cloudwatch.metrics.export.namespace:test",
7878
"spring.cloud.aws.cloudwatch.region:us-east-1").run(context -> {
7979
assertThat(context).hasSingleBean(CloudWatchMeterRegistry.class);
8080
assertThat(context).hasSingleBean(Clock.class);
@@ -95,7 +95,7 @@ void enableAutoConfigurationWithSpecificRegion() {
9595

9696
@Test
9797
void enableAutoConfigurationWithCustomEndpoint() {
98-
this.contextRunner.withPropertyValues("management.metrics.export.cloudwatch.namespace:test",
98+
this.contextRunner.withPropertyValues("management.cloudwatch.metrics.export.namespace:test",
9999
"spring.cloud.aws.cloudwatch.endpoint:http://localhost:8090").run(context -> {
100100
ConfiguredAwsClient client = new ConfiguredAwsClient(context.getBean(CloudWatchAsyncClient.class));
101101
assertThat(client.getEndpoint()).isEqualTo(URI.create("http://localhost:8090"));
@@ -105,7 +105,7 @@ void enableAutoConfigurationWithCustomEndpoint() {
105105

106106
@Test
107107
void withCustomGlobalEndpoint() {
108-
this.contextRunner.withPropertyValues("management.metrics.export.cloudwatch.namespace:test",
108+
this.contextRunner.withPropertyValues("management.cloudwatch.metrics.export.namespace:test",
109109
"spring.cloud.aws.endpoint:http://localhost:8090").run(context -> {
110110
ConfiguredAwsClient client = new ConfiguredAwsClient(context.getBean(CloudWatchAsyncClient.class));
111111
assertThat(client.getEndpoint()).isEqualTo(URI.create("http://localhost:8090"));
@@ -115,7 +115,7 @@ void withCustomGlobalEndpoint() {
115115

116116
@Test
117117
void withCustomGlobalEndpointAndCloudWatchEndpoint() {
118-
this.contextRunner.withPropertyValues("management.metrics.export.cloudwatch.namespace:test",
118+
this.contextRunner.withPropertyValues("management.cloudwatch.metrics.export.namespace:test",
119119
"spring.cloud.aws.endpoint:http://localhost:8090",
120120
"spring.cloud.aws.cloudwatch.endpoint:http://localhost:9999").run(context -> {
121121
ConfiguredAwsClient client = new ConfiguredAwsClient(context.getBean(CloudWatchAsyncClient.class));
@@ -126,7 +126,7 @@ void withCustomGlobalEndpointAndCloudWatchEndpoint() {
126126

127127
@Test
128128
void useAwsConfigurerClient() {
129-
this.contextRunner.withPropertyValues("management.metrics.export.cloudwatch.namespace:test")
129+
this.contextRunner.withPropertyValues("management.cloudwatch.metrics.export.namespace:test")
130130
.withUserConfiguration(CustomAwsConfigurerClient.class).run(context -> {
131131
ConfiguredAwsClient client = new ConfiguredAwsClient(context.getBean(CloudWatchAsyncClient.class));
132132
assertThat(client.getApiCallTimeout()).isEqualTo(Duration.ofMillis(1542));

0 commit comments

Comments
 (0)