Run aws-sdk tests against 2.18.x
Resolves
MODIFY
instrumentation/aws-sdk/aws-sdk-2.2/javaagent/build.gradle.kts
instrumentation/aws-sdk/aws-sdk-2.2/javaagent/build.gradle.kts
@@ -26,16 +26,17 @@ dependencies {
testImplementation(project(":instrumentation:netty:netty-4.1:javaagent"))
latestDepTestLibrary("software.amazon.awssdk:aws-json-protocol:2.17.+")
- latestDepTestLibrary("software.amazon.awssdk:aws-core:2.17.+")
- latestDepTestLibrary("software.amazon.awssdk:dynamodb:2.17.+")
- latestDepTestLibrary("software.amazon.awssdk:ec2:2.17.+")
- latestDepTestLibrary("software.amazon.awssdk:kinesis:2.17.+")
- latestDepTestLibrary("software.amazon.awssdk:rds:2.17.+")
- latestDepTestLibrary("software.amazon.awssdk:s3:2.17.+")
- latestDepTestLibrary("software.amazon.awssdk:sqs:2.17.+")
+ latestDepTestLibrary("software.amazon.awssdk:aws-core:+")
+ latestDepTestLibrary("software.amazon.awssdk:dynamodb:+")
+ latestDepTestLibrary("software.amazon.awssdk:ec2:+")
+ latestDepTestLibrary("software.amazon.awssdk:kinesis:+")
+ latestDepTestLibrary("software.amazon.awssdk:rds:+")
+ latestDepTestLibrary("software.amazon.awssdk:s3:+")
+ latestDepTestLibrary("software.amazon.awssdk:sqs:+")
}
tasks.withType<Test>().configureEach {
+ systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)
// TODO run tests both with and without experimental span attributes
jvmArgs("-Dotel.instrumentation.aws-sdk.experimental-span-attributes=true")
}

MODIFY
instrumentation/aws-sdk/aws-sdk-2.2/library-autoconfigure/build.gradle.kts
instrumentation/aws-sdk/aws-sdk-2.2/library-autoconfigure/build.gradle.kts
@@ -12,18 +12,19 @@ dependencies {
testImplementation(project(":instrumentation:aws-sdk:aws-sdk-2.2:testing"))
- latestDepTestLibrary("software.amazon.awssdk:aws-core:2.17.+")
- latestDepTestLibrary("software.amazon.awssdk:aws-json-protocol:2.17.+")
- latestDepTestLibrary("software.amazon.awssdk:dynamodb:2.17.+")
- latestDepTestLibrary("software.amazon.awssdk:ec2:2.17.+")
- latestDepTestLibrary("software.amazon.awssdk:kinesis:2.17.+")
- latestDepTestLibrary("software.amazon.awssdk:rds:2.17.+")
- latestDepTestLibrary("software.amazon.awssdk:s3:2.17.+")
- latestDepTestLibrary("software.amazon.awssdk:sqs:2.17.+")
+ latestDepTestLibrary("software.amazon.awssdk:aws-core:+")
+ latestDepTestLibrary("software.amazon.awssdk:aws-json-protocol:+")
+ latestDepTestLibrary("software.amazon.awssdk:dynamodb:+")
+ latestDepTestLibrary("software.amazon.awssdk:ec2:+")
+ latestDepTestLibrary("software.amazon.awssdk:kinesis:+")
+ latestDepTestLibrary("software.amazon.awssdk:rds:+")
+ latestDepTestLibrary("software.amazon.awssdk:s3:+")
+ latestDepTestLibrary("software.amazon.awssdk:sqs:+")
}
tasks {
test {
+ systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)
systemProperty("otel.instrumentation.aws-sdk.experimental-span-attributes", true)
}
}

MODIFY
instrumentation/aws-sdk/aws-sdk-2.2/library/build.gradle.kts
instrumentation/aws-sdk/aws-sdk-2.2/library/build.gradle.kts
@@ -10,18 +10,19 @@ dependencies {
testImplementation(project(":instrumentation:aws-sdk:aws-sdk-2.2:testing"))
- latestDepTestLibrary("software.amazon.awssdk:aws-core:2.17.+")
- latestDepTestLibrary("software.amazon.awssdk:aws-json-protocol:2.17.+")
- latestDepTestLibrary("software.amazon.awssdk:dynamodb:2.17.+")
- latestDepTestLibrary("software.amazon.awssdk:ec2:2.17.+")
- latestDepTestLibrary("software.amazon.awssdk:kinesis:2.17.+")
- latestDepTestLibrary("software.amazon.awssdk:rds:2.17.+")
- latestDepTestLibrary("software.amazon.awssdk:s3:2.17.+")
- latestDepTestLibrary("software.amazon.awssdk:sqs:2.17.+")
+ latestDepTestLibrary("software.amazon.awssdk:aws-core:+")
+ latestDepTestLibrary("software.amazon.awssdk:aws-json-protocol:+")
+ latestDepTestLibrary("software.amazon.awssdk:dynamodb:+")
+ latestDepTestLibrary("software.amazon.awssdk:ec2:+")
+ latestDepTestLibrary("software.amazon.awssdk:kinesis:+")
+ latestDepTestLibrary("software.amazon.awssdk:rds:+")
+ latestDepTestLibrary("software.amazon.awssdk:s3:+")
+ latestDepTestLibrary("software.amazon.awssdk:sqs:+")
}
tasks {
test {
+ systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)
systemProperty("otel.instrumentation.aws-sdk.experimental-span-attributes", true)
}
}

MODIFY
instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientTest.groovy
instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientTest.groovy
@@ -385,8 +385,8 @@ abstract class AbstractAws2ClientTest extends InstrumentationSpecification {
where:
service | operation | method | path | requestId | builder | call | body
- "S3" | "CreateBucket" | "PUT" | "/somebucket" | "UNKNOWN" | S3Client.builder() | { c -> c.createBucket(CreateBucketRequest.builder().bucket("somebucket").build()) } | ""
- "S3" | "GetObject" | "GET" | "/somebucket/somekey" | "UNKNOWN" | S3Client.builder() | { c -> c.getObject(GetObjectRequest.builder().bucket("somebucket").key("somekey").build()) } | ""
+ "S3" | "CreateBucket" | "PUT" | path("somebucket") | "UNKNOWN" | S3Client.builder() | { c -> c.createBucket(CreateBucketRequest.builder().bucket("somebucket").build()) } | ""
+ "S3" | "GetObject" | "GET" | path("somebucket", "somekey") | "UNKNOWN" | S3Client.builder() | { c -> c.getObject(GetObjectRequest.builder().bucket("somebucket").key("somekey").build()) } | ""
"Kinesis" | "DeleteStream" | "POST" | "" | "UNKNOWN" | KinesisClient.builder() | { c -> c.deleteStream(DeleteStreamRequest.builder().streamName("somestream").build()) } | ""
"Sqs" | "CreateQueue" | "POST" | "" | "7a62c49f-347e-4fc4-9331-6e8e7a96aa73" | SqsClient.builder() | { c -> c.createQueue(CreateQueueRequest.builder().queueName("somequeue").build()) } | """
<CreateQueueResponse>
@@ -477,8 +477,8 @@ abstract class AbstractAws2ClientTest extends InstrumentationSpecification {
where:
service | operation | method | path | requestId | builder | call | body
- "S3" | "CreateBucket" | "PUT" | "/somebucket" | "UNKNOWN" | S3AsyncClient.builder() | { c -> c.createBucket(CreateBucketRequest.builder().bucket("somebucket").build()) } | ""
- "S3" | "GetObject" | "GET" | "/somebucket/somekey" | "UNKNOWN" | S3AsyncClient.builder() | { c -> c.getObject(GetObjectRequest.builder().bucket("somebucket").key("somekey").build(), AsyncResponseTransformer.toBytes()) } | "1234567890"
+ "S3" | "CreateBucket" | "PUT" | path("somebucket") | "UNKNOWN" | S3AsyncClient.builder() | { c -> c.createBucket(CreateBucketRequest.builder().bucket("somebucket").build()) } | ""
+ "S3" | "GetObject" | "GET" | path("somebucket", "somekey") | "UNKNOWN" | S3AsyncClient.builder() | { c -> c.getObject(GetObjectRequest.builder().bucket("somebucket").key("somekey").build(), AsyncResponseTransformer.toBytes()) } | "1234567890"
// Kinesis seems to expect an http2 response which is incompatible with our test server.
// "Kinesis" | "DeleteStream" | "POST" | "/" | "UNKNOWN" | KinesisAsyncClient.builder() | { c -> c.deleteStream(DeleteStreamRequest.builder().streamName("somestream").build()) } | ""
"Sqs" | "CreateQueue" | "POST" | "" | "7a62c49f-347e-4fc4-9331-6e8e7a96aa73" | SqsAsyncClient.builder() | { c -> c.createQueue(CreateQueueRequest.builder().queueName("somequeue").build()) } | """
@@ -535,6 +535,7 @@ abstract class AbstractAws2ClientTest extends InstrumentationSpecification {
then:
thrown SdkClientException
+ def path = path("somebucket", "somekey")
assertTraces(1) {
trace(0, 1) {
span(0) {
@@ -547,7 +548,7 @@ abstract class AbstractAws2ClientTest extends InstrumentationSpecification {
"$SemanticAttributes.NET_TRANSPORT" IP_TCP
"$SemanticAttributes.NET_PEER_NAME" "127.0.0.1"
"$SemanticAttributes.NET_PEER_PORT" server.httpPort()
- "$SemanticAttributes.HTTP_URL" "${server.httpUri()}/somebucket/somekey"
+ "$SemanticAttributes.HTTP_URL" "${server.httpUri()}${path}"
"$SemanticAttributes.HTTP_METHOD" "GET"
"$SemanticAttributes.HTTP_FLAVOR" "1.1"
"$SemanticAttributes.RPC_SYSTEM" "aws-api"
@@ -560,4 +561,16 @@ abstract class AbstractAws2ClientTest extends InstrumentationSpecification {
}
}
}
+
+ static String path(String bucket, String path = null) {
+ def result = ""
+ // since 2.18.0 bucket name is not present in request path
+ if (!Boolean.getBoolean("testLatestDeps") && !bucket.isEmpty()) {
+ result = "/" + bucket
+ }
+ if (path != null && !path.isEmpty()) {
+ result += "/" + path
+ }
+ return result
+ }
}

Run aws-sdk tests against 2.18.x (#6956)

Resolves
https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/6945