Skip to content

Commit

Permalink
Cherry-pick #14271 to 7.x: Convert ticks to milliseconds for diskio m…
Browse files Browse the repository at this point in the history
…etricset (#16797)

* Convert ticks to milliseconds for diskio (#14271)


(cherry picked from commit 8892766)

* changelog

* remove space
  • Loading branch information
narph authored Mar 5, 2020
1 parent f1f2c07 commit d0a570c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Revert changes in `docker` module: add size flag to docker.container. {pull}16600[16600]
- Fix detection and logging of some error cases with light modules. {pull}14706[14706]
- Add dashboard for `redisenterprise` module. {pull}16752[16752]
- Convert increments of 100 nanoseconds/ticks to milliseconds for WriteTime and ReadTime in diskio metricset (Windows) for consistency. {issue}14233[14233]

*Packetbeat*

Expand Down
16 changes: 10 additions & 6 deletions metricbeat/module/system/diskio/diskstat_windows_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d0a570c

Please sign in to comment.