-
Notifications
You must be signed in to change notification settings - Fork 881
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added dynamodb instrumenter for aws v1_11 sdk (#12756)
Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>
- Loading branch information
Showing
11 changed files
with
118 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
.../main/java/io/opentelemetry/instrumentation/awssdk/v1_11/DynamoDbAttributesExtractor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.instrumentation.awssdk.v1_11; | ||
|
||
import com.amazonaws.Request; | ||
import com.amazonaws.Response; | ||
import io.opentelemetry.api.common.AttributeKey; | ||
import io.opentelemetry.api.common.AttributesBuilder; | ||
import io.opentelemetry.context.Context; | ||
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; | ||
import io.opentelemetry.instrumentation.api.internal.AttributesExtractorUtil; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import javax.annotation.Nullable; | ||
|
||
public class DynamoDbAttributesExtractor implements AttributesExtractor<Request<?>, Response<?>> { | ||
|
||
// 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 | ||
public void onStart(AttributesBuilder attributes, Context parentContext, Request<?> request) { | ||
AttributesExtractorUtil.internalSet(attributes, DB_SYSTEM, DYNAMODB); | ||
String tableName = RequestAccess.getTableName(request.getOriginalRequest()); | ||
AttributesExtractorUtil.internalSet( | ||
attributes, AWS_DYNAMODB_TABLE_NAMES, Collections.singletonList(tableName)); | ||
} | ||
|
||
@Override | ||
public void onEnd( | ||
AttributesBuilder attributes, | ||
Context context, | ||
Request<?> request, | ||
@Nullable Response<?> response, | ||
@Nullable Throwable error) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters