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

[receiver/awsxray] Set cloudwatch logs metadata in attributes #32271

Merged
merged 4 commits into from
Apr 26, 2024

Conversation

jefchien
Copy link
Contributor

@jefchien jefchien commented Apr 9, 2024

Description:

From the issue:

X-Ray segments have a few optional fields that carry AWS resource data. As part of the translation of X-Ray segments to spans, the translator extracts AWS data and puts them in the resource attributes. It does this for EC2, ECS, Beanstalk, and EKS, but not for CloudWatch Logs. So, by the time the span reaches the exporter, that information is lost.

This change adds the cloudwatch logs metadata to the attributes with the keys conventions.AttributeAWSLogGroupARNs and conventions.AttributeAWSLogGroupNames. Both of these are used by the awsxrayexporter to restore the LogGroupMetadata.

case conventions.AttributeAWSLogGroupNames:
logGroups = normalizeToSlice(value)
case conventions.AttributeAWSLogGroupARNs:
logGroupArns = normalizeToSlice(value)

// Given an array of log group ARNs, create a corresponding amount of LogGroupMetadata objects with log_group and arn
// populated, or given an array of just log group names, create the LogGroupMetadata objects with arn omitted
func getLogGroupMetadata(logGroups pcommon.Slice, isArn bool) []awsxray.LogGroupMetadata {

Link to tracking Issue: Fixes #31784

Testing: Added unit tests to validate the translation to attributes.

Documentation: N/A

@crobert-1
Copy link
Member

I've filed #32275 for the failing integration test, it doesn't appear to be related to your changes.

Copy link
Member

@crobert-1 crobert-1 left a comment

Choose a reason for hiding this comment

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

This looks good to me, but I'd like a code owner or someone with more AWS experience to review as well, I'm not very familiar here 👍

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

Pinging code owners @wangzlei @srprash for review

Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Apr 26, 2024
@crobert-1 crobert-1 removed the Stale label Apr 26, 2024
@codeboten codeboten merged commit 5b1b8e6 into open-telemetry:main Apr 26, 2024
170 checks passed
@github-actions github-actions bot added this to the next release milestone Apr 26, 2024
@jefchien jefchien deleted the fix-cwlogs-xray branch April 26, 2024 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[receiver/awsxray] Does not retain CloudWatch Log Group information
4 participants