windows/perfmon metricset - handle win32 api errors in the events #18292
Description
Users can encounter several error messages in the events:
"error": {
"message": "failed on query=\\\\Desktop232\\Process(psql#2)\\Page File Bytes: The data is not valid."
},
The error message is returned by the win32 api https://docs.microsoft.com/en-us/windows/win32/api/pdh/nf-pdh-pdhgetformattedcountervalue.
Users can encounter this error if the process has stopped between retrieving/validating the path and retrieving the counter values, in some cases permissions are involved.
},
"error": {
"message": "failed on query=\\\\Desktop232\\Process(RuntimeBroker#14)\\% Processor Time: A counter with a negative value was detected."
},
The error message is returned by the win32 api https://docs.microsoft.com/en-us/windows/win32/api/pdh/nf-pdh-pdhgetformattedcountervalue which is not expecting a negative value.
Suspected there is an overflow of values in data storage, so the option could be to ignore this return value and retry later to get the new values.
In both cases, these are not a fatal errors and the application can continue running correctly so they should be kept only as debug log messages and not shown in the events.
Also, if there are any workarounds in this case.