-
Notifications
You must be signed in to change notification settings - Fork 17
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: Support a list of new AWS Resources for Python SDK #261
Conversation
There exists SpanAttributes.MESSAGING_DESTINATION_NAME in the upstream logic that we could re-purpose here. However, | ||
we are not using it here to maintain consistent naming patterns with other AWS resources. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Synced with @mxiamxia about this. Mentioned we should not use the upstream logic to maintain consistent naming patterns for other AWS resources
@@ -407,6 +409,9 @@ def _set_remote_type_and_identifier(span: ReadableSpan, attributes: BoundedAttri | |||
elif is_key_present(span, GEN_AI_REQUEST_MODEL): | |||
remote_resource_type = _NORMALIZED_BEDROCK_SERVICE_NAME + "::Model" | |||
remote_resource_identifier = _escape_delimiters(span.attributes.get(GEN_AI_REQUEST_MODEL)) | |||
elif is_key_present(span, AWS_SNS_TOPIC_ARN): | |||
remote_resource_type = _NORMALIZED_SNS_SERVICE_NAME + "::Topic" | |||
remote_resource_identifier = _escape_delimiters(span.attributes.get(AWS_SNS_TOPIC_ARN)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add TODO here that we'll need to parse the actual resource name from the long ARN string by following the rules defined in https://quip-amazon.com/ShMUAP1okoxs/Support-AWS-Resources-with-Different-CFN-Identifier-Formats#temp:C:IHL175110d2baee4144bbe0f54cc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can create a new attribute named aws.cloudformation.primary.identifier
to store the orignal CFN prmiray identifier value from OTel instrumentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use aws.remote.resource.cfn.primary.identifier
and the new attribute name in EMF will be RemoteResourceCfnPrimaryIdentifier
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good 👍
I reset the main branch of my forked repo so that I can split my future work into multiple branches. It was getting confusing having everything on just my main branch. I am hoping this will enable me to break up my future PRs in a more organized and atomic manner for a better reviewer experience. |
### *Description of changes:* These changes support AWS Resources with different CFN Identifier formats. This new attribute will have the key `aws.remote.resource.cfn.primary.identifier`. More context can be found in the comments of this closed PR: #261 In most cases, this new attribute should have the same value as the existing attribute `aws.remote.resource.identifier`. However, there are some edge cases we must handle as seen in this PR: - `AWS::SQS::Queue` - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sqs-queue.html - The CFN Id should be the URL of the Queue. - `AWS::Bedrock::DataSource` - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-bedrock-datasource.html - The CFN Id should be a compound value where the knowledge base Id and the data source Id are separated by `|` Also updated Bedrock Agent request parameters to also include Knowledge Base ID: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/bedrock-agent/client/get_data_source.html ### *Test Plan:* Set up a client-server with auto-instrumentation to verify that the correct span data is being generated. ![bedrock_cfn_primary_id_verification](https://github.com/user-attachments/assets/9a375751-a70c-41ab-896a-00e26a5fcc76) ![sqs_cfn_primary_id_verification](https://github.com/user-attachments/assets/a8ee28b0-4344-4f48-82b7-a100da939860) Unit tests for instrumentation ![metric_generator_unit_test_verification](https://github.com/user-attachments/assets/52c26651-068d-4d40-a020-69714feab17c) ![instrumentation_patch_unit_test_verification](https://github.com/user-attachments/assets/3c23031d-52c2-49e6-9285-da679351ae0d) By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Description of changes:
Adding support for SNS AWS resource for Python SDK with auto-instrumentation.
Specifically, this change populates
aws.sns.topic.arn
in the Span by extracting theTopicArn
field fromSnsRequest
."primaryIdentifier": [ "/properties/TopicArn" ]
Testing Plan:
Set up a simple client-server locally and verified that the new data is added to the span.
Ran Code Style Checks:
Added unit tests for:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.