Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Spans not record dynamodb table name #145

Open
Blankll opened this issue Sep 20, 2022 · 5 comments
Open

Spans not record dynamodb table name #145

Blankll opened this issue Sep 20, 2022 · 5 comments

Comments

@Blankll
Copy link

Blankll commented Sep 20, 2022

Description

We query multi DynamoDB tables within a single Lamba event request by using partiQL though ExecuteStatementCommand, and we enabled distributed tracing. NewRelic in DynaomDB call's span field b.collection have no table name.
From issue BatchGetItemCommand and BatchWriteCommand may also have this problem, I only tested ExecuteStatementCommand from my side.

Expect
In ExecuteStatementCommand Span it can record the requested table name like other commands eg. GetItem

Your Environment

env: AWS-lambda
Runtime: node-16
NewRelic-AWS Lambda-Layers: arn:aws:lambda:ap-southeast-2:451483290750:layer:NewRelicNodeJS16X:16
dependencies:

{
   "@aws-sdk/client-dynamodb": "^3.128.0",
    "@aws-sdk/lib-dynamodb": "^3.128.0",
     "apollo-datasource": "^3.3.2",
    "apollo-server-lambda": "^3.10.1",
    "@newrelic/apollo-server-plugin": "^2.0.1"
}
@jordigh
Copy link
Contributor

jordigh commented Sep 20, 2022

Probably related to newrelic/newrelic-node-apollo-server-plugin#215, let's see if support.newrelic.com can help.

@Blankll
Copy link
Author

Blankll commented Sep 22, 2022

Hi @jordigh , I can ask for support.newrelic.com, but I think this problem should be because for ExecuteStatementCommand the table name is in SQL strings, so if we want the Span to record this information, newrelic agent needs to filter out the table name from SQL string, for other actions like getItem the table name is specified in the request parameter, so newrelic agent can easily get that

@bizob2828
Copy link
Member

@Blankll if you can provide a code snippet to reproduce the error, it would help us understand the issue much better.

@bizob2828
Copy link
Member

@Blankll I used your repo. I pared it down to not use lambda to make this easier to triage but also moved some of the require statements around to ensure the agent was loaded first and I see the issue you're describing. I'm going to mark this as a feature request. It doesn't appear to be called out in the README but we do not support extracting db.collection aka table name from dynamo execute statements. It would require us to parse the PartiQL which we have not built to date.

@bizob2828
Copy link
Member

bizob2828 commented Oct 5, 2022

Note to agent team:

We only will set db.collection if the query contains TableName. We will have to enhance getDynamoSpec to parse PartiQL which is apparently the format of ExecuteStatementCommand

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

No branches or pull requests

3 participants