From 4a77eac0e1189e18dd5fa16a6623a8b12b8674e2 Mon Sep 17 00:00:00 2001 From: William Starling Date: Fri, 20 Nov 2020 14:44:11 +0000 Subject: [PATCH] Swap read and write stats for XFS 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 --- xfs/parse.go | 4 ++-- xfs/parse_test.go | 8 ++++---- xfs/xfs.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/xfs/parse.go b/xfs/parse.go index ba3afea3e..260501e69 100644 --- a/xfs/parse.go +++ b/xfs/parse.go @@ -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 } diff --git a/xfs/parse_test.go b/xfs/parse_test.go index b799f4b2c..4989ecac0 100644 --- a/xfs/parse_test.go +++ b/xfs/parse_test.go @@ -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, }, }, }, @@ -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, diff --git a/xfs/xfs.go b/xfs/xfs.go index cc8b36bed..79bba6565 100644 --- a/xfs/xfs.go +++ b/xfs/xfs.go @@ -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