diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/jdbc/DataSourcePostProcessor.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/jdbc/DataSourcePostProcessor.java index 2a0439e724ca..d733caa22b43 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/jdbc/DataSourcePostProcessor.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/jdbc/DataSourcePostProcessor.java @@ -37,8 +37,8 @@ public Object postProcessAfterInitialization(Object bean, String beanName) { return JdbcTelemetry.builder(openTelemetryProvider.getObject()) .setStatementSanitizationEnabled( InstrumentationConfigUtil.isStatementSanitizationEnabled( - configPropertiesProvider.getObject(), "otel.instrumentation.jdbc.statement-sanitizer.enabled") - ) + configPropertiesProvider.getObject(), + "otel.instrumentation.jdbc.statement-sanitizer.enabled")) .build() .wrap(dataSource); } diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/mongo/MongoClientInstrumentationAutoConfiguration.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/mongo/MongoClientInstrumentationAutoConfiguration.java index 8de69b4ece90..ba05360fa57d 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/mongo/MongoClientInstrumentationAutoConfiguration.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/mongo/MongoClientInstrumentationAutoConfiguration.java @@ -33,10 +33,9 @@ public MongoClientSettingsBuilderCustomizer customizer( builder.addCommandListener( MongoTelemetry.builder(openTelemetry) .setStatementSanitizationEnabled( - InstrumentationConfigUtil.isStatementSanitizationEnabled(config, - "otel.instrumentation.mongo.statement-sanitizer.enabled")) + InstrumentationConfigUtil.isStatementSanitizationEnabled( + config, "otel.instrumentation.mongo.statement-sanitizer.enabled")) .build() .newCommandListener()); } - } diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/r2dbc/R2dbcInstrumentingPostProcessor.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/r2dbc/R2dbcInstrumentingPostProcessor.java index adca4fe05c56..5aa3d86a182b 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/r2dbc/R2dbcInstrumentingPostProcessor.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/instrumentation/r2dbc/R2dbcInstrumentingPostProcessor.java @@ -34,8 +34,10 @@ public Object postProcessAfterInitialization(Object bean, String beanName) { ConnectionFactory connectionFactory = (ConnectionFactory) bean; return R2dbcTelemetry.builder(openTelemetryProvider.getObject()) // there is no instrumentation-specific property, so we use the common one - .setStatementSanitizationEnabled(InstrumentationConfigUtil.isStatementSanitizationEnabled(configPropertiesProvider - .getObject(),"otel.instrumentation.common.db-statement-sanitizer.enabled")) + .setStatementSanitizationEnabled( + InstrumentationConfigUtil.isStatementSanitizationEnabled( + configPropertiesProvider.getObject(), + "otel.instrumentation.common.db-statement-sanitizer.enabled")) .build() .wrapConnectionFactory(connectionFactory, getConnectionFactoryOptions(connectionFactory)); } diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/InstrumentationConfigUtil.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/InstrumentationConfigUtil.java index 6b1cb01dcf92..268d9c9cfae7 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/InstrumentationConfigUtil.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/InstrumentationConfigUtil.java @@ -1,10 +1,14 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + package io.opentelemetry.instrumentation.spring.autoconfigure.internal; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; public class InstrumentationConfigUtil { - private InstrumentationConfigUtil() { - } + private InstrumentationConfigUtil() {} public static boolean isStatementSanitizationEnabled(ConfigProperties config, String key) { return config.getBoolean( diff --git a/smoke-tests-otel-starter/spring-boot-3/src/test/java/io/opentelemetry/spring/smoketest/GraalVmNativeMongodbSpringStarterSmokeTest.java b/smoke-tests-otel-starter/spring-boot-3/src/test/java/io/opentelemetry/spring/smoketest/GraalVmNativeMongodbSpringStarterSmokeTest.java index 479ed9d1783e..0ff9669a5c6e 100644 --- a/smoke-tests-otel-starter/spring-boot-3/src/test/java/io/opentelemetry/spring/smoketest/GraalVmNativeMongodbSpringStarterSmokeTest.java +++ b/smoke-tests-otel-starter/spring-boot-3/src/test/java/io/opentelemetry/spring/smoketest/GraalVmNativeMongodbSpringStarterSmokeTest.java @@ -24,6 +24,6 @@ classes = {OtelSpringStarterSmokeTestApplication.class, SpringSmokeOtelConfiguration.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @EnabledInNativeImage // see JvmMongodbSpringStarterSmokeTest for the JVM test -@EnabledInGithubActions +@RequiresDockerComposeEnvVariable public class GraalVmNativeMongodbSpringStarterSmokeTest extends AbstractMongodbSpringStarterSmokeTest {} diff --git a/smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelSpringStarterSmokeTest.java b/smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelSpringStarterSmokeTest.java index 773e495e4f28..34b6f9d3c43b 100644 --- a/smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelSpringStarterSmokeTest.java +++ b/smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelSpringStarterSmokeTest.java @@ -65,7 +65,8 @@ static class TestConfiguration { public void loadData() { jdbcTemplate .getObject() - .execute("create table customer (id bigint not null, name varchar not null, primary key (id))"); + .execute( + "create table customer (id bigint not null, name varchar not null, primary key (id))"); } @Bean diff --git a/smoke-tests-otel-starter/spring-smoke-testing/src/main/java/io/opentelemetry/spring/smoketest/EnabledInGithubActions.java b/smoke-tests-otel-starter/spring-smoke-testing/src/main/java/io/opentelemetry/spring/smoketest/EnabledInGithubActions.java deleted file mode 100644 index 532d81fb7c63..000000000000 --- a/smoke-tests-otel-starter/spring-smoke-testing/src/main/java/io/opentelemetry/spring/smoketest/EnabledInGithubActions.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.spring.smoketest; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; - -@Target({ElementType.TYPE, ElementType.METHOD}) -@Retention(RetentionPolicy.RUNTIME) -@Documented -@EnabledIfEnvironmentVariable( - named = "GITHUB_ACTIONS", - matches = "true", - disabledReason = - "Not currently executing within GitHub actions where the required external " - + "services (e.g. mongodb) are started using docker.") -public @interface EnabledInGithubActions {}