Skip to content

Commit

Permalink
Swap read and write stats for XFS (#343)
Browse files Browse the repository at this point in the history
According to the table in https://xfs.org/index.php/Runtime_Stats, the first number of `rw` stats is write and the second is read. I noticed Prometheus seemed to be reporting the opposite of what I expected.

Signed-off-by: William Starling <william@bugsnag.com>
  • Loading branch information
foygl committed Jan 11, 2021
1 parent 73a63e3 commit d235606
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions xfs/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ func readWriteStats(us []uint32) (ReadWriteStats, error) {
}

return ReadWriteStats{
Read: us[0],
Write: us[1],
Write: us[0],
Read: us[1],
}, nil
}

Expand Down
8 changes: 4 additions & 4 deletions xfs/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ func TestParseStats(t *testing.T) {
s: "rw 1 2",
stats: &xfs.Stats{
ReadWrite: xfs.ReadWriteStats{
Read: 1,
Write: 2,
Write: 1,
Read: 2,
},
},
},
Expand Down Expand Up @@ -577,8 +577,8 @@ func TestParseStats(t *testing.T) {
ForceSleep: 739,
},
ReadWrite: xfs.ReadWriteStats{
Read: 107739,
Write: 94045,
Write: 107739,
Read: 94045,
},
AttributeOperation: xfs.AttributeOperationStats{
Get: 4,
Expand Down
2 changes: 1 addition & 1 deletion xfs/xfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ type LogOperationStats struct {
// ReadWriteStats contains statistics regarding the number of read and write
// system calls for XFS filesystems.
type ReadWriteStats struct {
Read uint32
Write uint32
Read uint32
}

// AttributeOperationStats contains statistics regarding manipulation of
Expand Down

0 comments on commit d235606

Please sign in to comment.