diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 45b2144814a5..9265eee200a2 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -55,6 +55,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d *Metricbeat* +- Fix performance counter values for windows/perfmon metricset.{issue}14036[14036] {pull}14039[14039] {pull}14108[14108] *Packetbeat* diff --git a/metricbeat/module/windows/perfmon/reader.go b/metricbeat/module/windows/perfmon/reader.go index 2cc299ffcd12..f6598e18be37 100644 --- a/metricbeat/module/windows/perfmon/reader.go +++ b/metricbeat/module/windows/perfmon/reader.go @@ -124,16 +124,14 @@ func (r *Reader) RefreshCounterPaths() error { if err != nil { return errors.Wrap(err, "failed removing unused counter values") } - // 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). - if err = r.query.CollectData(); err != nil { - return errors.Wrap(err, "failed querying counter values") - } + return nil } // Read executes a query and returns those values in an event. func (r *Reader) Read() ([]mb.Event, error) { + // 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). if err := r.query.CollectData(); err != nil { return nil, errors.Wrap(err, "failed querying counter values") }