Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove AWS Active Tracing span linking #10930

Merged
merged 3 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(
tylerbenson marked this conversation as resolved.
Show resolved Hide resolved
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
Loading