Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
izeye committed Oct 11, 2023
1 parent b9a0159 commit 8985083
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class OtlpMetricsExportAutoConfiguration {
}

@Bean
@ConditionalOnMissingBean(OtlpMetricsConnectionDetails.class)
@ConditionalOnMissingBean
OtlpMetricsConnectionDetails otlpMetricsConnectionDetails() {
return new PropertiesOtlpMetricsConnectionDetails(this.properties);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,13 @@
*
* @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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
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
*/
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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

/**
* {@link DockerComposeConnectionDetailsFactory} to create
* {@link OtlpMetricsConnectionDetails} for a {@code OTLP} service.
* {@link OtlpMetricsConnectionDetails} for an OTLP service.
*
* @author Eddú Meléndez
*/
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

/**
* {@link DockerComposeConnectionDetailsFactory} to create
* {@link OtlpTracingConnectionDetails} for a {@code OTLP} service.
* {@link OtlpTracingConnectionDetails} for an OTLP service.
*
* @author Eddú Meléndez
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*
* @author Eddú Meléndez
*/
public class OpenTelemetryMetricsDockerComposeConnectionDetailsFactoryIntegrationTests
class OpenTelemetryMetricsDockerComposeConnectionDetailsFactoryIntegrationTests
extends AbstractDockerComposeIntegrationTests {

OpenTelemetryMetricsDockerComposeConnectionDetailsFactoryIntegrationTests() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*
* @author Eddú Meléndez
*/
public class OpenTelemetryTracingDockerComposeConnectionDetailsFactoryIntegrationTests
class OpenTelemetryTracingDockerComposeConnectionDetailsFactoryIntegrationTests
extends AbstractDockerComposeIntegrationTests {

OpenTelemetryTracingDockerComposeConnectionDetailsFactoryIntegrationTests() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,24 @@
*
* @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");
}

@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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,24 @@
*
* @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");
}

@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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
import static org.hamcrest.Matchers.matchesPattern;

/**
* Tests for {@link OpenTelemetryMetricsConnectionDetailsFactory}.
* Tests for {@link OpenTelemetryMetricsContainerConnectionDetailsFactory}.
*
* @author Eddú Meléndez
* @author Jonatan Ivanov
Expand All @@ -57,7 +57,7 @@
@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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,9 @@ public static DockerImageName oracleXe() {
}

/**
* 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);
Expand Down

0 comments on commit 8985083

Please sign in to comment.