Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X-Ray's segment does not differentiate DynamoDB tables when using ExecuteStatementCommand #524

Open
Blankll opened this issue Aug 4, 2022 · 5 comments

Comments

@Blankll
Copy link

Blankll commented Aug 4, 2022

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

@carolabadeer
Copy link
Contributor

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.

@Blankll
Copy link
Author

Blankll commented Sep 5, 2022

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

@naataaniitsosie
Copy link

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",

@scorsi
Copy link

scorsi commented Sep 13, 2022

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. :)

@carolabadeer
Copy link
Contributor

Hi all! Thank you for bringing this issue to our attention. Since this issue is related to #533, can we consolidate them into 1 issue and keep track of everything in #533 to make it easier to follow?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants