I'm using metricbeats service on Windows, and during DISKIO task, it is constantly throwing error in ioCounter, when calling DeviceIoControl function in file(metricbeat/module/system/diskio/diskstat_windows_helper.go)
Error is "The parameter is invalid.". It is present from release 7.2 (the last one I tried to check if issue is there also) till current release
Actual problem is with diskPerformance structure. You are passing to DeviceIoControl, incorrect structure. WinAPI, is oriented to C/C++. structure. This means that it is waiting for aligned structure. In GoLang there is no such thing as structure alignment, therefore sizeof GoLang compared to C/C++ structure is not the same. Due to this, WinAPI call to DeviceIoControl is failing.
GoLang structure is missing 4 bytes of alignment.
I've added to the end of structure 4 bytes of alignment and DISKIO stopped failing, and was returning valid data. To the end of structure is needed as C/C++ will align this structure in the end, as memory will be divided in blocks of 8 bytes, and in raw case struct is 84 bytes, so it will have 10 blocks of 8 bytes and one not completely filled (4 bytes), which will be aligned with 4 bytes of padding. (Note: WinAPI structure members are ordered in correct manner to be memory efficient, this mean biggest element(8 byte LARGE_INTEGER) appears at the beginning, and other members order is to fit those blocks, that is why we got only last block aligned.)
It's critical issue, as basically one of important monitoring module is simply not working. Can you please fix this?