-
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
Fix empty field error in the iis/application pool metricset #19537
Conversation
Pinging @elastic/integrations (Team:Integrations) |
💚 Build SucceededExpand to view the summary
Build stats
Test stats 🧪
Steps errorsExpand to view the steps failures
|
return nil, errors.Wrapf(err, `failed to add counter (query="%v")`, v) | ||
} | ||
r.workerProcesses[v] = key | ||
} |
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.
Code added here is mostly the same as in refreshCounterPaths()
, could it be reused?
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.
refactored the code so the function is reused
// refresh performance counter list | ||
// Some counters, such as rate counters, require two counter values in order to compute a displayable value. In this case we must call PdhCollectQueryData twice before calling PdhGetFormattedCounterValue. | ||
// For more information, see Collecting Performance Data (https://docs.microsoft.com/en-us/windows/desktop/PerfCtrs/collecting-performance-data). | ||
// A flag is set if the second call has been executed else refresh will fail (reader.executed) |
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.
Code added to newReader
seems to be the same as a refresh, and it is run before reader.executed
, could it also fail?
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.
we try to run one refresh at a time, running them one after another seems to yield exceptions
} | ||
apps, err := getApplicationPools(config.Names) | ||
if err != nil { | ||
return r, errors.Wrap(err, "failed retrieving running worker processes") |
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.
If something fails here, should we close query
to avoid leaks?
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.
indeed, added the call
@@ -81,6 +84,7 @@ func (m *MetricSet) Fetch(report mb.ReporterV2) error { | |||
break | |||
} | |||
} | |||
|
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.
nit: not related?
@@ -9,40 +9,41 @@ package application_pool | |||
import ( | |||
"strings" | |||
|
|||
"github.com/elastic/beats/v7/libbeat/common" | |||
"github.com/elastic/beats/v7/metricbeat/helper/windows/pdh" |
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.
nit: please fix import's order
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.
ran fmt so that should be the order
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.
I don't think that mage fmt
touches the order, I just made a small local test and it seems that doesn't. You can verify that by putting them in order and running again fmt
.
Not sure how this change occurred and preserving order is not crucial but it's a more convention we follow.
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.
looks good! It would be nice to address #19537 (comment)
…19537) * fix * update test * changelog * change * refactor * close
…plication pool metricset (elastic#19887) * Fix empty field error in the iis/application pool metricset (elastic#19537) * fix * update test * changelog * change * refactor * close (cherry picked from commit 134324e) * update changelog
What does this PR do?
Fixes errors as:
also improves refresh functionality
Why is it important?
Errors
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.How to test this PR locally
Run the IIS module wit the application pool metricset enabled