-
Notifications
You must be signed in to change notification settings - Fork 77
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
Handle ERROR_INVALID_PARAMETER error for GetVolumeInformationW win32 api #164
Conversation
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
|
I think the error in this case can be completely ignored (third option). I would prefer that than to report it here but ignore it in beats. Ignoring it in beats can lead to other problems, as actual errors in other platforms being ignored by mistake. So I would prefer to make the platform-specific decision here. Not reporting the filesystem for drives without a filesystem is probably fine in these cases, I guess this can even happen with a hard disk without format or partition table? There would be a couple of things to think about:
|
@jsoriano , thanks for the quick feedback Same here, third option gives us less headache, as we would have to single out this specific error from the rest and ignore it on the metricset side, ex:
not a big fan of string comparison.
I like the idea and I would go for
This is how I fixed the last scenario https://github.com/elastic/gosigar/blob/master/sys/windows/syscall_windows.go#L356, but now we have a new error type |
Btw, I was checking what is done in Linux for this case, and I found that the behaviour is different. On Linux sigar only collects mounted filesystems, so all of them have a filesystem type. While in Windows it collects all drives, mounted or not. |
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.
LGTM, adding @fearful-symmetry as reviewer for a second opinion.
} | ||
if !success { | ||
return "", errors.Wrap(err, "GetVolumeInformationW failed") | ||
if success { |
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 feel like we should report err
somewhere, if possible?
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.
we could do 2 things, either in the beats code check for unavailable
and add an info message in the logs or add a note in the documentation regarding this specific field. I would go for the docs in this case, with this occasion maybe also clarify in some cases the field values in windows might have a different meaning .
Either way I don't think we should complicate the code in the gosigar lib.
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.
Alright, that makes sense. Do you want to add the doc line in the PR to update beats
?
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.
yes, that will be a separate PR with the new version of gosigar
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.
Cool! I'm a little paranoid about weird errors/edge cases going undocumented, so I like to make sure.
similar to #159
GetVolumeInformation will fail for external drives like CD-ROM or other type with error codes as ERROR_NOT_READY. ERROR_INVALID_FUNCTION, ERROR_INVALID_PARAMETER and could be others.
The PR will report error in the logs but ignore it and move further. We consider retrieving filesystem type best efforts.
Since we introduced this calculation we are getting too many issues related to external drives, so we need to decide on one of the following behaviors:
system.filesystem.type
values on Windows beats#22501 which is causing these scenarios@jsoriano have we dealt with anything similar before? @fearful-symmetry which option would you go for?