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

feat(opentelemetry-instrumentation-aws-sdk): add missing spec-defined DynamoDB attributes #1524

Merged

Conversation

carolabadeer
Copy link
Contributor

@carolabadeer carolabadeer commented Jun 2, 2023

Which problem is this PR solving?

Short description of the changes

  • Added operation-specific attributes for DynamoDB operations that did not have attributes added according to the spec.
  • This implementation captures request/response parameters for both AWS SDK v2 and v3 calls.
  • AWS SDK v2 is on a deprecation path and the recommendation is for all users to start using or migrate to v3. In v3, the AttributesToGet request parameter (used in DynamoDB.query and DynamoDB.Scan), and by extension the AWS_DYNAMODB_ATTRIBUTES_TO_GET attribute, are no longer necessary since the AttributesToGet parameter has been deprecated in favor of ProjectionExpression. Since the value of the ProjectionExpression parameter is already being captured for the AWS_DYNAMODB_PROJECTION attribute in this PR, it is redundant to include a backwards-compatible check for the deprecated attribute.

Testing

These changes were tested end-to-end using a simple application that makes a DynamoDB ListItems call and uses the aws-otel-collector to export data to AWS X-Ray. For ListItems operation, the new aws.dynamodb.table_count, aws.dynamodb.exclusive_start_table, and aws.dynamodb.exclusive_start_table are now being populated correctly

"metadata": {
      "default": {
          "db.statement": "{\"ExclusiveStartTableName\":\"Movies2\",\"Limit\":20}",
          "rpc.service": "DynamoDB",
          "db.system": "dynamodb",
          "db.operation": "ListTables",
          "aws.dynamodb.table_count": 12,
          "rpc.system": "aws-api",
          "aws.dynamodb.exclusive_start_table": "Movies2",
          "aws.dynamodb.limit": 20
      }
  },

@carolabadeer carolabadeer requested a review from a team June 2, 2023 02:10
@github-actions github-actions bot requested a review from blumamir June 2, 2023 02:10
@codecov
Copy link

codecov bot commented Jun 2, 2023

Codecov Report

Merging #1524 (d63f132) into main (de17f77) will decrease coverage by 0.76%.
The diff coverage is n/a.

❗ Current head d63f132 differs from pull request most recent head 6936aa3. Consider uploading reports for the commit 6936aa3 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1524      +/-   ##
==========================================
- Coverage   96.13%   95.38%   -0.76%     
==========================================
  Files          14       16       +2     
  Lines         906      997      +91     
  Branches      197      206       +9     
==========================================
+ Hits          871      951      +80     
- Misses         35       46      +11     

see 2 files with indirect coverage changes

Copy link
Member

@haddasbronfman haddasbronfman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank for adding this! this is very helpful :)

@haddasbronfman haddasbronfman merged commit f7c4324 into open-telemetry:main Jun 27, 2023
@dyladan dyladan mentioned this pull request Jun 27, 2023
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

Successfully merging this pull request may close these issues.

4 participants