From 88927660af22862c18a8d24340b9c9fb69ce9667 Mon Sep 17 00:00:00 2001 From: Mariana Dima Date: Mon, 11 Nov 2019 13:39:08 +0100 Subject: [PATCH] Convert ticks to milliseconds for diskio (#14271) --- CHANGELOG.next.asciidoc | 1 + .../system/diskio/diskstat_windows_helper.go | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 660eae4558b..593ff80e217 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -242,6 +242,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Change kubernetes.event.message to text. {pull}13964[13964] - Fix performance counter values for windows/perfmon metricset. {issue}14036[14036] {pull}14039[14039] - Add FailOnRequired when applying schema and fix metric names in mongodb metrics metricset. {pull}14143[14143] +- Convert increments of 100 nanoseconds/ticks to milliseconds for WriteTime and ReadTime in diskio metricset (Windows) for consistency. {issue}14233[14233] - Limit some of the error messages to the logs only {issue}14317[14317] {pull}14327[14327] - Convert indexed ms-since-epoch timestamp fields in `elasticsearch/ml_job` metricset to ints from float64s. {issue}14220[14220] {pull}14222[14222] - Fix ARN parsing function to work for ELB ARNs. {pull}14316[14316] diff --git a/metricbeat/module/system/diskio/diskstat_windows_helper.go b/metricbeat/module/system/diskio/diskstat_windows_helper.go index 93433655f29..65c00cd682c 100644 --- a/metricbeat/module/system/diskio/diskstat_windows_helper.go +++ b/metricbeat/module/system/diskio/diskstat_windows_helper.go @@ -50,10 +50,13 @@ type logicalDrive struct { } type diskPerformance struct { - BytesRead int64 - BytesWritten int64 - ReadTime int64 - WriteTime int64 + BytesRead int64 + BytesWritten int64 + // Contains a cumulative time, expressed in increments of 100 nanoseconds (or ticks). + ReadTime int64 + // Contains a cumulative time, expressed in increments of 100 nanoseconds (or ticks). + WriteTime int64 + //Contains a cumulative time, expressed in increments of 100 nanoseconds (or ticks). IdleTime int64 ReadCount uint32 WriteCount uint32 @@ -95,8 +98,9 @@ func ioCounters(names ...string) (map[string]disk.IOCountersStat, error) { WriteCount: uint64(counter.WriteCount), ReadBytes: uint64(counter.BytesRead), WriteBytes: uint64(counter.BytesWritten), - ReadTime: uint64(counter.ReadTime), - WriteTime: uint64(counter.WriteTime), + // Ticks (which is equal to 100 nanoseconds) will be converted to milliseconds for consistency reasons for both ReadTime and WriteTime (https://docs.microsoft.com/en-us/dotnet/api/system.timespan.ticks?redirectedfrom=MSDN&view=netframework-4.8#remarks) + ReadTime: uint64(counter.ReadTime / 10000), + WriteTime: uint64(counter.WriteTime / 10000), } } return ret, nil