Skip to content

Commit de31fa6

Browse files
committed
add test
1 parent 26b626f commit de31fa6

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")
@@ -207,10 +207,14 @@ void shouldSendTelemetry() {
207207
equalTo(
208208
AttributeKey.stringArrayKey("http.request.header.key"),
209209
Collections.singletonList("value")),
210+
satisfies(ServerAttributes.SERVER_PORT, AbstractLongAssert::isNotZero),
211+
satisfies(
212+
ThreadIncubatingAttributes.THREAD_ID,
213+
AbstractLongAssert::isNotZero),
210214
satisfies(
211-
ServerAttributes.SERVER_PORT,
212-
integerAssert -> integerAssert.isNotZero())),
213-
span -> withSpanAssert(span)));
215+
ThreadIncubatingAttributes.THREAD_NAME,
216+
AbstractCharSequenceAssert::isNotBlank)),
217+
AbstractSpringStarterSmokeTest::withSpanAssert));
214218

215219
// Metric
216220
testing.waitAndAssertMetrics(
@@ -309,7 +313,7 @@ void restTemplate() {
309313
span -> HttpSpanDataAssert.create(span).assertClientGetRequest("/ping"),
310314
span ->
311315
span.hasKind(SpanKind.SERVER).hasAttribute(HttpAttributes.HTTP_ROUTE, "/ping"),
312-
span -> withSpanAssert(span)));
316+
AbstractSpringStarterSmokeTest::withSpanAssert));
313317
}
314318

315319
@Test

0 commit comments

Comments
 (0)