X-Ray's segment does not differentiate DynamoDB tables when using ExecuteStatementCommand
Blankll opened this issue · comments
Background
We query multi DynamoDB tables within a single Lamba event request by using partiQL though ExecuteStatementCommand, X-Ray does not differentiate queries by tableName, in the service map it only shows one DynamoDB with 2 request
Expect
X-Ray can differentiate ExecuteStatementCommand query By tableName, so Both service map and trace can separate segments data by tableName
Hi! This may be happening because in this case, instrumentation will only work properly with AWS SDK clients.
When tracing calls to AWS services, "traced AWS services, and resources that you access within those services (for example, a DynamoDB table), appear as downstream nodes on the service map in the X-Ray console".
The X-Ray documentation linked above contains a detailed guide on how to instrument AWS SDK clients.
Hi @carolabadeer , Thanks for the reply, I think we've instrumented dynamodb aws SDK client properly, What I found that related to this issue was that in the aws_whitelist.json, there is nothing for ExecuteStatementCommand
if I understand correctly, for instance:
"getItem": {
"request_parameters": [
"ConsistentRead",
"ProjectionExpression",
"TableName"
],
"response_parameters": [
"ConsumedCapacity"
]
},
getItem
collect data including TableName
, so x-ray can know the trace segment is for which table, but since there's no implementation for ExecuteStatementCommand
, the segment for it cant detect which table this segment represents for
I see this issue as well when performing a BatchGetItemCommand and BatchWriteCommand. The table names are not included in the trace sent to X-Ray. I am configured as such:
- "@aws-sdk/client-dynamodb": "^3.154.0",
- "@aws-sdk/lib-dynamodb": "^3.154.0",
- "@aws-sdk/smithy-client": "^3.142.0",
- "aws-xray-sdk": "^3.3.7",
Hello @naataaniitsosie and @Blankll, if you're using AWS V3 clients, you will need PR #527, the Xray SDK doesn't correctly get information from DynamoDB requests. I added a patch file in the PR comments ready to use with patch-package
npm package. :)