diff --git a/instrumentation/aws-lambda/aws-lambda-core-1.0/testing/src/main/java/io/opentelemetry/instrumentation/awslambdacore/v1_0/AbstractAwsLambdaTest.java b/instrumentation/aws-lambda/aws-lambda-core-1.0/testing/src/main/java/io/opentelemetry/instrumentation/awslambdacore/v1_0/AbstractAwsLambdaTest.java index 25a32896aad5..32cfe1742e6d 100644 --- a/instrumentation/aws-lambda/aws-lambda-core-1.0/testing/src/main/java/io/opentelemetry/instrumentation/awslambdacore/v1_0/AbstractAwsLambdaTest.java +++ b/instrumentation/aws-lambda/aws-lambda-core-1.0/testing/src/main/java/io/opentelemetry/instrumentation/awslambdacore/v1_0/AbstractAwsLambdaTest.java @@ -12,8 +12,6 @@ import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.RequestHandler; -import io.opentelemetry.api.common.AttributeKey; -import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.trace.SpanKind; import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; import io.opentelemetry.sdk.trace.data.StatusData; @@ -91,11 +89,15 @@ void handlerTracedWithException() { equalTo(SemanticAttributes.FAAS_INVOCATION_ID, "1-22-333")))); } + /** + * For more details about active tracing see + * https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html + */ @Test @SetEnvironmentVariable( key = "_X_AMZN_TRACE_ID", value = "Root=1-8a3c60f7-d188f8fa79d48a391a778fa6;Parent=0000000000000456;Sampled=1") - void handlerLinksToInfrastructureTrace() { + void handlerDoesNotLinkToActiveTracingSpan() { String result = handler().handleRequest("hello", context); assertThat(result).isEqualTo("world"); @@ -106,22 +108,8 @@ void handlerLinksToInfrastructureTrace() { span -> span.hasName("my_function") .hasKind(SpanKind.SERVER) - .hasLinksSatisfying( - links -> - assertThat(links) - .singleElement() - .satisfies( - link -> { - assertThat(link.getSpanContext().getTraceId()) - .isEqualTo("8a3c60f7d188f8fa79d48a391a778fa6"); - assertThat(link.getSpanContext().getSpanId()) - .isEqualTo("0000000000000456"); - assertThat(link.getAttributes()) - .isEqualTo( - Attributes.of( - AttributeKey.stringKey("source"), - "x-ray-env")); - })) + .hasNoParent() + .hasLinks() .hasAttributesSatisfyingExactly( equalTo(SemanticAttributes.FAAS_INVOCATION_ID, "1-22-333")))); }