-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fallback to rpc.method for segment operation when aws.operation missing #6231
Fallback to rpc.method for segment operation when aws.operation missing #6231
Conversation
82f3d54
to
de74588
Compare
de74588
to
7d0b686
Compare
@@ -62,13 +62,15 @@ func TestClientSpanWithRpcAwsSdkClientAttributes(t *testing.T) { | |||
segment, _ := MakeSegment(span, resource, nil, false) | |||
assert.Equal(t, "DynamoDB", *segment.Name) | |||
assert.Equal(t, conventions.AttributeCloudProviderAWS, *segment.Namespace) | |||
assert.Equal(t, "GetItem", *segment.AWS.Operation) |
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 also add the case to aws_test.go
?
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.
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.
I think that's an excellent suggestion! I added a test case like this one just to test that rpc.method
is read:
func TestAwsWithRpcAttributes(t *testing.T) {
resource := pdata.NewResource()
attributes := make(map[string]pdata.AttributeValue)
attributes[conventions.AttributeRPCMethod] = pdata.NewAttributeValueString("ListBuckets")
_, awsData := makeAws(attributes, resource)
assert.NotNil(t, awsData)
assert.Equal(t, "ListBuckets", *awsData.Operation)
}
and added this following above the line you linked to test the case where they are both defined:
attributes[conventions.AttributeRPCMethod] = pdata.NewAttributeValueString("IncorrectAWSSDKOperation")
@tigrannajaryan @kbrockhoff @Aneurysm9 - can you please provide a second review so that this PR can be merged and be available in the next Collector release. We have a downstream dependency on this. Many thx! |
Please populate the commit message in future PRs. Don't just write one-line commit message. |
Description:
When creating an AWS segment, the
exporter/awsxrayexporter/internal/translator/segment.go
file will create the "AWS
" component of the segment (a map under the "aws
" key) by reading through the attributes of an OTel span.Span generated for the AWS SDK will either have
aws.operation
according to legacy, orrpc.method
to describes the "operation" made with the AWS SDK as explained in the specifications.Because some languages have moved to the new spec-defined
rpc.method
, we update the translator to consider this attribute.NOTE: We do not need to map
rpc.service
toaws.service
since it is not used by the AWS X-Ray backend.Link to tracking Issue: Fixes #6109
Testing:
Tests mostly make sure the operation (e.g.
GetItem
) is present in the final segment structure regardless if we are using the legacyaws.operation
or the newrpc.method
.In the case where both are defined, the legacy
aws.operation
will take precedence as remarked by the updated legacy unit test which defines both but which takesaws.operation
.Documentation:
Not a breaking change, so N/A.