-
Notifications
You must be signed in to change notification settings - Fork 2.9k
[processor/resourcedetection] ec2 detector start returns an error if network call fails #37426
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
Conversation
I am not very happy with this fix but this is the simplest change. It allows to make sure the collector only starts if it is initialized properly rather than reporting invalid information. It supposes that the collector will be restarted by the operating system after this failure. |
…detector fails to start because network is unreachable
ec28237
to
452dad4
Compare
var requestSendError *smithyhttp.RequestSendError | ||
if errors.As(err, &requestSendError) { | ||
d.logger.Warn("EC2 metadata endpoint unreachable", zap.Error(err)) | ||
return pcommon.NewResource(), "", err |
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 you please add a comment here saying why we return an error for this particular use case?
Also, are we sure that smithyhttp.RequestSendError
is fired only when ec2 is in not ready state? Will it be a different error if it's not an ec2 instance?
Also, smithyhttp.RequestSendError
might be unreliable. If the SDK is changed to use something else, we might miss it.
I'm thinking if we can have a configuration option instead. Happy to here other opinions.
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.
This looks good to me as the initial solution, if the first 2 Qs above are addressed
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 I can work on adding an integration test to make sure this works as intended.
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 you please add a comment here saying why we return an error for this particular use case?
I put a log warning above, can I maybe make that warning better, maybe more actionable? I will do that first. Comments tend to rot...
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 put a log warning above, can I maybe make that warning better, maybe more actionable? I will do that first. Comments tend to rot...
The warning is for the end user. When someone reads the code, it's unclear why this particular error should be propagated while others are not.
On further investigation, I think this approach is not valid and I will explain myself on #35936. Closing. |
Description
The resourcedetection processor fails to start the processor if the ec2 detector fails to start because network is unreachable
Link to tracking issue
Fixes #35936
Testing
Added a unit test.