From 77c3b6c899399f92b1bb5925b1fd09c828b4ce34 Mon Sep 17 00:00:00 2001 From: izeye Date: Fri, 29 Apr 2022 18:18:12 +0900 Subject: [PATCH] Polish Micrometer tracing changes See gh-30833 --- .../wavefront/WavefrontPropertiesConfigAdapter.java | 2 +- .../tracing/OpenTelemetryConfigurations.java | 2 +- .../wavefront/WavefrontTracingAutoConfiguration.java | 2 +- .../wavefront/WavefrontAutoConfiguration.java | 4 ++-- .../autoconfigure/wavefront/WavefrontProperties.java | 7 ++++--- ...nTelemetryConfigurationsTracerConfigurationTests.java | 3 +-- .../ZipkinConfigurationsSenderConfigurationTests.java | 9 --------- .../src/docs/asciidoc/actuator/metrics.adoc | 4 ++-- 8 files changed, 12 insertions(+), 21 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontPropertiesConfigAdapter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontPropertiesConfigAdapter.java index 8422593ff1..6baf69378f 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontPropertiesConfigAdapter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontPropertiesConfigAdapter.java @@ -23,7 +23,7 @@ import org.springframework.boot.actuate.autoconfigure.wavefront.WavefrontPropert import org.springframework.boot.actuate.autoconfigure.wavefront.WavefrontProperties.Metrics.Export; /** - * Adapter to convert {@link WavefrontProperties.Metrics} to a {@link WavefrontConfig}. + * Adapter to convert {@link WavefrontProperties} to a {@link WavefrontConfig}. * * @author Jon Schneider * @author Moritz Halbritter diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/OpenTelemetryConfigurations.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/OpenTelemetryConfigurations.java index 7893be6740..bdeaf11cb5 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/OpenTelemetryConfigurations.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/OpenTelemetryConfigurations.java @@ -54,7 +54,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.core.env.Environment; /** - * Configurations for Open Telemetry. Those are imported by + * Configurations for OpenTelemetry. Those are imported by * {@link OpenTelemetryAutoConfiguration}. * * @author Moritz Halbritter diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/wavefront/WavefrontTracingAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/wavefront/WavefrontTracingAutoConfiguration.java index 9eea91397a..d0932a5f53 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/wavefront/WavefrontTracingAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/wavefront/WavefrontTracingAutoConfiguration.java @@ -44,7 +44,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.core.env.Environment; /** - * {@link EnableAutoConfiguration Auto-configuration} for Wavefront. + * {@link EnableAutoConfiguration Auto-configuration} for Wavefront tracing. * * @author Moritz Halbritter * @since 3.0.0 diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/wavefront/WavefrontAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/wavefront/WavefrontAutoConfiguration.java index e6e044f71f..72dc097630 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/wavefront/WavefrontAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/wavefront/WavefrontAutoConfiguration.java @@ -34,8 +34,8 @@ import org.springframework.util.unit.DataSize; /** * {@link EnableAutoConfiguration Auto-configuration} for Wavefront common infrastructure. - * Metrics are auto-configured in {@link WavefrontMetricsExportAutoConfiguration}, tracing - * is auto-configured in {@link WavefrontTracingAutoConfiguration}. + * Metrics are auto-configured in {@link WavefrontMetricsExportAutoConfiguration}, and + * tracing is auto-configured in {@link WavefrontTracingAutoConfiguration}. * * @author Moritz Halbritter * @since 3.0.0 diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/wavefront/WavefrontProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/wavefront/WavefrontProperties.java index 33576b4af9..37a963d624 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/wavefront/WavefrontProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/wavefront/WavefrontProperties.java @@ -41,13 +41,14 @@ public class WavefrontProperties { private URI uri = URI.create("https://longboard.wavefront.com"); /** - * Unique identifier for the app instance that is the source of metrics being - * published to Wavefront. Defaults to the local host name. + * Unique identifier for the app instance that is the source of metrics and traces + * being published to Wavefront. Defaults to the local host name. */ private String source; /** - * API token used when publishing metrics directly to the Wavefront API host. + * API token used when publishing metrics and traces directly to the Wavefront API + * host. */ private String apiToken; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/OpenTelemetryConfigurationsTracerConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/OpenTelemetryConfigurationsTracerConfigurationTests.java index 2227eb89d7..cbd0a0abaa 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/OpenTelemetryConfigurationsTracerConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/OpenTelemetryConfigurationsTracerConfigurationTests.java @@ -64,14 +64,13 @@ class OpenTelemetryConfigurationsTracerConfigurationTests { assertThat(context).hasBean("customTracer"); assertThat(context).hasSingleBean(Tracer.class); }); - } @Configuration(proxyBeanMethods = false) private static class OpenTelemetryConfiguration { @Bean - OpenTelemetry tracer() { + OpenTelemetry openTelemetry() { return Mockito.mock(OpenTelemetry.class); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/zipkin/ZipkinConfigurationsSenderConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/zipkin/ZipkinConfigurationsSenderConfigurationTests.java index 48a697e5c3..6f00a31845 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/zipkin/ZipkinConfigurationsSenderConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/zipkin/ZipkinConfigurationsSenderConfigurationTests.java @@ -60,15 +60,6 @@ class ZipkinConfigurationsSenderConfigurationTests { }); } - @Test - void shouldNotSupplyRestTemplateSenderIfNoBuilderIsAvailable() { - this.contextRunner.run((context) -> { - assertThat(context).doesNotHaveBean(ZipkinRestTemplateSender.class); - assertThat(context).hasSingleBean(Sender.class); - assertThat(context).hasSingleBean(URLConnectionSender.class); - }); - } - @Test void shouldBackOffOnCustomBeans() { this.contextRunner.withUserConfiguration(CustomConfiguration.class).run((context) -> { diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/metrics.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/metrics.adoc index 68d429c750..6445ddd651 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/metrics.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/metrics.adoc @@ -589,7 +589,7 @@ If you are exporting metrics to https://www.wavefront.com/[Wavefront] directly, ---- management: wavefront: - api-token: "YOUR_API_TOKEN" + api-token: "YOUR_API_TOKEN" ---- Alternatively, you can use a Wavefront sidecar or an internal proxy in your environment to forward metrics data to the Wavefront API host: @@ -598,7 +598,7 @@ Alternatively, you can use a Wavefront sidecar or an internal proxy in your envi ---- management: wavefront: - uri: "proxy://localhost:2878" + uri: "proxy://localhost:2878" ---- NOTE: If you publish metrics to a Wavefront proxy (as described in https://docs.wavefront.com/proxies_installing.html[the Wavefront documentation]), the host must be in the `proxy://HOST:PORT` format.