Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
laurit committed Nov 28, 2024
1 parent b86f2de commit 1a93d0d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@

public class DynamoDbAttributesExtractor implements AttributesExtractor<Request<?>, Response<?>> {

// copied from DbIncubatingAttributes.DbSystemIncubatingValues
// copied from DbIncubatingAttributes
private static final AttributeKey<String> DB_SYSTEM = AttributeKey.stringKey("db.system");
// copied from AwsIncubatingAttributes
private static final AttributeKey<List<String>> AWS_DYNAMODB_TABLE_NAMES =
AttributeKey.stringArrayKey("aws.dynamodb.table_names");

// copied from DbIncubatingAttributes.DbSystemIncubatingValues
private static final String DYNAMODB = "dynamodb";

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@

package io.opentelemetry.instrumentation.awssdk.v1_11;

import static io.opentelemetry.api.common.AttributeKey.stringArrayKey;
import static io.opentelemetry.api.common.AttributeKey.stringKey;
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo;
import static io.opentelemetry.semconv.incubating.AwsIncubatingAttributes.AWS_DYNAMODB_TABLE_NAMES;
import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_SYSTEM;
import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DbSystemIncubatingValues.DYNAMODB;
import static java.util.Collections.singletonList;

import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
Expand Down Expand Up @@ -44,8 +46,8 @@ public void sendRequestWithMockedResponse() throws Exception {
List<AttributeAssertion> additionalAttributes =
Arrays.asList(
equalTo(stringKey("aws.table.name"), "sometable"),
equalTo(stringKey("db.system"), "dynamodb"),
equalTo(stringArrayKey("aws.dynamodb.table_names"), singletonList("sometable")));
equalTo(DB_SYSTEM, DYNAMODB),
equalTo(AWS_DYNAMODB_TABLE_NAMES, singletonList("sometable")));

Object response = client.createTable(new CreateTableRequest("sometable", null));
assertRequestWithMockedResponse(
Expand Down

0 comments on commit 1a93d0d

Please sign in to comment.