Skip to content

Commit 691fc05

Browse files
authored
Swap read and write stats for XFS (prometheus#343)
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>
1 parent ea6ebe2 commit 691fc05

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

xfs/parse.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,8 @@ func readWriteStats(us []uint32) (ReadWriteStats, error) {
286286
}
287287

288288
return ReadWriteStats{
289-
Read: us[0],
290-
Write: us[1],
289+
Write: us[0],
290+
Read: us[1],
291291
}, nil
292292
}
293293

xfs/parse_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ func TestParseStats(t *testing.T) {
199199
s: "rw 1 2",
200200
stats: &xfs.Stats{
201201
ReadWrite: xfs.ReadWriteStats{
202-
Read: 1,
203-
Write: 2,
202+
Write: 1,
203+
Read: 2,
204204
},
205205
},
206206
},
@@ -577,8 +577,8 @@ func TestParseStats(t *testing.T) {
577577
ForceSleep: 739,
578578
},
579579
ReadWrite: xfs.ReadWriteStats{
580-
Read: 107739,
581-
Write: 94045,
580+
Write: 107739,
581+
Read: 94045,
582582
},
583583
AttributeOperation: xfs.AttributeOperationStats{
584584
Get: 4,

xfs/xfs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ type LogOperationStats struct {
124124
// ReadWriteStats contains statistics regarding the number of read and write
125125
// system calls for XFS filesystems.
126126
type ReadWriteStats struct {
127-
Read uint32
128127
Write uint32
128+
Read uint32
129129
}
130130

131131
// AttributeOperationStats contains statistics regarding manipulation of

0 commit comments

Comments
 (0)