From 83afef4f60b8aa8c918de35c70b8ba179cc85c24 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 9 Oct 2024 11:00:35 +0100 Subject: [PATCH] Start building against Micrometer 1.14.0 snapshots See gh-42555 --- .../export/elastic/ElasticProperties.java | 16 +++++++++++++++- .../elastic/ElasticPropertiesConfigAdapter.java | 7 ++++++- .../ElasticPropertiesConfigAdapterTests.java | 9 ++++++++- .../spring-boot-dependencies/build.gradle | 2 +- 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticProperties.java index 11278d1bfa1..d26b143b006 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -79,6 +79,12 @@ public class ElasticProperties extends StepRegistryProperties { */ private String apiKeyCredentials; + /** + * Whether to enable _source in the default index template when auto-creating the + * index. + */ + private boolean enableSource = false; + public String getHost() { return this.host; } @@ -159,4 +165,12 @@ public class ElasticProperties extends StepRegistryProperties { this.apiKeyCredentials = apiKeyCredentials; } + public boolean isEnableSource() { + return this.enableSource; + } + + public void setEnableSource(boolean enableSource) { + this.enableSource = enableSource; + } + } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticPropertiesConfigAdapter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticPropertiesConfigAdapter.java index 082cf58f6d6..a44f61b8878 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticPropertiesConfigAdapter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticPropertiesConfigAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -87,4 +87,9 @@ class ElasticPropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapter return get(ElasticProperties::getApiKeyCredentials, ElasticConfig.super::apiKeyCredentials); } + @Override + public boolean enableSource() { + return get(ElasticProperties::isEnableSource, ElasticConfig.super::enableSource); + } + } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticPropertiesConfigAdapterTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticPropertiesConfigAdapterTests.java index 0738af12805..f27e4a461b5 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticPropertiesConfigAdapterTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticPropertiesConfigAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -104,4 +104,11 @@ class ElasticPropertiesConfigAdapterTests assertThat(new ElasticPropertiesConfigAdapter(properties).apiKeyCredentials()).isEqualTo("secret"); } + @Test + void whenPropertiesEnableSourceIsSetAdapterEnableSourceReturnsIt() { + ElasticProperties properties = new ElasticProperties(); + properties.setEnableSource(true); + assertThat(new ElasticPropertiesConfigAdapter(properties).enableSource()).isTrue(); + } + } diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index e6b401228d0..beb6c43a6b8 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -1305,7 +1305,7 @@ bom { ] } } - library("Micrometer", "1.14.0-M3") { + library("Micrometer", "1.14.0-SNAPSHOT") { considerSnapshots() group("io.micrometer") { modules = [