Rename OtlpAutoConfiguration to OtlpTracingAutoConfiguration
Closes gh-42529
This commit is contained in:
parent
fdcc8d9d1f
commit
40bb81419d
|
|
@ -16,40 +16,18 @@
|
|||
|
||||
package org.springframework.boot.actuate.autoconfigure.tracing.otlp;
|
||||
|
||||
import io.micrometer.tracing.otel.bridge.OtelTracer;
|
||||
import io.opentelemetry.api.OpenTelemetry;
|
||||
import io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporter;
|
||||
import io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter;
|
||||
import io.opentelemetry.sdk.trace.SdkTracerProvider;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for OTLP. Brave does not support
|
||||
* OTLP, so we only configure it for OpenTelemetry. OTLP defines three transports that are
|
||||
* supported: gRPC (/protobuf), HTTP/protobuf, HTTP/JSON. From these transports HTTP/JSON
|
||||
* is not supported by the OTel Java SDK, and it seems there are no plans supporting it in
|
||||
* the future, see: <a href=
|
||||
* "https://github.com/open-telemetry/opentelemetry-java/issues/3651">opentelemetry-java#3651</a>.
|
||||
* Because this class configures components from the OTel SDK, it can't support HTTP/JSON.
|
||||
* By default, we auto-configure HTTP/protobuf. If you want to use gRPC, you need to set
|
||||
* {@code management.otlp.tracing.transport=grpc}. If you define a
|
||||
* {@link OtlpHttpSpanExporter} or {@link OtlpGrpcSpanExporter}, this auto-configuration
|
||||
* will back off.
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for exporting traces with OTLP.
|
||||
*
|
||||
* @author Jonatan Ivanov
|
||||
* @author Moritz Halbritter
|
||||
* @author Eddú Meléndez
|
||||
* @since 3.1.0
|
||||
* @deprecated since 3.4.0 in favor of {@link OtlpTracingAutoConfiguration}
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnClass({ OtelTracer.class, SdkTracerProvider.class, OpenTelemetry.class, OtlpHttpSpanExporter.class })
|
||||
@EnableConfigurationProperties(OtlpProperties.class)
|
||||
@Import({ OtlpTracingConfigurations.ConnectionDetails.class, OtlpTracingConfigurations.Exporters.class })
|
||||
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||
public class OtlpAutoConfiguration {
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.autoconfigure.tracing.otlp;
|
||||
|
||||
import io.micrometer.tracing.otel.bridge.OtelTracer;
|
||||
import io.opentelemetry.api.OpenTelemetry;
|
||||
import io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporter;
|
||||
import io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter;
|
||||
import io.opentelemetry.sdk.trace.SdkTracerProvider;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for exporting traces with OTLP.
|
||||
* Brave does not support OTLP, so we only configure it for OpenTelemetry. OTLP defines
|
||||
* three transports that are supported: gRPC (/protobuf), HTTP/protobuf, HTTP/JSON. From
|
||||
* these transports HTTP/JSON is not supported by the OTel Java SDK, and it seems there
|
||||
* are no plans supporting it in the future, see: <a href=
|
||||
* "https://github.com/open-telemetry/opentelemetry-java/issues/3651">opentelemetry-java#3651</a>.
|
||||
* Because this class configures components from the OTel SDK, it can't support HTTP/JSON.
|
||||
* By default, we auto-configure HTTP/protobuf. If you want to use gRPC, you need to set
|
||||
* {@code management.otlp.tracing.transport=grpc}. If you define a
|
||||
* {@link OtlpHttpSpanExporter} or {@link OtlpGrpcSpanExporter}, this auto-configuration
|
||||
* will back off.
|
||||
*
|
||||
* @author Jonatan Ivanov
|
||||
* @author Moritz Halbritter
|
||||
* @author Eddú Meléndez
|
||||
* @since 3.4.0
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnClass({ OtelTracer.class, SdkTracerProvider.class, OpenTelemetry.class, OtlpHttpSpanExporter.class })
|
||||
@EnableConfigurationProperties(OtlpTracingProperties.class)
|
||||
@Import({ OtlpTracingConfigurations.ConnectionDetails.class, OtlpTracingConfigurations.Exporters.class })
|
||||
public class OtlpTracingAutoConfiguration {
|
||||
|
||||
}
|
||||
|
|
@ -34,8 +34,8 @@ org.springframework.boot.actuate.autoconfigure.ldap.LdapHealthContributorAutoCon
|
|||
org.springframework.boot.actuate.autoconfigure.liquibase.LiquibaseEndpointAutoConfiguration
|
||||
org.springframework.boot.actuate.autoconfigure.logging.LogFileWebEndpointAutoConfiguration
|
||||
org.springframework.boot.actuate.autoconfigure.logging.LoggersEndpointAutoConfiguration
|
||||
org.springframework.boot.actuate.autoconfigure.logging.opentelemetry.OpenTelemetryLoggingAutoConfiguration
|
||||
org.springframework.boot.actuate.autoconfigure.logging.opentelemetry.otlp.OtlpLoggingAutoConfiguration
|
||||
org.springframework.boot.actuate.autoconfigure.logging.OpenTelemetryLoggingAutoConfiguration
|
||||
org.springframework.boot.actuate.autoconfigure.logging.otlp.OtlpLoggingAutoConfiguration
|
||||
org.springframework.boot.actuate.autoconfigure.mail.MailHealthContributorAutoConfiguration
|
||||
org.springframework.boot.actuate.autoconfigure.management.HeapDumpWebEndpointAutoConfiguration
|
||||
org.springframework.boot.actuate.autoconfigure.management.ThreadDumpEndpointAutoConfiguration
|
||||
|
|
@ -110,7 +110,7 @@ org.springframework.boot.actuate.autoconfigure.tracing.BraveAutoConfiguration
|
|||
org.springframework.boot.actuate.autoconfigure.tracing.MicrometerTracingAutoConfiguration
|
||||
org.springframework.boot.actuate.autoconfigure.tracing.NoopTracerAutoConfiguration
|
||||
org.springframework.boot.actuate.autoconfigure.tracing.OpenTelemetryTracingAutoConfiguration
|
||||
org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpAutoConfiguration
|
||||
org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpTracingAutoConfiguration
|
||||
org.springframework.boot.actuate.autoconfigure.tracing.prometheus.PrometheusExemplarsAutoConfiguration
|
||||
org.springframework.boot.actuate.autoconfigure.tracing.prometheus.PrometheusSimpleclientExemplarsAutoConfiguration
|
||||
org.springframework.boot.actuate.autoconfigure.tracing.wavefront.WavefrontTracingAutoConfiguration
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
org.springframework.boot.actuate.autoconfigure.tracing.OpenTelemetryAutoConfiguration=org.springframework.boot.actuate.autoconfigure.tracing.OpenTelemetryTracingAutoConfiguration
|
||||
org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpAutoConfiguration=org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpTracingAutoConfiguration
|
||||
|
|
|
|||
|
|
@ -49,25 +49,25 @@ import org.junit.jupiter.api.Test;
|
|||
import org.springframework.boot.actuate.autoconfigure.observation.ObservationAutoConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.opentelemetry.OpenTelemetryAutoConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.MicrometerTracingAutoConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpAutoConfigurationIntegrationTests.MockGrpcServer.RecordedGrpcRequest;
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpTracingAutoConfigurationIntegrationTests.MockGrpcServer.RecordedGrpcRequest;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link OtlpAutoConfiguration}.
|
||||
* Integration tests for {@link OtlpTracingAutoConfiguration}.
|
||||
*
|
||||
* @author Jonatan Ivanov
|
||||
*/
|
||||
class OtlpAutoConfigurationIntegrationTests {
|
||||
class OtlpTracingAutoConfigurationIntegrationTests {
|
||||
|
||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
.withPropertyValues("management.tracing.sampling.probability=1.0")
|
||||
.withConfiguration(AutoConfigurations.of(ObservationAutoConfiguration.class,
|
||||
MicrometerTracingAutoConfiguration.class, OpenTelemetryAutoConfiguration.class,
|
||||
org.springframework.boot.actuate.autoconfigure.tracing.OpenTelemetryTracingAutoConfiguration.class,
|
||||
OtlpAutoConfiguration.class));
|
||||
OtlpTracingAutoConfiguration.class));
|
||||
|
||||
private final MockWebServer mockWebServer = new MockWebServer();
|
||||
|
||||
|
|
@ -32,16 +32,16 @@ import org.springframework.context.annotation.Configuration;
|
|||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link OtlpAutoConfiguration}.
|
||||
* Tests for {@link OtlpTracingAutoConfiguration}.
|
||||
*
|
||||
* @author Jonatan Ivanov
|
||||
* @author Moritz Halbritter
|
||||
* @author Eddú Meléndez
|
||||
*/
|
||||
class OtlpAutoConfigurationTests {
|
||||
class OtlpTracingAutoConfigurationTests {
|
||||
|
||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(OtlpAutoConfiguration.class));
|
||||
.withConfiguration(AutoConfigurations.of(OtlpTracingAutoConfiguration.class));
|
||||
|
||||
private final ApplicationContextRunner tracingDisabledContextRunner = this.contextRunner
|
||||
.withPropertyValues("management.tracing.enabled=false");
|
||||
|
|
@ -16,8 +16,8 @@
|
|||
|
||||
package org.springframework.boot.docker.compose.service.connection.otlp;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.opentelemetry.otlp.Transport;
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpTracingConnectionDetails;
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.otlp.Transport;
|
||||
import org.springframework.boot.docker.compose.service.connection.test.DockerComposeTest;
|
||||
import org.springframework.boot.testsupport.container.TestImage;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@
|
|||
|
||||
package org.springframework.boot.docker.compose.service.connection.otlp;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.opentelemetry.otlp.Transport;
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpTracingConnectionDetails;
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.otlp.Transport;
|
||||
import org.springframework.boot.docker.compose.service.connection.test.DockerComposeTest;
|
||||
import org.springframework.boot.testsupport.container.TestImage;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@
|
|||
|
||||
package org.springframework.boot.docker.compose.service.connection.otlp;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.opentelemetry.otlp.Transport;
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpTracingConnectionDetails;
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.otlp.Transport;
|
||||
import org.springframework.boot.docker.compose.core.RunningService;
|
||||
import org.springframework.boot.docker.compose.service.connection.DockerComposeConnectionDetailsFactory;
|
||||
import org.springframework.boot.docker.compose.service.connection.DockerComposeConnectionSource;
|
||||
|
|
@ -41,7 +41,7 @@ class OpenTelemetryTracingDockerComposeConnectionDetailsFactory
|
|||
|
||||
OpenTelemetryTracingDockerComposeConnectionDetailsFactory() {
|
||||
super(OPENTELEMETRY_IMAGE_NAMES,
|
||||
"org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpAutoConfiguration");
|
||||
"org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpTracingAutoConfiguration");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ import org.testcontainers.junit.jupiter.Container;
|
|||
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.actuate.autoconfigure.opentelemetry.otlp.Transport;
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpAutoConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpTracingAutoConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpTracingConnectionDetails;
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.otlp.Transport;
|
||||
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
||||
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
|
||||
import org.springframework.boot.testsupport.container.TestImage;
|
||||
|
|
@ -58,7 +58,7 @@ class GrafanaOpenTelemetryTracingContainerConnectionDetailsFactoryIntegrationTes
|
|||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ImportAutoConfiguration(OtlpAutoConfiguration.class)
|
||||
@ImportAutoConfiguration(OtlpTracingAutoConfiguration.class)
|
||||
static class TestConfiguration {
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ import org.testcontainers.junit.jupiter.Container;
|
|||
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.actuate.autoconfigure.opentelemetry.otlp.Transport;
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpAutoConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpTracingAutoConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpTracingConnectionDetails;
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.otlp.Transport;
|
||||
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
||||
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
|
||||
import org.springframework.boot.testsupport.container.TestImage;
|
||||
|
|
@ -59,7 +59,7 @@ class OpenTelemetryTracingContainerConnectionDetailsFactoryIntegrationTests {
|
|||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ImportAutoConfiguration(OtlpAutoConfiguration.class)
|
||||
@ImportAutoConfiguration(OtlpTracingAutoConfiguration.class)
|
||||
static class TestConfiguration {
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ package org.springframework.boot.testcontainers.service.connection.otlp;
|
|||
|
||||
import org.testcontainers.grafana.LgtmStackContainer;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.opentelemetry.otlp.Transport;
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpTracingConnectionDetails;
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.otlp.Transport;
|
||||
import org.springframework.boot.testcontainers.service.connection.ContainerConnectionDetailsFactory;
|
||||
import org.springframework.boot.testcontainers.service.connection.ContainerConnectionSource;
|
||||
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
|
||||
|
|
@ -36,7 +36,8 @@ class GrafanaOpenTelemetryTracingContainerConnectionDetailsFactory
|
|||
extends ContainerConnectionDetailsFactory<LgtmStackContainer, OtlpTracingConnectionDetails> {
|
||||
|
||||
GrafanaOpenTelemetryTracingContainerConnectionDetailsFactory() {
|
||||
super(ANY_CONNECTION_NAME, "org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpAutoConfiguration");
|
||||
super(ANY_CONNECTION_NAME,
|
||||
"org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpTracingAutoConfiguration");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ package org.springframework.boot.testcontainers.service.connection.otlp;
|
|||
import org.testcontainers.containers.Container;
|
||||
import org.testcontainers.containers.GenericContainer;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.opentelemetry.otlp.Transport;
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpTracingConnectionDetails;
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.otlp.Transport;
|
||||
import org.springframework.boot.testcontainers.service.connection.ContainerConnectionDetailsFactory;
|
||||
import org.springframework.boot.testcontainers.service.connection.ContainerConnectionSource;
|
||||
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
|
||||
|
|
@ -42,7 +42,7 @@ class OpenTelemetryTracingContainerConnectionDetailsFactory
|
|||
|
||||
OpenTelemetryTracingContainerConnectionDetailsFactory() {
|
||||
super("otel/opentelemetry-collector-contrib",
|
||||
"org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpAutoConfiguration");
|
||||
"org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpTracingAutoConfiguration");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue