Skip to content

Commit e27e248

Browse files
committed
add test
1 parent 0d78c20 commit e27e248

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

sdk-autoconfigure-support/src/main/java/io/opentelemetry/instrumentation/tracer/AddThreadDetailsSpanProcessor.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public class AddThreadDetailsSpanProcessor implements SpanProcessor {
2121
public static final AttributeKey<Long> THREAD_ID = longKey("thread.id");
2222
public static final AttributeKey<String> THREAD_NAME = stringKey("thread.name");
2323

24-
2524
@Override
2625
public void onStart(Context context, ReadWriteSpan span) {
2726
Thread currentThread = Thread.currentThread();

smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelSpringStarterSmokeTest.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@
3333
import java.util.Arrays;
3434
import java.util.Collections;
3535
import java.util.List;
36+
import io.opentelemetry.semconv.incubating.ThreadIncubatingAttributes;
3637
import org.assertj.core.api.AbstractCharSequenceAssert;
3738
import org.assertj.core.api.AbstractIterableAssert;
39+
import org.assertj.core.api.AbstractLongAssert;
3840
import org.junit.jupiter.api.MethodOrderer;
3941
import org.junit.jupiter.api.Test;
4042
import org.junit.jupiter.api.TestMethodOrder;
@@ -176,9 +178,7 @@ void shouldSendTelemetry() {
176178
UrlAttributes.URL_FULL,
177179
stringAssert -> stringAssert.endsWith("/ping")),
178180
equalTo(ServerAttributes.SERVER_ADDRESS, "localhost"),
179-
satisfies(
180-
ServerAttributes.SERVER_PORT,
181-
integerAssert -> integerAssert.isNotZero())),
181+
satisfies(ServerAttributes.SERVER_PORT, AbstractLongAssert::isNotZero)),
182182
serverSpan ->
183183
HttpSpanDataAssert.create(serverSpan)
184184
.assertServerGetRequest("/ping")
@@ -201,10 +201,14 @@ void shouldSendTelemetry() {
201201
equalTo(
202202
AttributeKey.stringArrayKey("http.request.header.key"),
203203
Collections.singletonList("value")),
204+
satisfies(ServerAttributes.SERVER_PORT, AbstractLongAssert::isNotZero),
205+
satisfies(
206+
ThreadIncubatingAttributes.THREAD_ID,
207+
AbstractLongAssert::isNotZero),
204208
satisfies(
205-
ServerAttributes.SERVER_PORT,
206-
integerAssert -> integerAssert.isNotZero())),
207-
span -> withSpanAssert(span)));
209+
ThreadIncubatingAttributes.THREAD_NAME,
210+
AbstractCharSequenceAssert::isNotBlank)),
211+
AbstractSpringStarterSmokeTest::withSpanAssert));
208212

209213
// Metric
210214
testing.waitAndAssertMetrics(
@@ -292,7 +296,7 @@ void restTemplate() {
292296
span -> HttpSpanDataAssert.create(span).assertClientGetRequest("/ping"),
293297
span ->
294298
span.hasKind(SpanKind.SERVER).hasAttribute(HttpAttributes.HTTP_ROUTE, "/ping"),
295-
span -> withSpanAssert(span)));
299+
AbstractSpringStarterSmokeTest::withSpanAssert));
296300
}
297301

298302
@Test

0 commit comments

Comments
 (0)