From 759bae89e09cd95f7d85e89c24257d753819d40f Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Sat, 16 Aug 2025 12:05:53 +0200 Subject: [PATCH 1/8] add thread details to spring starter --- .../ThreadDetailsAutoConfiguration.java | 32 +++++++++++++++ .../properties/SpringConfigProperties.java | 2 +- .../main/resources/META-INF/spring.factories | 3 +- ...ot.autoconfigure.AutoConfiguration.imports | 1 + .../OpenTelemetryAutoConfigurationTest.java | 2 +- .../AddThreadDetailsSpanProcessorTest.groovy | 35 ----------------- sdk-autoconfigure-support/build.gradle.kts | 2 + .../ResourceProviderPropertiesCustomizer.java | 8 +++- .../AddThreadDetailsSpanProcessor.java | 19 +++++++-- ...re.spi.AutoConfigurationCustomizerProvider | 2 +- ...ourceProviderPropertiesCustomizerTest.java | 4 +- .../AddThreadDetailsSpanProcessorTest.java | 39 +++++++++++++++++++ ...try.sdk.autoconfigure.spi.ResourceProvider | 2 +- .../smoketest/OtelSpringStarterSmokeTest.java | 1 + ...alVmNativeKafkaSpringStarterSmokeTest.java | 2 +- ...VmNativeMongodbSpringStarterSmokeTest.java | 2 +- .../smoketest/OtelSpringStarterSmokeTest.java | 1 + ...bstractJvmKafkaSpringStarterSmokeTest.java | 2 + .../AbstractOtelSpringStarterSmokeTest.java | 18 +++++---- 19 files changed, 120 insertions(+), 57 deletions(-) create mode 100644 instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/instrumentation/thread/ThreadDetailsAutoConfiguration.java delete mode 100644 javaagent-tooling/src/test/groovy/io/opentelemetry/javaagent/tooling/AddThreadDetailsSpanProcessorTest.groovy rename sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/{ => internal}/resources/ResourceProviderPropertiesCustomizer.java (93%) rename {javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling => sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/internal/thread}/AddThreadDetailsSpanProcessor.java (58%) rename sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/{ => internal}/resources/ResourceProviderPropertiesCustomizerTest.java (96%) create mode 100644 sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/internal/thread/AddThreadDetailsSpanProcessorTest.java diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/instrumentation/thread/ThreadDetailsAutoConfiguration.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/instrumentation/thread/ThreadDetailsAutoConfiguration.java new file mode 100644 index 000000000000..fa28977133c6 --- /dev/null +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/instrumentation/thread/ThreadDetailsAutoConfiguration.java @@ -0,0 +1,32 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.spring.autoconfigure.internal.instrumentation.thread; + +import io.opentelemetry.instrumentation.internal.thread.AddThreadDetailsSpanProcessor; +import io.opentelemetry.instrumentation.spring.autoconfigure.internal.ConditionalOnEnabledInstrumentation; +import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * This class is internal and is hence not for public use. Its APIs are unstable and can change at + * any time. + */ +@ConditionalOnEnabledInstrumentation(module = "common.thread-details", enabledByDefault = false) +@Configuration +@SuppressWarnings("OtelPrivateConstructorForUtilityClass") +public class ThreadDetailsAutoConfiguration { + + @Bean + public AutoConfigurationCustomizerProvider threadDetailOtelCustomizer() { + return p -> + p.addTracerProviderCustomizer( + (builder, config) -> { + builder.addSpanProcessor(new AddThreadDetailsSpanProcessor()); + return builder; + }); + } +} diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/SpringConfigProperties.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/SpringConfigProperties.java index 05efa521d59a..5afa853ab080 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/SpringConfigProperties.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/SpringConfigProperties.java @@ -7,7 +7,7 @@ import io.opentelemetry.api.internal.ConfigUtil; import io.opentelemetry.exporter.otlp.internal.OtlpConfigUtil; -import io.opentelemetry.instrumentation.resources.ResourceProviderPropertiesCustomizer; +import io.opentelemetry.instrumentation.internal.resources.ResourceProviderPropertiesCustomizer; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import io.opentelemetry.sdk.autoconfigure.spi.internal.DefaultConfigProperties; import java.time.Duration; diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories b/instrumentation/spring/spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories index cb026785d354..aa3f1300ec31 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories @@ -13,7 +13,8 @@ io.opentelemetry.instrumentation.spring.autoconfigure.internal.instrumentation.w io.opentelemetry.instrumentation.spring.autoconfigure.internal.instrumentation.scheduling.SpringSchedulingInstrumentationAutoConfiguration,\ io.opentelemetry.instrumentation.spring.autoconfigure.internal.instrumentation.runtimemetrics.RuntimeMetricsAutoConfiguration,\ io.opentelemetry.instrumentation.spring.autoconfigure.internal.instrumentation.runtimemetrics.Java8RuntimeMetricsProvider,\ -io.opentelemetry.instrumentation.spring.autoconfigure.internal.instrumentation.runtimemetrics.Java17RuntimeMetricsProvider +io.opentelemetry.instrumentation.spring.autoconfigure.internal.instrumentation.runtimemetrics.Java17RuntimeMetricsProvider,\ +io.opentelemetry.instrumentation.spring.autoconfigure.internal.instrumentation.thread.ThreadDetailsAutoConfiguration org.springframework.context.ApplicationListener=\ io.opentelemetry.instrumentation.spring.autoconfigure.internal.instrumentation.logging.LogbackAppenderApplicationListener diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/instrumentation/spring/spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 2392e0c35592..e8c5e8a83d7a 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -14,3 +14,4 @@ io.opentelemetry.instrumentation.spring.autoconfigure.internal.instrumentation.s io.opentelemetry.instrumentation.spring.autoconfigure.internal.instrumentation.runtimemetrics.RuntimeMetricsAutoConfiguration io.opentelemetry.instrumentation.spring.autoconfigure.internal.instrumentation.runtimemetrics.Java8RuntimeMetricsProvider io.opentelemetry.instrumentation.spring.autoconfigure.internal.instrumentation.runtimemetrics.Java17RuntimeMetricsProvider +io.opentelemetry.instrumentation.spring.autoconfigure.internal.instrumentation.thread.ThreadDetailsAutoConfiguration diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfigurationTest.java index b37f074c34ac..4f798b21ab77 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfigurationTest.java @@ -100,7 +100,7 @@ void specialListProperties() { "io.opentelemetry.contrib.aws.resource.LambdaResourceProvider", "io.opentelemetry.contrib.gcp.resource.GCPResourceProvider", "io.opentelemetry.contrib.cloudfoundry.resources.CloudFoundryResourceProvider", - "io.opentelemetry.instrumentation.resources.ResourceProviderPropertiesCustomizerTest$Provider"); + "io.opentelemetry.instrumentation.internal.resources.ResourceProviderPropertiesCustomizerTest$Provider"); })); } diff --git a/javaagent-tooling/src/test/groovy/io/opentelemetry/javaagent/tooling/AddThreadDetailsSpanProcessorTest.groovy b/javaagent-tooling/src/test/groovy/io/opentelemetry/javaagent/tooling/AddThreadDetailsSpanProcessorTest.groovy deleted file mode 100644 index d3a8a8c933db..000000000000 --- a/javaagent-tooling/src/test/groovy/io/opentelemetry/javaagent/tooling/AddThreadDetailsSpanProcessorTest.groovy +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.javaagent.tooling - -import io.opentelemetry.context.Context -import io.opentelemetry.sdk.trace.ReadWriteSpan -import io.opentelemetry.semconv.incubating.ThreadIncubatingAttributes -import spock.lang.Specification - -class AddThreadDetailsSpanProcessorTest extends Specification { - def span = Mock(ReadWriteSpan) - - def processor = new AddThreadDetailsSpanProcessor() - - def "should require onStart call"() { - expect: - processor.isStartRequired() - } - - def "should set thread attributes on span start"() { - given: - def currentThreadName = Thread.currentThread().name - def currentThreadId = Thread.currentThread().id - - when: - processor.onStart(Context.root(), span) - - then: - 1 * span.setAttribute(ThreadIncubatingAttributes.THREAD_ID, currentThreadId) - 1 * span.setAttribute(ThreadIncubatingAttributes.THREAD_NAME, currentThreadName) - } -} diff --git a/sdk-autoconfigure-support/build.gradle.kts b/sdk-autoconfigure-support/build.gradle.kts index 7a2e5e185912..afeb4e6274dc 100644 --- a/sdk-autoconfigure-support/build.gradle.kts +++ b/sdk-autoconfigure-support/build.gradle.kts @@ -6,8 +6,10 @@ plugins { group = "io.opentelemetry.instrumentation" dependencies { + compileOnly("io.opentelemetry:opentelemetry-exporter-logging") api("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure") compileOnly("com.google.code.findbugs:annotations") testCompileOnly("com.google.code.findbugs:annotations") + testImplementation(project(":testing-common")) } diff --git a/sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/resources/ResourceProviderPropertiesCustomizer.java b/sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/internal/resources/ResourceProviderPropertiesCustomizer.java similarity index 93% rename from sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/resources/ResourceProviderPropertiesCustomizer.java rename to sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/internal/resources/ResourceProviderPropertiesCustomizer.java index d9242de19f79..f6647ccc19ab 100644 --- a/sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/resources/ResourceProviderPropertiesCustomizer.java +++ b/sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/internal/resources/ResourceProviderPropertiesCustomizer.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.instrumentation.resources; +package io.opentelemetry.instrumentation.internal.resources; import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizer; import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider; @@ -17,6 +17,10 @@ import java.util.Set; import javax.annotation.Nullable; +/** + * This class is internal and is hence not for public use. Its APIs are unstable and can change at + * any time. + */ public class ResourceProviderPropertiesCustomizer implements AutoConfigurationCustomizerProvider { private static final Map DISABLED_BY_DEFAULT_RESOURCE_PROVIDERS = new HashMap<>(); @@ -49,7 +53,7 @@ public class ResourceProviderPropertiesCustomizer implements AutoConfigurationCu "cloudfoundry"); // for testing DISABLED_BY_DEFAULT_RESOURCE_PROVIDERS.put( - "io.opentelemetry.instrumentation.resources.ResourceProviderPropertiesCustomizerTest$Provider", + "io.opentelemetry.instrumentation.internal.resources.ResourceProviderPropertiesCustomizerTest$Provider", "test"); } diff --git a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AddThreadDetailsSpanProcessor.java b/sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/internal/thread/AddThreadDetailsSpanProcessor.java similarity index 58% rename from javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AddThreadDetailsSpanProcessor.java rename to sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/internal/thread/AddThreadDetailsSpanProcessor.java index 496d8580ff79..43b12fa6c141 100644 --- a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AddThreadDetailsSpanProcessor.java +++ b/sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/internal/thread/AddThreadDetailsSpanProcessor.java @@ -3,22 +3,33 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.tooling; +package io.opentelemetry.instrumentation.internal.thread; +import static io.opentelemetry.api.common.AttributeKey.longKey; +import static io.opentelemetry.api.common.AttributeKey.stringKey; + +import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.context.Context; import io.opentelemetry.sdk.common.CompletableResultCode; import io.opentelemetry.sdk.trace.ReadWriteSpan; import io.opentelemetry.sdk.trace.ReadableSpan; import io.opentelemetry.sdk.trace.SpanProcessor; -import io.opentelemetry.semconv.incubating.ThreadIncubatingAttributes; +/** + * This class is internal and is hence not for public use. Its APIs are unstable and can change at + * any time. + */ public class AddThreadDetailsSpanProcessor implements SpanProcessor { + // attributes are not stable yet + public static final AttributeKey THREAD_ID = longKey("thread.id"); + public static final AttributeKey THREAD_NAME = stringKey("thread.name"); + @Override public void onStart(Context context, ReadWriteSpan span) { Thread currentThread = Thread.currentThread(); - span.setAttribute(ThreadIncubatingAttributes.THREAD_ID, currentThread.getId()); - span.setAttribute(ThreadIncubatingAttributes.THREAD_NAME, currentThread.getName()); + span.setAttribute(THREAD_ID, currentThread.getId()); + span.setAttribute(THREAD_NAME, currentThread.getName()); } @Override diff --git a/sdk-autoconfigure-support/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider b/sdk-autoconfigure-support/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider index 3f8716ab23aa..f52cd7078755 100644 --- a/sdk-autoconfigure-support/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider +++ b/sdk-autoconfigure-support/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider @@ -1 +1 @@ -io.opentelemetry.instrumentation.resources.ResourceProviderPropertiesCustomizer +io.opentelemetry.instrumentation.internal.resources.ResourceProviderPropertiesCustomizer diff --git a/sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/resources/ResourceProviderPropertiesCustomizerTest.java b/sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/internal/resources/ResourceProviderPropertiesCustomizerTest.java similarity index 96% rename from sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/resources/ResourceProviderPropertiesCustomizerTest.java rename to sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/internal/resources/ResourceProviderPropertiesCustomizerTest.java index 18928d915917..672e8ad69186 100644 --- a/sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/resources/ResourceProviderPropertiesCustomizerTest.java +++ b/sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/internal/resources/ResourceProviderPropertiesCustomizerTest.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.instrumentation.resources; +package io.opentelemetry.instrumentation.internal.resources; import static org.assertj.core.api.Assertions.assertThat; @@ -58,7 +58,7 @@ private EnabledTestCase( @TestFactory Stream enabledTestCases() { String className = - "io.opentelemetry.instrumentation.resources.ResourceProviderPropertiesCustomizerTest$Provider"; + "io.opentelemetry.instrumentation.internal.resources.ResourceProviderPropertiesCustomizerTest$Provider"; return Stream.of( new EnabledTestCase( "explicitEnabled", true, Collections.emptySet(), Collections.emptySet(), true), diff --git a/sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/internal/thread/AddThreadDetailsSpanProcessorTest.java b/sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/internal/thread/AddThreadDetailsSpanProcessorTest.java new file mode 100644 index 000000000000..29da26fb0bbd --- /dev/null +++ b/sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/internal/thread/AddThreadDetailsSpanProcessorTest.java @@ -0,0 +1,39 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.internal.thread; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; + +import io.opentelemetry.context.Context; +import io.opentelemetry.sdk.trace.ReadWriteSpan; +import io.opentelemetry.sdk.trace.SpanProcessor; +import io.opentelemetry.semconv.incubating.ThreadIncubatingAttributes; +import org.junit.jupiter.api.Test; + +class AddThreadDetailsSpanProcessorTest { + + private final ReadWriteSpan span = mock(ReadWriteSpan.class); + + private final SpanProcessor spanProcessor = new AddThreadDetailsSpanProcessor(); + + @Test + void onStart() { + assertThat(spanProcessor.isStartRequired()).isTrue(); + } + + @Test + void setThreadAttributes() { + Thread thread = Thread.currentThread(); + spanProcessor.onStart(Context.root(), span); + + verify(span).setAttribute(ThreadIncubatingAttributes.THREAD_ID, thread.getId()); + verify(span).setAttribute(ThreadIncubatingAttributes.THREAD_NAME, thread.getName()); + verifyNoMoreInteractions(span); + } +} diff --git a/sdk-autoconfigure-support/src/test/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider b/sdk-autoconfigure-support/src/test/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider index 243cb5615b57..3c09c998c9c7 100644 --- a/sdk-autoconfigure-support/src/test/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider +++ b/sdk-autoconfigure-support/src/test/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider @@ -1 +1 @@ -io.opentelemetry.instrumentation.resources.ResourceProviderPropertiesCustomizerTest$Provider +io.opentelemetry.instrumentation.internal.resources.ResourceProviderPropertiesCustomizerTest$Provider diff --git a/smoke-tests-otel-starter/spring-boot-2/src/test/java/io/opentelemetry/spring/smoketest/OtelSpringStarterSmokeTest.java b/smoke-tests-otel-starter/spring-boot-2/src/test/java/io/opentelemetry/spring/smoketest/OtelSpringStarterSmokeTest.java index 65315b926d5b..f911cc5aea78 100644 --- a/smoke-tests-otel-starter/spring-boot-2/src/test/java/io/opentelemetry/spring/smoketest/OtelSpringStarterSmokeTest.java +++ b/smoke-tests-otel-starter/spring-boot-2/src/test/java/io/opentelemetry/spring/smoketest/OtelSpringStarterSmokeTest.java @@ -18,5 +18,6 @@ // The headers are simply set here to make sure that headers can be parsed "otel.exporter.otlp.headers.c=3", "otel.instrumentation.runtime-telemetry.emit-experimental-telemetry=true", + "otel.instrumentation.common.thread_details.enabled=true", }) class OtelSpringStarterSmokeTest extends AbstractOtelSpringStarterSmokeTest {} diff --git a/smoke-tests-otel-starter/spring-boot-3/src/test/java/io/opentelemetry/spring/smoketest/GraalVmNativeKafkaSpringStarterSmokeTest.java b/smoke-tests-otel-starter/spring-boot-3/src/test/java/io/opentelemetry/spring/smoketest/GraalVmNativeKafkaSpringStarterSmokeTest.java index b64e19ce8c8c..fc53907b729a 100644 --- a/smoke-tests-otel-starter/spring-boot-3/src/test/java/io/opentelemetry/spring/smoketest/GraalVmNativeKafkaSpringStarterSmokeTest.java +++ b/smoke-tests-otel-starter/spring-boot-3/src/test/java/io/opentelemetry/spring/smoketest/GraalVmNativeKafkaSpringStarterSmokeTest.java @@ -27,6 +27,6 @@ AbstractKafkaSpringStarterSmokeTest.KafkaConfig.class }, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@EnabledInNativeImage // see JvmMongodbSpringStarterSmokeTest for the JVM test +@EnabledInNativeImage // see AbstractJvmKafkaSpringStarterSmokeTest for the JVM test @RequiresDockerCompose public class GraalVmNativeKafkaSpringStarterSmokeTest extends AbstractKafkaSpringStarterSmokeTest {} 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 18a8a46dda0a..4c26d4f82a56 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 @@ -23,7 +23,7 @@ @SpringBootTest( classes = {OtelSpringStarterSmokeTestApplication.class, SpringSmokeOtelConfiguration.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@EnabledInNativeImage // see JvmMongodbSpringStarterSmokeTest for the JVM test +@EnabledInNativeImage // see AbstractJvmMongodbSpringStarterSmokeTest for the JVM test @RequiresDockerCompose public class GraalVmNativeMongodbSpringStarterSmokeTest extends AbstractMongodbSpringStarterSmokeTest {} diff --git a/smoke-tests-otel-starter/spring-boot-3/src/test/java/io/opentelemetry/spring/smoketest/OtelSpringStarterSmokeTest.java b/smoke-tests-otel-starter/spring-boot-3/src/test/java/io/opentelemetry/spring/smoketest/OtelSpringStarterSmokeTest.java index 9fe9916312b2..538e68d3ffc3 100644 --- a/smoke-tests-otel-starter/spring-boot-3/src/test/java/io/opentelemetry/spring/smoketest/OtelSpringStarterSmokeTest.java +++ b/smoke-tests-otel-starter/spring-boot-3/src/test/java/io/opentelemetry/spring/smoketest/OtelSpringStarterSmokeTest.java @@ -21,6 +21,7 @@ "otel.exporter.otlp.headers.c=3", "otel.instrumentation.runtime-telemetry.emit-experimental-telemetry=true", "otel.instrumentation.runtime-telemetry-java17.enable-all=true", + "otel.instrumentation.common.thread_details.enabled=true", }) class OtelSpringStarterSmokeTest extends AbstractOtelSpringStarterSmokeTest { diff --git a/smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractJvmKafkaSpringStarterSmokeTest.java b/smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractJvmKafkaSpringStarterSmokeTest.java index 2441e61d2cb1..7052b6eef4a8 100644 --- a/smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractJvmKafkaSpringStarterSmokeTest.java +++ b/smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractJvmKafkaSpringStarterSmokeTest.java @@ -8,6 +8,7 @@ import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; import io.opentelemetry.instrumentation.spring.autoconfigure.internal.instrumentation.kafka.KafkaInstrumentationAutoConfiguration; +import io.opentelemetry.instrumentation.spring.autoconfigure.internal.instrumentation.thread.ThreadDetailsAutoConfiguration; import java.time.Duration; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; @@ -50,6 +51,7 @@ void setUpContext() { .withConfiguration( AutoConfigurations.of( OpenTelemetryAutoConfiguration.class, + ThreadDetailsAutoConfiguration.class, SpringSmokeOtelConfiguration.class, KafkaAutoConfiguration.class, KafkaInstrumentationAutoConfiguration.class, 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 7395ed49f0a4..aba56ee6c883 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 @@ -30,6 +30,7 @@ import io.opentelemetry.semconv.incubating.CodeIncubatingAttributes; import io.opentelemetry.semconv.incubating.DbIncubatingAttributes; import io.opentelemetry.semconv.incubating.ServiceIncubatingAttributes; +import io.opentelemetry.semconv.incubating.ThreadIncubatingAttributes; import java.net.URI; import java.util.ArrayList; import java.util.Arrays; @@ -37,6 +38,7 @@ import java.util.List; import org.assertj.core.api.AbstractCharSequenceAssert; import org.assertj.core.api.AbstractIterableAssert; +import org.assertj.core.api.AbstractLongAssert; import org.assertj.core.api.MapAssert; import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Test; @@ -180,9 +182,7 @@ void shouldSendTelemetry() { UrlAttributes.URL_FULL, stringAssert -> stringAssert.endsWith("/ping")), equalTo(ServerAttributes.SERVER_ADDRESS, "localhost"), - satisfies( - ServerAttributes.SERVER_PORT, - integerAssert -> integerAssert.isNotZero())), + satisfies(ServerAttributes.SERVER_PORT, AbstractLongAssert::isNotZero)), serverSpan -> HttpSpanDataAssert.create(serverSpan) .assertServerGetRequest("/ping") @@ -207,10 +207,14 @@ void shouldSendTelemetry() { equalTo( AttributeKey.stringArrayKey("http.request.header.key"), Collections.singletonList("value")), + satisfies(ServerAttributes.SERVER_PORT, AbstractLongAssert::isNotZero), + satisfies( + ThreadIncubatingAttributes.THREAD_ID, + AbstractLongAssert::isNotZero), satisfies( - ServerAttributes.SERVER_PORT, - integerAssert -> integerAssert.isNotZero())), - span -> withSpanAssert(span))); + ThreadIncubatingAttributes.THREAD_NAME, + AbstractCharSequenceAssert::isNotBlank)), + AbstractSpringStarterSmokeTest::withSpanAssert)); // Metric testing.waitAndAssertMetrics( @@ -309,7 +313,7 @@ void restTemplate() { span -> HttpSpanDataAssert.create(span).assertClientGetRequest("/ping"), span -> span.hasKind(SpanKind.SERVER).hasAttribute(HttpAttributes.HTTP_ROUTE, "/ping"), - span -> withSpanAssert(span))); + AbstractSpringStarterSmokeTest::withSpanAssert)); } @Test From 3920f1e186d2fb800f3f7e0f892c4e8b2758da63 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Sat, 16 Aug 2025 12:07:21 +0200 Subject: [PATCH 2/8] add thread details to spring starter --- sdk-autoconfigure-support/build.gradle.kts | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk-autoconfigure-support/build.gradle.kts b/sdk-autoconfigure-support/build.gradle.kts index afeb4e6274dc..c2948406f7e1 100644 --- a/sdk-autoconfigure-support/build.gradle.kts +++ b/sdk-autoconfigure-support/build.gradle.kts @@ -6,7 +6,6 @@ plugins { group = "io.opentelemetry.instrumentation" dependencies { - compileOnly("io.opentelemetry:opentelemetry-exporter-logging") api("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure") compileOnly("com.google.code.findbugs:annotations") From 2d5fc13bbb1a3ebff90f5db3c2775c7657e50ebb Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Mon, 18 Aug 2025 09:20:53 +0200 Subject: [PATCH 3/8] fix --- .../javaagent/tooling/AgentTracerProviderConfigurer.java | 1 + 1 file changed, 1 insertion(+) diff --git a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AgentTracerProviderConfigurer.java b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AgentTracerProviderConfigurer.java index 71223c79573c..223de247126e 100644 --- a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AgentTracerProviderConfigurer.java +++ b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AgentTracerProviderConfigurer.java @@ -11,6 +11,7 @@ import com.google.auto.service.AutoService; import com.google.errorprone.annotations.CanIgnoreReturnValue; import io.opentelemetry.exporter.logging.LoggingSpanExporter; +import io.opentelemetry.instrumentation.internal.thread.AddThreadDetailsSpanProcessor; import io.opentelemetry.javaagent.tooling.config.AgentConfig; import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizer; import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider; From 989ddc85fea82f363e9a233b15793b7d8d6b98de Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Wed, 20 Aug 2025 09:27:26 +0200 Subject: [PATCH 4/8] prefer lambda --- .../AbstractOtelSpringStarterSmokeTest.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) 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 aba56ee6c883..a2bf8eb04f14 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 @@ -36,9 +36,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import org.assertj.core.api.AbstractCharSequenceAssert; import org.assertj.core.api.AbstractIterableAssert; -import org.assertj.core.api.AbstractLongAssert; import org.assertj.core.api.MapAssert; import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Test; @@ -182,7 +180,7 @@ void shouldSendTelemetry() { UrlAttributes.URL_FULL, stringAssert -> stringAssert.endsWith("/ping")), equalTo(ServerAttributes.SERVER_ADDRESS, "localhost"), - satisfies(ServerAttributes.SERVER_PORT, AbstractLongAssert::isNotZero)), + satisfies(ServerAttributes.SERVER_PORT, val -> val.isNotZero())), serverSpan -> HttpSpanDataAssert.create(serverSpan) .assertServerGetRequest("/ping") @@ -195,7 +193,7 @@ void shouldSendTelemetry() { .hasAttribute( satisfies( ServiceIncubatingAttributes.SERVICE_INSTANCE_ID, - AbstractCharSequenceAssert::isNotBlank))) + val -> val.isNotBlank()))) .hasAttributesSatisfying( equalTo(HttpAttributes.HTTP_REQUEST_METHOD, "GET"), equalTo(HttpAttributes.HTTP_RESPONSE_STATUS_CODE, 200L), @@ -207,14 +205,11 @@ void shouldSendTelemetry() { equalTo( AttributeKey.stringArrayKey("http.request.header.key"), Collections.singletonList("value")), - satisfies(ServerAttributes.SERVER_PORT, AbstractLongAssert::isNotZero), + satisfies(ServerAttributes.SERVER_PORT, val -> val.isNotZero()), + satisfies(ThreadIncubatingAttributes.THREAD_ID, val -> val.isNotZero()), satisfies( - ThreadIncubatingAttributes.THREAD_ID, - AbstractLongAssert::isNotZero), - satisfies( - ThreadIncubatingAttributes.THREAD_NAME, - AbstractCharSequenceAssert::isNotBlank)), - AbstractSpringStarterSmokeTest::withSpanAssert)); + ThreadIncubatingAttributes.THREAD_NAME, val -> val.isNotBlank())), + val -> AbstractSpringStarterSmokeTest.withSpanAssert(val))); // Metric testing.waitAndAssertMetrics( From c74e86a8bf081877c15635fa34aefd42eea2e1ed Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Thu, 21 Aug 2025 12:58:00 +0200 Subject: [PATCH 5/8] pr feedback --- .../instrumentation/thread/ThreadDetailsAutoConfiguration.java | 2 +- .../internal/properties/SpringConfigProperties.java | 2 +- .../javaagent/tooling/AgentTracerProviderConfigurer.java | 2 +- .../internal}/ResourceProviderPropertiesCustomizer.java | 2 +- .../internal}/AddThreadDetailsSpanProcessor.java | 2 +- ...ry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider | 2 +- .../internal}/ResourceProviderPropertiesCustomizerTest.java | 2 +- .../internal}/AddThreadDetailsSpanProcessorTest.java | 2 +- .../io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider | 2 +- .../spring/smoketest/AbstractOtelSpringStarterSmokeTest.java | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) rename sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/{internal/resources => resources/internal}/ResourceProviderPropertiesCustomizer.java (98%) rename sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/{internal/thread => thread/internal}/AddThreadDetailsSpanProcessor.java (96%) rename sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/{internal/resources => resources/internal}/ResourceProviderPropertiesCustomizerTest.java (98%) rename sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/{internal/thread => thread/internal}/AddThreadDetailsSpanProcessorTest.java (95%) diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/instrumentation/thread/ThreadDetailsAutoConfiguration.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/instrumentation/thread/ThreadDetailsAutoConfiguration.java index fa28977133c6..eaed28555dae 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/instrumentation/thread/ThreadDetailsAutoConfiguration.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/instrumentation/thread/ThreadDetailsAutoConfiguration.java @@ -5,8 +5,8 @@ package io.opentelemetry.instrumentation.spring.autoconfigure.internal.instrumentation.thread; -import io.opentelemetry.instrumentation.internal.thread.AddThreadDetailsSpanProcessor; import io.opentelemetry.instrumentation.spring.autoconfigure.internal.ConditionalOnEnabledInstrumentation; +import io.opentelemetry.instrumentation.thread.internal.AddThreadDetailsSpanProcessor; import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/SpringConfigProperties.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/SpringConfigProperties.java index 5afa853ab080..4f0412ef023b 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/SpringConfigProperties.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/SpringConfigProperties.java @@ -7,7 +7,7 @@ import io.opentelemetry.api.internal.ConfigUtil; import io.opentelemetry.exporter.otlp.internal.OtlpConfigUtil; -import io.opentelemetry.instrumentation.internal.resources.ResourceProviderPropertiesCustomizer; +import io.opentelemetry.instrumentation.resources.internal.ResourceProviderPropertiesCustomizer; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import io.opentelemetry.sdk.autoconfigure.spi.internal.DefaultConfigProperties; import java.time.Duration; diff --git a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AgentTracerProviderConfigurer.java b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AgentTracerProviderConfigurer.java index 223de247126e..4f4009038a6b 100644 --- a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AgentTracerProviderConfigurer.java +++ b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AgentTracerProviderConfigurer.java @@ -11,7 +11,7 @@ import com.google.auto.service.AutoService; import com.google.errorprone.annotations.CanIgnoreReturnValue; import io.opentelemetry.exporter.logging.LoggingSpanExporter; -import io.opentelemetry.instrumentation.internal.thread.AddThreadDetailsSpanProcessor; +import io.opentelemetry.instrumentation.thread.internal.AddThreadDetailsSpanProcessor; import io.opentelemetry.javaagent.tooling.config.AgentConfig; import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizer; import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider; diff --git a/sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/internal/resources/ResourceProviderPropertiesCustomizer.java b/sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/resources/internal/ResourceProviderPropertiesCustomizer.java similarity index 98% rename from sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/internal/resources/ResourceProviderPropertiesCustomizer.java rename to sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/resources/internal/ResourceProviderPropertiesCustomizer.java index f6647ccc19ab..552d933db0af 100644 --- a/sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/internal/resources/ResourceProviderPropertiesCustomizer.java +++ b/sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/resources/internal/ResourceProviderPropertiesCustomizer.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.instrumentation.internal.resources; +package io.opentelemetry.instrumentation.resources.internal; import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizer; import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider; diff --git a/sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/internal/thread/AddThreadDetailsSpanProcessor.java b/sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/thread/internal/AddThreadDetailsSpanProcessor.java similarity index 96% rename from sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/internal/thread/AddThreadDetailsSpanProcessor.java rename to sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/thread/internal/AddThreadDetailsSpanProcessor.java index 43b12fa6c141..b0036384eebc 100644 --- a/sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/internal/thread/AddThreadDetailsSpanProcessor.java +++ b/sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/thread/internal/AddThreadDetailsSpanProcessor.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.instrumentation.internal.thread; +package io.opentelemetry.instrumentation.thread.internal; import static io.opentelemetry.api.common.AttributeKey.longKey; import static io.opentelemetry.api.common.AttributeKey.stringKey; diff --git a/sdk-autoconfigure-support/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider b/sdk-autoconfigure-support/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider index f52cd7078755..caf1b52f87f7 100644 --- a/sdk-autoconfigure-support/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider +++ b/sdk-autoconfigure-support/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider @@ -1 +1 @@ -io.opentelemetry.instrumentation.internal.resources.ResourceProviderPropertiesCustomizer +io.opentelemetry.instrumentation.resources.internal.ResourceProviderPropertiesCustomizer diff --git a/sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/internal/resources/ResourceProviderPropertiesCustomizerTest.java b/sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/resources/internal/ResourceProviderPropertiesCustomizerTest.java similarity index 98% rename from sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/internal/resources/ResourceProviderPropertiesCustomizerTest.java rename to sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/resources/internal/ResourceProviderPropertiesCustomizerTest.java index 672e8ad69186..249288169a8d 100644 --- a/sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/internal/resources/ResourceProviderPropertiesCustomizerTest.java +++ b/sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/resources/internal/ResourceProviderPropertiesCustomizerTest.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.instrumentation.internal.resources; +package io.opentelemetry.instrumentation.resources.internal; import static org.assertj.core.api.Assertions.assertThat; diff --git a/sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/internal/thread/AddThreadDetailsSpanProcessorTest.java b/sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/thread/internal/AddThreadDetailsSpanProcessorTest.java similarity index 95% rename from sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/internal/thread/AddThreadDetailsSpanProcessorTest.java rename to sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/thread/internal/AddThreadDetailsSpanProcessorTest.java index 29da26fb0bbd..81353695c87c 100644 --- a/sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/internal/thread/AddThreadDetailsSpanProcessorTest.java +++ b/sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/thread/internal/AddThreadDetailsSpanProcessorTest.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.instrumentation.internal.thread; +package io.opentelemetry.instrumentation.thread.internal; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; diff --git a/sdk-autoconfigure-support/src/test/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider b/sdk-autoconfigure-support/src/test/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider index 3c09c998c9c7..b6ee551c801f 100644 --- a/sdk-autoconfigure-support/src/test/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider +++ b/sdk-autoconfigure-support/src/test/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider @@ -1 +1 @@ -io.opentelemetry.instrumentation.internal.resources.ResourceProviderPropertiesCustomizerTest$Provider +io.opentelemetry.instrumentation.resources.internal.ResourceProviderPropertiesCustomizerTest$Provider 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 a2bf8eb04f14..32070ced497a 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 @@ -308,7 +308,7 @@ void restTemplate() { span -> HttpSpanDataAssert.create(span).assertClientGetRequest("/ping"), span -> span.hasKind(SpanKind.SERVER).hasAttribute(HttpAttributes.HTTP_ROUTE, "/ping"), - AbstractSpringStarterSmokeTest::withSpanAssert)); + span -> withSpanAssert(span))); } @Test From e4e5d701750da348f65d7b5791841f1ab453c4ac Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Thu, 21 Aug 2025 12:58:57 +0200 Subject: [PATCH 6/8] pr feedback --- .../spring/smoketest/AbstractOtelSpringStarterSmokeTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 32070ced497a..c35322169344 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 @@ -209,7 +209,7 @@ void shouldSendTelemetry() { satisfies(ThreadIncubatingAttributes.THREAD_ID, val -> val.isNotZero()), satisfies( ThreadIncubatingAttributes.THREAD_NAME, val -> val.isNotBlank())), - val -> AbstractSpringStarterSmokeTest.withSpanAssert(val))); + val -> withSpanAssert(val))); // Metric testing.waitAndAssertMetrics( From 2b94507696acb0284a664dab83d0f5e99d4dd30c Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Thu, 21 Aug 2025 14:47:50 +0200 Subject: [PATCH 7/8] fix --- .../autoconfigure/OpenTelemetryAutoConfigurationTest.java | 2 +- .../internal/ResourceProviderPropertiesCustomizer.java | 2 +- .../internal/ResourceProviderPropertiesCustomizerTest.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfigurationTest.java index 4f798b21ab77..1e1a04bb5f10 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfigurationTest.java @@ -100,7 +100,7 @@ void specialListProperties() { "io.opentelemetry.contrib.aws.resource.LambdaResourceProvider", "io.opentelemetry.contrib.gcp.resource.GCPResourceProvider", "io.opentelemetry.contrib.cloudfoundry.resources.CloudFoundryResourceProvider", - "io.opentelemetry.instrumentation.internal.resources.ResourceProviderPropertiesCustomizerTest$Provider"); + "io.opentelemetry.instrumentation.resources.internal.ResourceProviderPropertiesCustomizerTest$Provider"); })); } diff --git a/sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/resources/internal/ResourceProviderPropertiesCustomizer.java b/sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/resources/internal/ResourceProviderPropertiesCustomizer.java index 552d933db0af..7dfabf0a7655 100644 --- a/sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/resources/internal/ResourceProviderPropertiesCustomizer.java +++ b/sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/resources/internal/ResourceProviderPropertiesCustomizer.java @@ -53,7 +53,7 @@ public class ResourceProviderPropertiesCustomizer implements AutoConfigurationCu "cloudfoundry"); // for testing DISABLED_BY_DEFAULT_RESOURCE_PROVIDERS.put( - "io.opentelemetry.instrumentation.internal.resources.ResourceProviderPropertiesCustomizerTest$Provider", + "io.opentelemetry.instrumentation.resources.internal.ResourceProviderPropertiesCustomizerTest$Provider", "test"); } diff --git a/sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/resources/internal/ResourceProviderPropertiesCustomizerTest.java b/sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/resources/internal/ResourceProviderPropertiesCustomizerTest.java index 249288169a8d..1850a2e746ba 100644 --- a/sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/resources/internal/ResourceProviderPropertiesCustomizerTest.java +++ b/sdk-autoconfigure-support/src/test/java/io/opentelemetry/instrumentation/resources/internal/ResourceProviderPropertiesCustomizerTest.java @@ -58,7 +58,7 @@ private EnabledTestCase( @TestFactory Stream enabledTestCases() { String className = - "io.opentelemetry.instrumentation.internal.resources.ResourceProviderPropertiesCustomizerTest$Provider"; + "io.opentelemetry.instrumentation.resources.internal.ResourceProviderPropertiesCustomizerTest$Provider"; return Stream.of( new EnabledTestCase( "explicitEnabled", true, Collections.emptySet(), Collections.emptySet(), true), From 7b58ee9bdda43007569b4414bcb4def5a4e743f8 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Fri, 22 Aug 2025 08:14:46 +0200 Subject: [PATCH 8/8] Update instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/instrumentation/thread/ThreadDetailsAutoConfiguration.java Co-authored-by: Trask Stalnaker --- .../instrumentation/thread/ThreadDetailsAutoConfiguration.java | 1 - 1 file changed, 1 deletion(-) diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/instrumentation/thread/ThreadDetailsAutoConfiguration.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/instrumentation/thread/ThreadDetailsAutoConfiguration.java index eaed28555dae..91a0049a7dc8 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/instrumentation/thread/ThreadDetailsAutoConfiguration.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/instrumentation/thread/ThreadDetailsAutoConfiguration.java @@ -17,7 +17,6 @@ */ @ConditionalOnEnabledInstrumentation(module = "common.thread-details", enabledByDefault = false) @Configuration -@SuppressWarnings("OtelPrivateConstructorForUtilityClass") public class ThreadDetailsAutoConfiguration { @Bean