botocore: Add DynamoDB extension#735
Merged
ocelotl merged 5 commits intoopen-telemetry:mainfrom Oct 18, 2021
Merged
Conversation
* extract addtional DynamoDB specific attributes according to the spec * move DynamoDB tests to separate test module
ocelotl
suggested changes
Oct 14, 2021
...y-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/extensions/dynamodb.py
Show resolved
Hide resolved
|
|
||
| _OPERATION_MAPPING = { | ||
| op.operation_name(): op | ||
| for op in globals().values() |
Contributor
There was a problem hiding this comment.
Just curious, why use globals and a series of ifs if the list of classes can be known beforehand? Is it expected that this module will receive more classes at runtime?
Contributor
Author
There was a problem hiding this comment.
the idea is to calculate it automatically so that operations that are added later (not at runtime) might not accidentally be forgotten to be added to the _OPERATION_MAPPING
Contributor
Author
|
added missing license info
i guess i could do that |
ocelotl
approved these changes
Oct 18, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds an extension to extract additional request/response attributes for DynamoDB as defined in the semantic conventions for the AWS SDK. Depending on which DynamoDB operation is called via the AWS SDK, different attributes are extracted.
To follow the database semantic conventions, relevant connection and call-level attributes are also extracted. Those attributes are:
db.system: always 'dynamodb'db.operation: corresponds to the called DynamoDB method/operation of the AWS SDKnet.peer.name: basically corresponds to 'dynamodb..amazonaws.com'Removes the attribute
aws.table_nameas according to the AWS SDK spec,aws.dynamodb.table_namesshould be used. (According to the spec the attribute is now also a list of table names instead of a single table name.)Type of change
How Has This Been Tested?
Adds additional unit tests to verify that DynamoDB related attributes are extracted accordingly
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.