Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -17,7 +17,7 @@ final class AwsExperimentalAttributes {
static final AttributeKey<String> AWS_QUEUE_NAME = stringKey("aws.queue.name");
static final AttributeKey<String> AWS_STREAM_NAME = stringKey("aws.stream.name");
static final AttributeKey<String> AWS_TABLE_NAME = stringKey("aws.table.name");
static final AttributeKey<String> AWS_REQUEST_ID = stringKey("aws.requestId");
static final AttributeKey<String> AWS_REQUEST_ID = stringKey("aws.request_id");

private AwsExperimentalAttributes() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,8 @@ private void onSdkResponse(
Span span, SdkResponse response, ExecutionAttributes executionAttributes) {
if (captureExperimentalSpanAttributes) {
if (response instanceof AwsResponse) {
span.setAttribute("aws.requestId", ((AwsResponse) response).responseMetadata().requestId());
span.setAttribute(
"aws.request_id", ((AwsResponse) response).responseMetadata().requestId());
}
AwsSdkRequest sdkRequest = executionAttributes.getAttribute(AWS_SDK_REQUEST_ATTRIBUTE);
if (sdkRequest != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ abstract class AbstractAws2ClientCoreTest extends InstrumentationSpecification {
"$RpcIncubatingAttributes.RPC_SERVICE" "DynamoDb"
"$RpcIncubatingAttributes.RPC_METHOD" "CreateTable"
"aws.agent" "java-aws-sdk"
"aws.requestId" "$requestId"
"aws.request_id" "$requestId"
"aws.table.name" "sometable"
"$DbIncubatingAttributes.DB_SYSTEM" "dynamodb"
"$DbIncubatingAttributes.DB_OPERATION" "CreateTable"
Expand Down Expand Up @@ -179,7 +179,7 @@ abstract class AbstractAws2ClientCoreTest extends InstrumentationSpecification {
"$RpcIncubatingAttributes.RPC_SERVICE" "DynamoDb"
"$RpcIncubatingAttributes.RPC_METHOD" "Query"
"aws.agent" "java-aws-sdk"
"aws.requestId" "$requestId"
"aws.request_id" "$requestId"
"aws.table.name" "sometable"
"$DbIncubatingAttributes.DB_SYSTEM" "dynamodb"
"$DbIncubatingAttributes.DB_OPERATION" "Query"
Expand Down Expand Up @@ -211,7 +211,7 @@ abstract class AbstractAws2ClientCoreTest extends InstrumentationSpecification {
"$RpcIncubatingAttributes.RPC_SERVICE" "$service"
"$RpcIncubatingAttributes.RPC_METHOD" "${operation}"
"aws.agent" "java-aws-sdk"
"aws.requestId" "$requestId"
"aws.request_id" "$requestId"
"aws.table.name" "sometable"
"$DbIncubatingAttributes.DB_SYSTEM" "dynamodb"
"$DbIncubatingAttributes.DB_OPERATION" "${operation}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ abstract class AbstractAws2ClientTest extends AbstractAws2ClientCoreTest {
"$RpcIncubatingAttributes.RPC_SERVICE" "$service"
"$RpcIncubatingAttributes.RPC_METHOD" "${operation}"
"aws.agent" "java-aws-sdk"
"aws.requestId" "$requestId"
"aws.request_id" "$requestId"
if (service == "S3") {
"aws.bucket.name" "somebucket"
} else if (service == "Sqs" && operation == "CreateQueue") {
Expand Down Expand Up @@ -295,7 +295,7 @@ abstract class AbstractAws2ClientTest extends AbstractAws2ClientCoreTest {
"$RpcIncubatingAttributes.RPC_SERVICE" "$service"
"$RpcIncubatingAttributes.RPC_METHOD" "${operation}"
"aws.agent" "java-aws-sdk"
"aws.requestId" "$requestId"
"aws.request_id" "$requestId"
if (service == "S3") {
"aws.bucket.name" "somebucket"
} else if (service == "Sqs" && operation == "CreateQueue") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ abstract class AbstractAws2SqsSuppressReceiveSpansTest extends InstrumentationSp
attributes {
"aws.agent" "java-aws-sdk"
"aws.queue.name" "testSdkSqs"
"aws.requestId" { it == "00000000-0000-0000-0000-000000000000" || it == "UNKNOWN" }
"aws.request_id" { it == "00000000-0000-0000-0000-000000000000" || it == "UNKNOWN" }
"rpc.system" "aws-api"
"rpc.service" "Sqs"
"rpc.method" "CreateQueue"
Expand All @@ -148,7 +148,7 @@ abstract class AbstractAws2SqsSuppressReceiveSpansTest extends InstrumentationSp
attributes {
"aws.agent" "java-aws-sdk"
"aws.queue.url" "http://localhost:$sqsPort/000000000000/testSdkSqs"
"aws.requestId" { it == "00000000-0000-0000-0000-000000000000" || it == "UNKNOWN" }
"aws.request_id" { it == "00000000-0000-0000-0000-000000000000" || it == "UNKNOWN" }
"rpc.system" "aws-api"
"rpc.method" "SendMessage"
"rpc.service" "Sqs"
Expand Down Expand Up @@ -208,7 +208,7 @@ abstract class AbstractAws2SqsSuppressReceiveSpansTest extends InstrumentationSp
hasNoLinks()
attributes {
"aws.agent" "java-aws-sdk"
"aws.requestId" { it == "00000000-0000-0000-0000-000000000000" || it == "UNKNOWN" }
"aws.request_id" { it == "00000000-0000-0000-0000-000000000000" || it == "UNKNOWN" }
"rpc.method" "ReceiveMessage"
"aws.queue.url" "http://localhost:$sqsPort/000000000000/testSdkSqs"
"rpc.system" "aws-api"
Expand Down Expand Up @@ -320,7 +320,7 @@ abstract class AbstractAws2SqsSuppressReceiveSpansTest extends InstrumentationSp
attributes {
"aws.agent" "java-aws-sdk"
"aws.queue.url" "http://localhost:$sqsPort/000000000000/testSdkSqs"
"aws.requestId" { it.trim() == "00000000-0000-0000-0000-000000000000" || it == "UNKNOWN" }
"aws.request_id" { it.trim() == "00000000-0000-0000-0000-000000000000" || it == "UNKNOWN" }
"rpc.system" "aws-api"
"rpc.method" "SendMessageBatch"
"rpc.service" "Sqs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,50 +156,48 @@ public void testSendDynamoDbRequestWithRetries() {

getTesting()
.waitAndAssertTraces(
trace -> {
trace.hasSpansSatisfyingExactly(
span -> {
span.hasKind(SpanKind.CLIENT);
span.hasNoParent();
span.hasAttributesSatisfying(
attributes -> {
assertThat(attributes)
.containsEntry(ServerAttributes.SERVER_ADDRESS, "127.0.0.1")
.containsEntry(ServerAttributes.SERVER_PORT, server.httpPort())
.containsEntry(HttpAttributes.HTTP_REQUEST_METHOD, method)
.containsEntry(HttpAttributes.HTTP_RESPONSE_STATUS_CODE, 200)
.containsEntry(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api")
.containsEntry(RpcIncubatingAttributes.RPC_SERVICE, service)
.containsEntry(RpcIncubatingAttributes.RPC_METHOD, operation)
.containsEntry("aws.agent", "java-aws-sdk")
.containsEntry("aws.requestId", requestId)
.containsEntry("aws.table.name", "sometable")
.containsEntry(DbIncubatingAttributes.DB_SYSTEM, "dynamodb")
.containsEntry(DbIncubatingAttributes.DB_OPERATION, operation);
});
if (isRecordIndividualHttpErrorEnabled()) {
span.hasEventsSatisfyingExactly(
event ->
event
.hasName("HTTP request failure")
.hasAttributesSatisfyingExactly(
equalTo(HttpAttributes.HTTP_RESPONSE_STATUS_CODE, 500),
equalTo(
AttributeKey.stringKey("aws.http.error_message"),
"DynamoDB could not process your request")),
event ->
event
.hasName("HTTP request failure")
.hasAttributesSatisfyingExactly(
equalTo(HttpAttributes.HTTP_RESPONSE_STATUS_CODE, 503),
equalTo(
AttributeKey.stringKey("aws.http.error_message"),
"DynamoDB is currently unavailable")));
} else {
span.hasEventsSatisfying(events -> assertThat(events.size()).isEqualTo(0));
}
});
});
trace ->
trace.hasSpansSatisfyingExactly(
span -> {
span.hasKind(SpanKind.CLIENT);
span.hasNoParent();
span.hasAttributesSatisfying(
attributes ->
assertThat(attributes)
.containsEntry(ServerAttributes.SERVER_ADDRESS, "127.0.0.1")
.containsEntry(ServerAttributes.SERVER_PORT, server.httpPort())
.containsEntry(HttpAttributes.HTTP_REQUEST_METHOD, method)
.containsEntry(HttpAttributes.HTTP_RESPONSE_STATUS_CODE, 200)
.containsEntry(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api")
.containsEntry(RpcIncubatingAttributes.RPC_SERVICE, service)
.containsEntry(RpcIncubatingAttributes.RPC_METHOD, operation)
.containsEntry("aws.agent", "java-aws-sdk")
.containsEntry("aws.request_id", requestId)
.containsEntry("aws.table.name", "sometable")
.containsEntry(DbIncubatingAttributes.DB_SYSTEM, "dynamodb")
.containsEntry(DbIncubatingAttributes.DB_OPERATION, operation));
if (isRecordIndividualHttpErrorEnabled()) {
span.hasEventsSatisfyingExactly(
event ->
event
.hasName("HTTP request failure")
.hasAttributesSatisfyingExactly(
equalTo(HttpAttributes.HTTP_RESPONSE_STATUS_CODE, 500),
equalTo(
AttributeKey.stringKey("aws.http.error_message"),
"DynamoDB could not process your request")),
event ->
event
.hasName("HTTP request failure")
.hasAttributesSatisfyingExactly(
equalTo(HttpAttributes.HTTP_RESPONSE_STATUS_CODE, 503),
equalTo(
AttributeKey.stringKey("aws.http.error_message"),
"DynamoDB is currently unavailable")));
} else {
span.hasEventsSatisfying(events -> assertThat(events.size()).isEqualTo(0));
}
}));

// make sure the response body input stream is still available and check its content to be
// expected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void assertSqsTraces(Boolean withParent, Boolean captureHeaders) {
equalTo(stringKey("aws.agent"), "java-aws-sdk"),
equalTo(stringKey("aws.queue.name"), "testSdkSqs"),
satisfies(
stringKey("aws.requestId"),
stringKey("aws.request_id"),
val ->
val.satisfiesAnyOf(
v ->
Expand Down Expand Up @@ -196,7 +196,7 @@ void assertSqsTraces(Boolean withParent, Boolean captureHeaders) {
stringKey("aws.queue.url"),
"http://localhost:" + sqsPort + "/000000000000/testSdkSqs"),
satisfies(
stringKey("aws.requestId"),
stringKey("aws.request_id"),
val ->
val.satisfiesAnyOf(
v ->
Expand Down Expand Up @@ -260,7 +260,7 @@ void assertSqsTraces(Boolean withParent, Boolean captureHeaders) {
stringKey("aws.queue.url"),
"http://localhost:" + sqsPort + "/000000000000/testSdkSqs"),
satisfies(
stringKey("aws.requestId"),
stringKey("aws.request_id"),
val ->
val.satisfiesAnyOf(
v ->
Expand Down Expand Up @@ -507,7 +507,7 @@ void testBatchSqsProducerConsumerServicesSync() throws URISyntaxException {
stringKey("aws.queue.url"),
"http://localhost:" + sqsPort + "/000000000000/testSdkSqs"),
satisfies(
stringKey("aws.requestId"),
stringKey("aws.request_id"),
val ->
val.satisfiesAnyOf(
v ->
Expand Down
Loading