55
66package io .opentelemetry .instrumentation .awssdk .v2_2 .internal ;
77
8+ import static io .opentelemetry .api .common .AttributeKey .booleanKey ;
9+ import static io .opentelemetry .api .common .AttributeKey .doubleKey ;
10+ import static io .opentelemetry .api .common .AttributeKey .longKey ;
11+ import static io .opentelemetry .api .common .AttributeKey .stringArrayKey ;
12+ import static io .opentelemetry .api .common .AttributeKey .stringKey ;
813import static io .opentelemetry .instrumentation .awssdk .v2_2 .internal .AwsSdkRequestType .BEDROCK_RUNTIME ;
914import static io .opentelemetry .instrumentation .awssdk .v2_2 .internal .AwsSdkRequestType .DYNAMODB ;
1015import static io .opentelemetry .instrumentation .awssdk .v2_2 .internal .AwsSdkRequestType .KINESIS ;
1318import static io .opentelemetry .instrumentation .awssdk .v2_2 .internal .AwsSdkRequestType .SECRETSMANAGER ;
1419import static io .opentelemetry .instrumentation .awssdk .v2_2 .internal .AwsSdkRequestType .SNS ;
1520import static io .opentelemetry .instrumentation .awssdk .v2_2 .internal .AwsSdkRequestType .SQS ;
16- import static io .opentelemetry .instrumentation .awssdk .v2_2 .internal .AwsSdkRequestType .STEPFUNCTIONS ;
21+ import static io .opentelemetry .instrumentation .awssdk .v2_2 .internal .AwsSdkRequestType .STEP_FUNCTIONS ;
1722import static io .opentelemetry .instrumentation .awssdk .v2_2 .internal .FieldMapping .request ;
1823import static io .opentelemetry .instrumentation .awssdk .v2_2 .internal .FieldMapping .response ;
1924
@@ -40,97 +45,118 @@ enum AwsSdkRequest {
4045 KinesisRequest (KINESIS , "KinesisRequest" ),
4146 LambdaRequest (LAMBDA , "LambdaRequest" ),
4247 SecretsManagerRequest (SECRETSMANAGER , "SecretsManagerRequest" ),
43- StepFunctionsRequest (STEPFUNCTIONS , "SfnRequest" ),
48+ StepFunctionsRequest (STEP_FUNCTIONS , "SfnRequest" ),
4449 // specific requests
4550 BatchGetItem (
4651 DYNAMODB ,
4752 "dynamodb.model.BatchGetItemRequest" ,
48- request ("aws.dynamodb.table_names" , "RequestItems" ),
49- response ("aws.dynamodb.consumed_capacity" , "ConsumedCapacity" )),
53+ request (stringArrayKey ( "aws.dynamodb.table_names" ) , "RequestItems" ),
54+ response (stringArrayKey ( "aws.dynamodb.consumed_capacity" ) , "ConsumedCapacity" )),
5055 BatchWriteItem (
5156 DYNAMODB ,
5257 "dynamodb.model.BatchWriteItemRequest" ,
53- request ("aws.dynamodb.table_names" , "RequestItems" ),
54- response ("aws.dynamodb.consumed_capacity" , "ConsumedCapacity" ),
55- response ("aws.dynamodb.item_collection_metrics" , "ItemCollectionMetrics" )),
58+ request (stringArrayKey ( "aws.dynamodb.table_names" ) , "RequestItems" ),
59+ response (stringArrayKey ( "aws.dynamodb.consumed_capacity" ) , "ConsumedCapacity" ),
60+ response (stringKey ( "aws.dynamodb.item_collection_metrics" ) , "ItemCollectionMetrics" )),
5661 CreateTable (
5762 DYNAMODB ,
5863 "dynamodb.model.CreateTableRequest" ,
59- request ("aws.dynamodb.global_secondary_indexes" , "GlobalSecondaryIndexes" ),
60- request ("aws.dynamodb.local_secondary_indexes" , "LocalSecondaryIndexes" ),
64+ request (stringArrayKey ("aws.dynamodb.table_names" ), "TableName" ),
65+ request (stringArrayKey ("aws.dynamodb.global_secondary_indexes" ), "GlobalSecondaryIndexes" ),
66+ request (stringArrayKey ("aws.dynamodb.local_secondary_indexes" ), "LocalSecondaryIndexes" ),
6167 request (
62- "aws.dynamodb.provisioned_throughput.read_capacity_units" ,
68+ doubleKey ( "aws.dynamodb.provisioned_read_capacity" ) ,
6369 "ProvisionedThroughput.ReadCapacityUnits" ),
6470 request (
65- "aws.dynamodb.provisioned_throughput.write_capacity_units" ,
66- "ProvisionedThroughput.WriteCapacityUnits" )),
71+ doubleKey ("aws.dynamodb.provisioned_write_capacity" ),
72+ "ProvisionedThroughput.WriteCapacityUnits" ),
73+ response (stringArrayKey ("aws.dynamodb.consumed_capacity" ), "ConsumedCapacity" ),
74+ response (stringKey ("aws.dynamodb.item_collection_metrics" ), "ItemCollectionMetrics" )),
6775 DeleteItem (
6876 DYNAMODB ,
6977 "dynamodb.model.DeleteItemRequest" ,
70- response ("aws.dynamodb.consumed_capacity" , "ConsumedCapacity" ),
71- response ("aws.dynamodb.item_collection_metrics" , "ItemCollectionMetrics" )),
78+ request (stringArrayKey ("aws.dynamodb.table_names" ), "TableName" ),
79+ response (stringArrayKey ("aws.dynamodb.consumed_capacity" ), "ConsumedCapacity" ),
80+ response (stringKey ("aws.dynamodb.item_collection_metrics" ), "ItemCollectionMetrics" )),
81+ DeleteTable (
82+ DYNAMODB ,
83+ "dynamodb.model.DeleteTableRequest" ,
84+ request (stringArrayKey ("aws.dynamodb.table_names" ), "TableName" )),
85+ DescribeTable (
86+ DYNAMODB ,
87+ "dynamodb.model.DescribeTableRequest" ,
88+ request (stringArrayKey ("aws.dynamodb.table_names" ), "TableName" )),
7289 GetItem (
7390 DYNAMODB ,
7491 "dynamodb.model.GetItemRequest" ,
75- request ("aws.dynamodb.projection_expression" , "ProjectionExpression" ),
76- response ("aws.dynamodb.consumed_capacity" , "ConsumedCapacity" ),
77- request ("aws.dynamodb.consistent_read" , "ConsistentRead" )),
92+ request (stringArrayKey ("aws.dynamodb.table_names" ), "TableName" ),
93+ request (stringKey ("aws.dynamodb.projection" ), "ProjectionExpression" ),
94+ request (booleanKey ("aws.dynamodb.consistent_read" ), "ConsistentRead" ),
95+ response (stringArrayKey ("aws.dynamodb.consumed_capacity" ), "ConsumedCapacity" )),
7896 ListTables (
7997 DYNAMODB ,
8098 "dynamodb.model.ListTablesRequest" ,
81- request ("aws.dynamodb.exclusive_start_table_name" , "ExclusiveStartTableName" ),
82- response ("aws.dynamodb.table_count" , "TableNames" ),
83- request ("aws.dynamodb.limit" , "Limit" )),
99+ request (stringKey ( "aws.dynamodb.exclusive_start_table" ) , "ExclusiveStartTableName" ),
100+ response (longKey ( "aws.dynamodb.table_count" ) , "TableNames" ),
101+ request (longKey ( "aws.dynamodb.limit" ) , "Limit" )),
84102 PutItem (
85103 DYNAMODB ,
86104 "dynamodb.model.PutItemRequest" ,
87- response ("aws.dynamodb.consumed_capacity" , "ConsumedCapacity" ),
88- response ("aws.dynamodb.item_collection_metrics" , "ItemCollectionMetrics" )),
105+ request (stringArrayKey ("aws.dynamodb.table_names" ), "TableName" ),
106+ response (stringArrayKey ("aws.dynamodb.consumed_capacity" ), "ConsumedCapacity" ),
107+ response (stringKey ("aws.dynamodb.item_collection_metrics" ), "ItemCollectionMetrics" )),
89108 Query (
90109 DYNAMODB ,
91110 "dynamodb.model.QueryRequest" ,
92- request ("aws.dynamodb.attributes_to_get" , "AttributesToGet" ),
93- request ("aws.dynamodb.consistent_read" , "ConsistentRead" ),
94- request ("aws.dynamodb.index_name" , "IndexName" ),
95- request ("aws.dynamodb.limit" , "Limit" ),
96- request ("aws.dynamodb.projection_expression" , "ProjectionExpression" ),
97- request ("aws.dynamodb.scan_index_forward" , "ScanIndexForward" ),
98- request ("aws.dynamodb.select" , "Select" ),
99- response ("aws.dynamodb.consumed_capacity" , "ConsumedCapacity" )),
111+ request (stringArrayKey ("aws.dynamodb.table_names" ), "TableName" ),
112+ request (stringArrayKey ("aws.dynamodb.attributes_to_get" ), "AttributesToGet" ),
113+ request (booleanKey ("aws.dynamodb.consistent_read" ), "ConsistentRead" ),
114+ request (stringKey ("aws.dynamodb.index_name" ), "IndexName" ),
115+ request (longKey ("aws.dynamodb.limit" ), "Limit" ),
116+ request (stringKey ("aws.dynamodb.projection" ), "ProjectionExpression" ),
117+ request (booleanKey ("aws.dynamodb.scan_forward" ), "ScanIndexForward" ),
118+ request (stringKey ("aws.dynamodb.select" ), "Select" ),
119+ response (stringArrayKey ("aws.dynamodb.consumed_capacity" ), "ConsumedCapacity" )),
100120 Scan (
101121 DYNAMODB ,
102122 "dynamodb.model.ScanRequest" ,
103- request ("aws.dynamodb.attributes_to_get" , "AttributesToGet" ),
104- request ("aws.dynamodb.consistent_read" , "ConsistentRead" ),
105- request ("aws.dynamodb.index_name" , "IndexName" ),
106- request ("aws.dynamodb.limit" , "Limit" ),
107- request ("aws.dynamodb.projection_expression" , "ProjectionExpression" ),
108- request ("aws.dynamodb.segment" , "Segment" ),
109- request ("aws.dynamodb.select" , "Select" ),
110- request ("aws.dynamodb.total_segments" , "TotalSegments" ),
111- response ("aws.dynamodb.consumed_capacity" , "ConsumedCapacity" ),
112- response ("aws.dynamodb.count" , "Count" ),
113- response ("aws.dynamodb.scanned_count" , "ScannedCount" )),
123+ request (stringArrayKey ("aws.dynamodb.table_names" ), "TableName" ),
124+ request (stringArrayKey ("aws.dynamodb.attributes_to_get" ), "AttributesToGet" ),
125+ request (booleanKey ("aws.dynamodb.consistent_read" ), "ConsistentRead" ),
126+ request (stringKey ("aws.dynamodb.index_name" ), "IndexName" ),
127+ request (longKey ("aws.dynamodb.limit" ), "Limit" ),
128+ request (stringKey ("aws.dynamodb.projection" ), "ProjectionExpression" ),
129+ request (longKey ("aws.dynamodb.segment" ), "Segment" ),
130+ request (stringKey ("aws.dynamodb.select" ), "Select" ),
131+ request (longKey ("aws.dynamodb.total_segments" ), "TotalSegments" ),
132+ response (stringArrayKey ("aws.dynamodb.consumed_capacity" ), "ConsumedCapacity" ),
133+ response (longKey ("aws.dynamodb.count" ), "Count" ),
134+ response (longKey ("aws.dynamodb.scanned_count" ), "ScannedCount" )),
114135 UpdateItem (
115136 DYNAMODB ,
116137 "dynamodb.model.UpdateItemRequest" ,
117- response ("aws.dynamodb.consumed_capacity" , "ConsumedCapacity" ),
118- response ("aws.dynamodb.item_collection_metrics" , "ItemCollectionMetrics" )),
138+ request (stringArrayKey ("aws.dynamodb.table_names" ), "TableName" ),
139+ response (stringArrayKey ("aws.dynamodb.consumed_capacity" ), "ConsumedCapacity" ),
140+ response (stringKey ("aws.dynamodb.item_collection_metrics" ), "ItemCollectionMetrics" )),
119141 UpdateTable (
120142 DYNAMODB ,
121143 "dynamodb.model.UpdateTableRequest" ,
122- request ("aws.dynamodb.attribute_definitions" , "AttributeDefinitions" ),
123- request ("aws.dynamodb.global_secondary_index_updates" , "GlobalSecondaryIndexUpdates" ),
144+ request (stringArrayKey ("aws.dynamodb.table_names" ), "TableName" ),
145+ request (stringArrayKey ("aws.dynamodb.attribute_definitions" ), "AttributeDefinitions" ),
146+ request (
147+ stringArrayKey ("aws.dynamodb.global_secondary_index_updates" ),
148+ "GlobalSecondaryIndexUpdates" ),
124149 request (
125- "aws.dynamodb.provisioned_throughput.read_capacity_units" ,
150+ doubleKey ( "aws.dynamodb.provisioned_read_capacity" ) ,
126151 "ProvisionedThroughput.ReadCapacityUnits" ),
127152 request (
128- "aws.dynamodb.provisioned_throughput.write_capacity_units" ,
129- "ProvisionedThroughput.WriteCapacityUnits" )),
153+ doubleKey ("aws.dynamodb.provisioned_write_capacity" ),
154+ "ProvisionedThroughput.WriteCapacityUnits" ),
155+ response (stringArrayKey ("aws.dynamodb.consumed_capacity" ), "ConsumedCapacity" )),
130156 ConverseRequest (
131157 BEDROCK_RUNTIME ,
132158 "bedrockruntime.model.ConverseRequest" ,
133- request ("gen_ai.request.model" , "modelId" ));
159+ request (stringKey ( "gen_ai.request.model" ) , "modelId" ));
134160
135161 private final AwsSdkRequestType type ;
136162 private final String requestClass ;
0 commit comments