mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Polish gh-35082
See gh-37831
This commit is contained in:
parent
81cbf05b41
commit
446677375e
@ -19,7 +19,7 @@ package org.springframework.boot.actuate.autoconfigure.metrics.export.otlp;
|
||||
import org.springframework.boot.autoconfigure.service.connection.ConnectionDetails;
|
||||
|
||||
/**
|
||||
* Details required to establish a connection to a OpenTelemetry Collector service.
|
||||
* Details required to establish a connection to an OpenTelemetry Collector service.
|
||||
*
|
||||
* @author Eddú Meléndez
|
||||
* @since 3.2.0
|
||||
|
@ -57,7 +57,7 @@ public class OtlpMetricsExportAutoConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(OtlpMetricsConnectionDetails.class)
|
||||
@ConditionalOnMissingBean
|
||||
OtlpMetricsConnectionDetails otlpMetricsConnectionDetails() {
|
||||
return new PropertiesOtlpMetricsConnectionDetails(this.properties);
|
||||
}
|
||||
|
@ -33,16 +33,13 @@ import org.springframework.context.annotation.Configuration;
|
||||
*
|
||||
* @author Moritz Halbritter
|
||||
*/
|
||||
final class OtlpTracingConfigurations {
|
||||
|
||||
private OtlpTracingConfigurations() {
|
||||
}
|
||||
class OtlpTracingConfigurations {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class ConnectionDetails {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(OtlpTracingConnectionDetails.class)
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnProperty(prefix = "management.otlp.tracing", name = "endpoint")
|
||||
OtlpTracingConnectionDetails otlpTracingConnectionDetails(OtlpProperties properties) {
|
||||
return new PropertiesOtlpTracingConnectionDetails(properties);
|
||||
|
@ -19,7 +19,7 @@ package org.springframework.boot.actuate.autoconfigure.tracing.otlp;
|
||||
import org.springframework.boot.autoconfigure.service.connection.ConnectionDetails;
|
||||
|
||||
/**
|
||||
* Details required to establish a connection to a OpenTelemetry service.
|
||||
* Details required to establish a connection to an OpenTelemetry service.
|
||||
*
|
||||
* @author Eddú Meléndez
|
||||
* @since 3.2.0
|
||||
@ -27,8 +27,8 @@ import org.springframework.boot.autoconfigure.service.connection.ConnectionDetai
|
||||
public interface OtlpTracingConnectionDetails extends ConnectionDetails {
|
||||
|
||||
/**
|
||||
* Address to where metrics will be published.
|
||||
* @return the address to where metrics will be published
|
||||
* Address to where tracing will be published.
|
||||
* @return the address to where tracing will be published
|
||||
*/
|
||||
String getUrl();
|
||||
|
||||
|
@ -23,7 +23,7 @@ import org.springframework.boot.docker.compose.service.connection.DockerComposeC
|
||||
|
||||
/**
|
||||
* {@link DockerComposeConnectionDetailsFactory} to create
|
||||
* {@link OtlpMetricsConnectionDetails} for a {@code OTLP} service.
|
||||
* {@link OtlpMetricsConnectionDetails} for an OTLP service.
|
||||
*
|
||||
* @author Eddú Meléndez
|
||||
*/
|
||||
@ -39,17 +39,17 @@ class OpenTelemetryMetricsDockerComposeConnectionDetailsFactory
|
||||
|
||||
@Override
|
||||
protected OtlpMetricsConnectionDetails getDockerComposeConnectionDetails(DockerComposeConnectionSource source) {
|
||||
return new OpenTelemetryContainerMetricsConnectionDetails(source.getRunningService());
|
||||
return new OpenTelemetryMetricsDockerComposeConnectionDetails(source.getRunningService());
|
||||
}
|
||||
|
||||
private static final class OpenTelemetryContainerMetricsConnectionDetails extends DockerComposeConnectionDetails
|
||||
private static final class OpenTelemetryMetricsDockerComposeConnectionDetails extends DockerComposeConnectionDetails
|
||||
implements OtlpMetricsConnectionDetails {
|
||||
|
||||
private final String host;
|
||||
|
||||
private final int port;
|
||||
|
||||
private OpenTelemetryContainerMetricsConnectionDetails(RunningService source) {
|
||||
private OpenTelemetryMetricsDockerComposeConnectionDetails(RunningService source) {
|
||||
super(source);
|
||||
this.host = source.host();
|
||||
this.port = source.ports().get(OTLP_PORT);
|
||||
|
@ -23,7 +23,7 @@ import org.springframework.boot.docker.compose.service.connection.DockerComposeC
|
||||
|
||||
/**
|
||||
* {@link DockerComposeConnectionDetailsFactory} to create
|
||||
* {@link OtlpTracingConnectionDetails} for a {@code OTLP} service.
|
||||
* {@link OtlpTracingConnectionDetails} for an OTLP service.
|
||||
*
|
||||
* @author Eddú Meléndez
|
||||
*/
|
||||
|
@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Eddú Meléndez
|
||||
*/
|
||||
public class OpenTelemetryMetricsDockerComposeConnectionDetailsFactoryIntegrationTests
|
||||
class OpenTelemetryMetricsDockerComposeConnectionDetailsFactoryIntegrationTests
|
||||
extends AbstractDockerComposeIntegrationTests {
|
||||
|
||||
OpenTelemetryMetricsDockerComposeConnectionDetailsFactoryIntegrationTests() {
|
||||
|
@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Eddú Meléndez
|
||||
*/
|
||||
public class OpenTelemetryTracingDockerComposeConnectionDetailsFactoryIntegrationTests
|
||||
class OpenTelemetryTracingDockerComposeConnectionDetailsFactoryIntegrationTests
|
||||
extends AbstractDockerComposeIntegrationTests {
|
||||
|
||||
OpenTelemetryTracingDockerComposeConnectionDetailsFactoryIntegrationTests() {
|
||||
|
@ -32,10 +32,10 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect
|
||||
*
|
||||
* @author Eddú Meléndez
|
||||
*/
|
||||
class OpenTelemetryMetricsConnectionDetailsFactory
|
||||
class OpenTelemetryMetricsContainerConnectionDetailsFactory
|
||||
extends ContainerConnectionDetailsFactory<Container<?>, OtlpMetricsConnectionDetails> {
|
||||
|
||||
OpenTelemetryMetricsConnectionDetailsFactory() {
|
||||
OpenTelemetryMetricsContainerConnectionDetailsFactory() {
|
||||
super("otel/opentelemetry-collector-contrib",
|
||||
"org.springframework.boot.actuate.autoconfigure.metrics.export.otlp.OtlpMetricsExportAutoConfiguration");
|
||||
}
|
||||
@ -43,13 +43,13 @@ class OpenTelemetryMetricsConnectionDetailsFactory
|
||||
@Override
|
||||
protected OtlpMetricsConnectionDetails getContainerConnectionDetails(
|
||||
ContainerConnectionSource<Container<?>> source) {
|
||||
return new OpenTelemetryContainerMetricsConnectionDetails(source);
|
||||
return new OpenTelemetryMetricsContainerConnectionDetails(source);
|
||||
}
|
||||
|
||||
private static final class OpenTelemetryContainerMetricsConnectionDetails
|
||||
private static final class OpenTelemetryMetricsContainerConnectionDetails
|
||||
extends ContainerConnectionDetails<Container<?>> implements OtlpMetricsConnectionDetails {
|
||||
|
||||
private OpenTelemetryContainerMetricsConnectionDetails(ContainerConnectionSource<Container<?>> source) {
|
||||
private OpenTelemetryMetricsContainerConnectionDetails(ContainerConnectionSource<Container<?>> source) {
|
||||
super(source);
|
||||
}
|
||||
|
@ -32,10 +32,10 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect
|
||||
*
|
||||
* @author Eddú Meléndez
|
||||
*/
|
||||
class OpenTelemetryTracingConnectionDetailsFactory
|
||||
class OpenTelemetryTracingContainerConnectionDetailsFactory
|
||||
extends ContainerConnectionDetailsFactory<Container<?>, OtlpTracingConnectionDetails> {
|
||||
|
||||
OpenTelemetryTracingConnectionDetailsFactory() {
|
||||
OpenTelemetryTracingContainerConnectionDetailsFactory() {
|
||||
super("otel/opentelemetry-collector-contrib",
|
||||
"org.springframework.boot.actuate.autoconfigure.tracing.otlp.OtlpAutoConfiguration");
|
||||
}
|
||||
@ -43,13 +43,13 @@ class OpenTelemetryTracingConnectionDetailsFactory
|
||||
@Override
|
||||
protected OtlpTracingConnectionDetails getContainerConnectionDetails(
|
||||
ContainerConnectionSource<Container<?>> source) {
|
||||
return new OpenTelemetryTracingConnectionDetails(source);
|
||||
return new OpenTelemetryTracingContainerConnectionDetails(source);
|
||||
}
|
||||
|
||||
private static final class OpenTelemetryTracingConnectionDetails extends ContainerConnectionDetails<Container<?>>
|
||||
implements OtlpTracingConnectionDetails {
|
||||
private static final class OpenTelemetryTracingContainerConnectionDetails
|
||||
extends ContainerConnectionDetails<Container<?>> implements OtlpTracingConnectionDetails {
|
||||
|
||||
private OpenTelemetryTracingConnectionDetails(ContainerConnectionSource<Container<?>> source) {
|
||||
private OpenTelemetryTracingContainerConnectionDetails(ContainerConnectionSource<Container<?>> source) {
|
||||
super(source);
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ org.springframework.boot.testcontainers.service.connection.kafka.KafkaContainerC
|
||||
org.springframework.boot.testcontainers.service.connection.liquibase.LiquibaseContainerConnectionDetailsFactory,\
|
||||
org.springframework.boot.testcontainers.service.connection.mongo.MongoContainerConnectionDetailsFactory,\
|
||||
org.springframework.boot.testcontainers.service.connection.neo4j.Neo4jContainerConnectionDetailsFactory,\
|
||||
org.springframework.boot.testcontainers.service.connection.otlp.OpenTelemetryMetricsConnectionDetailsFactory,\
|
||||
org.springframework.boot.testcontainers.service.connection.otlp.OpenTelemetryTracingConnectionDetailsFactory,\
|
||||
org.springframework.boot.testcontainers.service.connection.otlp.OpenTelemetryMetricsContainerConnectionDetailsFactory,\
|
||||
org.springframework.boot.testcontainers.service.connection.otlp.OpenTelemetryTracingContainerConnectionDetailsFactory,\
|
||||
org.springframework.boot.testcontainers.service.connection.pulsar.PulsarContainerConnectionDetailsFactory,\
|
||||
org.springframework.boot.testcontainers.service.connection.r2dbc.MariaDbR2dbcContainerConnectionDetailsFactory,\
|
||||
org.springframework.boot.testcontainers.service.connection.r2dbc.MySqlR2dbcContainerConnectionDetailsFactory,\
|
||||
|
@ -48,7 +48,7 @@ import static org.hamcrest.Matchers.endsWith;
|
||||
import static org.hamcrest.Matchers.matchesPattern;
|
||||
|
||||
/**
|
||||
* Tests for {@link OpenTelemetryMetricsConnectionDetailsFactory}.
|
||||
* Tests for {@link OpenTelemetryMetricsContainerConnectionDetailsFactory}.
|
||||
*
|
||||
* @author Eddú Meléndez
|
||||
* @author Jonatan Ivanov
|
||||
@ -57,7 +57,7 @@ import static org.hamcrest.Matchers.matchesPattern;
|
||||
@TestPropertySource(properties = { "management.otlp.metrics.export.resource-attributes.service.name=test",
|
||||
"management.otlp.metrics.export.step=1s" })
|
||||
@Testcontainers(disabledWithoutDocker = true)
|
||||
class OpenTelemetryMetricsConnectionDetailsFactoryIntegrationTests {
|
||||
class OpenTelemetryMetricsContainerConnectionDetailsFactoryIntegrationTests {
|
||||
|
||||
private static final String OPENMETRICS_001 = "application/openmetrics-text; version=0.0.1; charset=utf-8";
|
||||
|
@ -33,13 +33,13 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link OpenTelemetryTracingConnectionDetailsFactory}.
|
||||
* Tests for {@link OpenTelemetryTracingContainerConnectionDetailsFactory}.
|
||||
*
|
||||
* @author Eddú Meléndez
|
||||
*/
|
||||
@SpringJUnitConfig
|
||||
@Testcontainers(disabledWithoutDocker = true)
|
||||
class OpenTelemetryTracingConnectionDetailsFactoryIntegrationTests {
|
||||
class OpenTelemetryTracingContainerConnectionDetailsFactoryIntegrationTests {
|
||||
|
||||
@Container
|
||||
@ServiceConnection
|
@ -158,8 +158,9 @@ public final class DockerImageNames {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a {@link DockerImageName} suitable for running the Oracle database.
|
||||
* @return a docker image name for running the Oracle database
|
||||
* Return a {@link DockerImageName} suitable for running OpenTelemetry.
|
||||
* @return a docker image name for running OpenTelemetry
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public static DockerImageName opentelemetry() {
|
||||
return DockerImageName.parse("otel/opentelemetry-collector-contrib").withTag(OPENTELEMETRY_VERSION);
|
||||
|
Loading…
Reference in New Issue
Block a user