Skip to content

Commit

Permalink
Convert ticks to milliseconds for diskio (elastic#14271)
Browse files Browse the repository at this point in the history
  • Loading branch information
narph authored Nov 11, 2019
1 parent 6a03478 commit 8892766
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 @@ -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]
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 8892766

Please sign in to comment.