-
Notifications
You must be signed in to change notification settings - Fork 562
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
AWS Resource detector fails with an error if metadata not available #398
Comments
Instead of
I would use the new
Otherwise, this looks like a good fix. Thanks for opening it. |
To clarify, the code snippets I included are the existing code for the aws and gcp detectors: none of that was suggested fix. The |
As for a suggested fix, this might be appropriate:
|
Ah, my mistake @dackroyd! Would you be willing to put together a PR with this? |
I'd be happy to push that change 👍 |
Awesome, thanks for the help! 😄 |
If the instance metadata is not available, no resource and an
unavailable EC2 client
error will be returnedhttps://github.com/open-telemetry/opentelemetry-go-contrib/blob/7e7d779/detectors/aws/aws.go#L42-L45
This is counter to the documented behaviour for resources which should be:
https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/resource/sdk.md#detecting-resource-information-from-the-environment
A similar issue was raised (and fixed) with the ENV var detection in the main OTel library: open-telemetry/opentelemetry-go#1114 / open-telemetry/opentelemetry-go#1170
The GCP resource in this contrib library appears to implement detection correctly, returning no error:
https://github.com/open-telemetry/opentelemetry-go-contrib/blob/7e7d779/detectors/gcp/gce.go#L38-L40
https://github.com/open-telemetry/opentelemetry-go-contrib/blob/master/detectors/gcp/gce.go#L102-L104
The text was updated successfully, but these errors were encountered: