Skip to content

Commit b35671b

Browse files
committed
add test
1 parent b01668c commit b35671b

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
@@ -35,9 +35,11 @@
3535
import java.util.Arrays;
3636
import java.util.Collections;
3737
import java.util.List;
38+
import io.opentelemetry.semconv.incubating.ThreadIncubatingAttributes;
3839
import org.assertj.core.api.AbstractCharSequenceAssert;
3940
import org.assertj.core.api.AbstractIterableAssert;
4041
import org.assertj.core.api.MapAssert;
42+
import org.assertj.core.api.AbstractLongAssert;
4143
import org.junit.jupiter.api.MethodOrderer;
4244
import org.junit.jupiter.api.Test;
4345
import org.junit.jupiter.api.TestMethodOrder;
@@ -180,9 +182,7 @@ void shouldSendTelemetry() {
180182
UrlAttributes.URL_FULL,
181183
stringAssert -> stringAssert.endsWith("/ping")),
182184
equalTo(ServerAttributes.SERVER_ADDRESS, "localhost"),
183-
satisfies(
184-
ServerAttributes.SERVER_PORT,
185-
integerAssert -> integerAssert.isNotZero())),
185+
satisfies(ServerAttributes.SERVER_PORT, AbstractLongAssert::isNotZero)),
186186
serverSpan ->
187187
HttpSpanDataAssert.create(serverSpan)
188188
.assertServerGetRequest("/ping")
@@ -205,10 +205,14 @@ void shouldSendTelemetry() {
205205
equalTo(
206206
AttributeKey.stringArrayKey("http.request.header.key"),
207207
Collections.singletonList("value")),
208+
satisfies(ServerAttributes.SERVER_PORT, AbstractLongAssert::isNotZero),
209+
satisfies(
210+
ThreadIncubatingAttributes.THREAD_ID,
211+
AbstractLongAssert::isNotZero),
208212
satisfies(
209-
ServerAttributes.SERVER_PORT,
210-
integerAssert -> integerAssert.isNotZero())),
211-
span -> withSpanAssert(span)));
213+
ThreadIncubatingAttributes.THREAD_NAME,
214+
AbstractCharSequenceAssert::isNotBlank)),
215+
AbstractSpringStarterSmokeTest::withSpanAssert));
212216

213217
// Metric
214218
testing.waitAndAssertMetrics(
@@ -307,7 +311,7 @@ void restTemplate() {
307311
span -> HttpSpanDataAssert.create(span).assertClientGetRequest("/ping"),
308312
span ->
309313
span.hasKind(SpanKind.SERVER).hasAttribute(HttpAttributes.HTTP_ROUTE, "/ping"),
310-
span -> withSpanAssert(span)));
314+
AbstractSpringStarterSmokeTest::withSpanAssert));
311315
}
312316

313317
@Test

0 commit comments

Comments
 (0)