Skip to content

Commit

Permalink
Fix Windows perfcounters for non-English systems
Browse files Browse the repository at this point in the history
The `ValidatePath` syscall only operates in a localized language mode,
however `AddEnglishCounter` always works with English-localized counter
names. This means that on non-English systems, the counter will work but
will fail validation.

The only solution is to not validate the counter. There is no
corresponding `ValidateEnglishPath` syscall. `CollectQueryData` will
still error if the counter is invalid.

Reference: influxdata/telegraf#2261
  • Loading branch information
Ben Moss committed Oct 21, 2019
1 parent 9790262 commit 5e6aa26
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions pkg/kubelet/winstats/perfcounters.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ func newPerfCounter(counter string) (*perfCounter, error) {
return nil, errors.New("unable to open query through DLL call")
}

ret = win_pdh.PdhValidatePath(counter)
if ret != win_pdh.ERROR_SUCCESS {
return nil, fmt.Errorf("unable to valid path to counter. Error code is %x", ret)
}

ret = win_pdh.PdhAddEnglishCounter(queryHandle, counter, 0, &counterHandle)
if ret != win_pdh.ERROR_SUCCESS {
return nil, fmt.Errorf("unable to add process counter. Error code is %x", ret)
Expand Down

0 comments on commit 5e6aa26

Please sign in to comment.