Skip to content

Conversation

@yiyuan-he
Copy link
Contributor

@yiyuan-he yiyuan-he commented Mar 25, 2025

What does this pull request do?

Sets up a new AWS resource detector gem and adds functionality for EC2 resource detection. The implementation is similar to those that already exist for Python and JavaScript.

I will also raise PRs to add resource detection for other platforms such as ECS, Lambda, and EKS in the future.

Related Issues

#34

@yiyuan-he yiyuan-he changed the title feat: Contribute AWS EC2 Resource Detector feat: Contribute AWS EC2 Resource Detector [WIP] Mar 25, 2025
@yiyuan-he yiyuan-he changed the title feat: Contribute AWS EC2 Resource Detector [WIP] aws: Contribute AWS EC2 Resource Detector [WIP] Mar 25, 2025
@yiyuan-he yiyuan-he changed the title aws: Contribute AWS EC2 Resource Detector [WIP] aws: contribute aws ec2 resource detector [WIP] Mar 25, 2025
@yiyuan-he yiyuan-he changed the title aws: contribute aws ec2 resource detector [WIP] aws: contribute aws ec2 resource detector Mar 25, 2025
@yiyuan-he yiyuan-he force-pushed the contribute-aws-resource-detectors branch from b3104e3 to 2ec79b1 Compare March 25, 2025 22:59
@yiyuan-he yiyuan-he changed the title aws: contribute aws ec2 resource detector feat: contribute aws ec2 resource detector Mar 25, 2025
@yiyuan-he yiyuan-he force-pushed the contribute-aws-resource-detectors branch from 2ec79b1 to 1a699b9 Compare March 25, 2025 23:12
@yiyuan-he yiyuan-he force-pushed the contribute-aws-resource-detectors branch from d9331bb to 5335cbe Compare March 25, 2025 23:15
@xuan-cao-swi
Copy link
Contributor

LGTM. Please fix the ci.

http.read_timeout = HTTP_TIMEOUT

begin
http.request(request)
Copy link
Contributor

Choose a reason for hiding this comment

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

Add OpenTelemetry::Common::Utilities.untraced around http.request to avoid random span from detection.

@yiyuan-he
Copy link
Contributor Author

Thanks for reviewing @xuan-cao-swi - I'll push some commits to address your comments shortly.

I was also wondering if you or any of the other reviewers would be willing to sponsor my membership to the OTel org. More context in this comment from another PR of mine.

@yiyuan-he yiyuan-he force-pushed the contribute-aws-resource-detectors branch from 1b1db7d to f11d75d Compare March 26, 2025 18:56
begin
# Get IMDSv2 token - this will fail quickly if not on EC2
token = fetch_token
return OpenTelemetry::SDK::Resources::Resource.create({}) if token.nil?
Copy link
Contributor

Choose a reason for hiding this comment

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

For IMDSv1, token is not required to retrieve metadata. I think it's better to allow nil token. If somehow with IMDSv2, the token is still nil, then let it fail.

opentelemetry-js seems allow both token and identity to be nil/empty (but just make sure identity = fetch_identity_document(token) || {})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks Xuan - Updated the implementation and unit tests to support both IMDSv1 and IMDSv2 cases.

@xuan-cao-swi
Copy link
Contributor

@yiyuan-he , yes, I am happy to sponsor you. Just left one comment about IMDSv1 vs IMDSv2.

Copy link
Contributor

@kaylareopelle kaylareopelle left a comment

Choose a reason for hiding this comment

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

Thank you, @yiyuan-he! Few small things, but overall this looks good.

@yiyuan-he
Copy link
Contributor Author

Thanks @kaylareopelle! Updated the versions and made a constant for that long OTel prefix.

Copy link
Contributor

@kaylareopelle kaylareopelle left a comment

Choose a reason for hiding this comment

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

Thanks for the updates!

@kaylareopelle kaylareopelle merged commit 999dbb1 into open-telemetry:main Apr 9, 2025
60 checks passed
@yiyuan-he yiyuan-he deleted the contribute-aws-resource-detectors branch April 9, 2025 16:51
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.

3 participants