Skip to content

Commit

Permalink
Remove AWS Active Tracing span linking (#10930)
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerbenson authored Apr 1, 2024
1 parent d8b600d commit d7e9098
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 234 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ dependencies {

library("com.amazonaws:aws-lambda-java-core:1.0.0")

implementation("io.opentelemetry.contrib:opentelemetry-aws-xray-propagator")

// We do lightweight parsing of JSON to extract HTTP headers from requests for propagation.
// This will be commonly needed even for users that don't use events, but luckily it's not too big.
// Note that Lambda itself uses Jackson, but does not expose it to the function so we need to include
Expand All @@ -22,6 +20,7 @@ dependencies {
// allows to get the function ARN
testLibrary("com.amazonaws:aws-lambda-java-core:1.2.1")

testImplementation("io.opentelemetry.contrib:opentelemetry-aws-xray-propagator")
testImplementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure")
testImplementation("io.opentelemetry:opentelemetry-extension-trace-propagators")
testImplementation("com.google.guava:guava")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public static AwsLambdaFunctionInstrumenter createInstrumenter(OpenTelemetry ope
openTelemetry,
"io.opentelemetry.aws-lambda-core-1.0",
AwsLambdaFunctionInstrumenterFactory::spanName)
.addSpanLinksExtractor(new AwsXrayEnvSpanLinksExtractor())
.addAttributesExtractor(new AwsLambdaFunctionAttributesExtractor())
.buildInstrumenter(SpanKindExtractor.alwaysServer()));
}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");

Expand All @@ -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"))));
}
Expand Down

0 comments on commit d7e9098

Please sign in to comment.