Skip to content

fix: Add setting to win_perf_counters input to ignore localization#10101

Merged
powersj merged 7 commits intomasterfrom
win_perf_counters-UseWildcardsExpansion-no-localization
Nov 23, 2021
Merged

fix: Add setting to win_perf_counters input to ignore localization#10101
powersj merged 7 commits intomasterfrom
win_perf_counters-UseWildcardsExpansion-no-localization

Conversation

@reimda
Copy link
Copy Markdown
Contributor

@reimda reimda commented Nov 12, 2021

Add a setting to undo the localization that windows does when expanding wildcards.

Many users of this plugin want to gather English metrics from all windows machines, even those that have non-English UI. This is possible when not using wildcards, but before this PR it was not possible when using wildcards on non-English machines because windows localizes counters in the ExpandWildCardPath call.

There are three parts to a counter: object name, counter name, and instance. Object name and counter name are well defined but instance is machine dependent.

This PR is a workaround that lets you use wildcards in the instance name without localizing metrics. It ignores the localized names returned from ExapandWildCardPath and always uses the object and counter names in the plugin config. Users of this new setting still won't be able to use wildcards in instance or counter names.

I checked on a German localized windows installation and didn't find any instance names that were localized. There are numeric indexes, disk/filesystem non-localized identifiers like drive name/path/volume name (c:,HarddiskVolume5), process ID/names, etc. There are also special non-localized English magic strings like "_Total". These are all the same as English windows.

@reimda reimda force-pushed the win_perf_counters-UseWildcardsExpansion-no-localization branch from 8b4afcf to ab3f0b2 Compare November 15, 2021 15:12
@reimda reimda marked this pull request as ready for review November 15, 2021 17:12
@reimda reimda requested review from powersj and srebhan November 15, 2021 17:12
Copy link
Copy Markdown
Contributor

@powersj powersj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two questions on docs, tested on windows 10 VM with a simple test case.

Huge thanks for this!

Copy link
Copy Markdown
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@reimda TBH I have no idea on localization on Windows, i.e. I cannot judge on the "algorithm". However, I tried to review from a code point of view and have two very minor suggestions. Otherwise your approach looks sensible, but as I said, I have no idea... :-)

@srebhan srebhan self-assigned this Nov 16, 2021
@srebhan srebhan added area/windows Related to windows plugins (win_eventlog, win_perf_counters, win_services) fix pr to fix corresponding bug platform/windows labels Nov 16, 2021
@telegraf-tiger
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Nov 23, 2021
@powersj powersj merged commit 6518745 into master Nov 23, 2021
@powersj powersj deleted the win_perf_counters-UseWildcardsExpansion-no-localization branch November 23, 2021 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/windows Related to windows plugins (win_eventlog, win_perf_counters, win_services) fix pr to fix corresponding bug platform/windows ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants