-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
PdhExpandWildCardPathW will not expand counter paths in 32 bit windows systems #12622
Conversation
…y exceptions in 32 bit windows systems. Awrokaround was built using PdhExpandCounterPathW function instead.
@@ -74,9 +75,10 @@ func NewReader(config Config) (*Reader, error) { | |||
return nil, errors.Wrapf(err, `failed to expand counter (query="%v")`, counter.Query) | |||
} | |||
} | |||
if childQueries == nil || len(childQueries) == 0 { | |||
// check if the pdhexpandcounterpath/pdhexpandwildcardpath functions have expanded the counter successfully. | |||
if childQueries == nil || len(childQueries) == 0 || (len(childQueries) == 1 && strings.Contains(childQueries[0], "*")) { |
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.
Is it not possible that a wildcard expands to a single path?
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.
@jsoriano , yes that should be possible but the path should not still contain the wildcard "*", this is why the condition (len(childQueries) == 1 && strings.Contains(childQueries[0], "*")
. Am I missing something here?
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.
Oh ok, sorry, I misunderstood, all good.
Co-Authored-By: Jaime Soriano Pastor <jaime.soriano@elastic.co>
query.Close() | ||
return nil, errors.Wrapf(err, `failed to expand counter (query="%v")`, counter.Query) |
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.
Good catch here btw 🙂 I guess it was failing silently before? (errors.Wrap(nil)
returns nil
)
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.
@jsoriano , yes, found it while running the tests.
jenkins, test this |
1 similar comment
jenkins, test this |
PdhExpandWildCardPathW will not expand wildcard counter paths in 32 bit windows systems and will not return any exceptions.
The path list will only contain the initial counter query will pass the following validation rules in reader.go.
A workaround has been built using PdhExpandCounterPathW function instead which seems to return the list of counter paths and extra validation has been added.
Will still keep using PdhExpandWildCardPathW for 62 bit systems as this function supersedes PdhExpandCounterPathW.
Also, fixed the perfmon tests failing on the 32 bit systems.
Should fix #12590