Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: Allow multiple xprt fields for NFS stats #619

Merged
merged 1 commit into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions mountstats.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ type MountStatsNFS struct {
// Statistics broken down by filesystem operation.
Operations []NFSOperationStats
// Statistics about the NFS RPC transport.
Transport NFSTransportStats
Transport []NFSTransportStats
}

// mountStats implements MountStats.
Expand Down Expand Up @@ -434,7 +434,7 @@ func parseMountStatsNFS(s *bufio.Scanner, statVersion string) (*MountStatsNFS, e
return nil, err
}

stats.Transport = *tstats
stats.Transport = append(stats.Transport, *tstats)
}

// When encountering "per-operation statistics", we must break this
Expand Down
220 changes: 116 additions & 104 deletions mountstats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,21 +116,23 @@ func TestMountStats(t *testing.T) {
Type: "nfs",
Stats: &MountStatsNFS{
StatVersion: "1.0",
Transport: NFSTransportStats{
Protocol: "tcp",
Port: 1,
Bind: 2,
Connect: 3,
ConnectIdleTime: 4,
IdleTimeSeconds: 5,
Sends: 6,
Receives: 7,
BadTransactionIDs: 8,
CumulativeActiveRequests: 9,
CumulativeBacklog: 10,
MaximumRPCSlotsUsed: 0, // these three are not
CumulativeSendingQueue: 0, // present in statvers=1.0
CumulativePendingQueue: 0, //
Transport: []NFSTransportStats{
{
Protocol: "tcp",
Port: 1,
Bind: 2,
Connect: 3,
ConnectIdleTime: 4,
IdleTimeSeconds: 5,
Sends: 6,
Receives: 7,
BadTransactionIDs: 8,
CumulativeActiveRequests: 9,
CumulativeBacklog: 10,
MaximumRPCSlotsUsed: 0, // these three are not
CumulativeSendingQueue: 0, // present in statvers=1.0
CumulativePendingQueue: 0, //
},
},
},
}},
Expand All @@ -144,21 +146,23 @@ func TestMountStats(t *testing.T) {
Type: "nfs",
Stats: &MountStatsNFS{
StatVersion: "1.0",
Transport: NFSTransportStats{
Protocol: "udp",
Port: 1,
Bind: 2,
Connect: 0,
ConnectIdleTime: 0,
IdleTimeSeconds: 0,
Sends: 3,
Receives: 4,
BadTransactionIDs: 5,
CumulativeActiveRequests: 6,
CumulativeBacklog: 7,
MaximumRPCSlotsUsed: 0, // these three are not
CumulativeSendingQueue: 0, // present in statvers=1.0
CumulativePendingQueue: 0, //
Transport: []NFSTransportStats{
{
Protocol: "udp",
Port: 1,
Bind: 2,
Connect: 0,
ConnectIdleTime: 0,
IdleTimeSeconds: 0,
Sends: 3,
Receives: 4,
BadTransactionIDs: 5,
CumulativeActiveRequests: 6,
CumulativeBacklog: 7,
MaximumRPCSlotsUsed: 0, // these three are not
CumulativeSendingQueue: 0, // present in statvers=1.0
CumulativePendingQueue: 0, //
},
},
},
}},
Expand All @@ -172,21 +176,23 @@ func TestMountStats(t *testing.T) {
Type: "nfs",
Stats: &MountStatsNFS{
StatVersion: "1.1",
Transport: NFSTransportStats{
Protocol: "tcp",
Port: 1,
Bind: 2,
Connect: 3,
ConnectIdleTime: 4,
IdleTimeSeconds: 5,
Sends: 6,
Receives: 7,
BadTransactionIDs: 8,
CumulativeActiveRequests: 9,
CumulativeBacklog: 10,
MaximumRPCSlotsUsed: 11,
CumulativeSendingQueue: 12,
CumulativePendingQueue: 13,
Transport: []NFSTransportStats{
{
Protocol: "tcp",
Port: 1,
Bind: 2,
Connect: 3,
ConnectIdleTime: 4,
IdleTimeSeconds: 5,
Sends: 6,
Receives: 7,
BadTransactionIDs: 8,
CumulativeActiveRequests: 9,
CumulativeBacklog: 10,
MaximumRPCSlotsUsed: 11,
CumulativeSendingQueue: 12,
CumulativePendingQueue: 13,
},
},
},
}},
Expand All @@ -200,21 +206,23 @@ func TestMountStats(t *testing.T) {
Type: "nfs",
Stats: &MountStatsNFS{
StatVersion: "1.1",
Transport: NFSTransportStats{
Protocol: "udp",
Port: 1,
Bind: 2,
Connect: 0, // these three are not
ConnectIdleTime: 0, // present for UDP
IdleTimeSeconds: 0, //
Sends: 3,
Receives: 4,
BadTransactionIDs: 5,
CumulativeActiveRequests: 6,
CumulativeBacklog: 7,
MaximumRPCSlotsUsed: 8,
CumulativeSendingQueue: 9,
CumulativePendingQueue: 10,
Transport: []NFSTransportStats{
{
Protocol: "udp",
Port: 1,
Bind: 2,
Connect: 0, // these three are not
ConnectIdleTime: 0, // present for UDP
IdleTimeSeconds: 0, //
Sends: 3,
Receives: 4,
BadTransactionIDs: 5,
CumulativeActiveRequests: 6,
CumulativeBacklog: 7,
MaximumRPCSlotsUsed: 8,
CumulativeSendingQueue: 9,
CumulativePendingQueue: 10,
},
},
},
}},
Expand Down Expand Up @@ -356,17 +364,19 @@ func TestMountStats(t *testing.T) {
AverageRTTMilliseconds: 0.5695744656983355,
},
},
Transport: NFSTransportStats{
Protocol: "tcp",
Port: 832,
Connect: 1,
IdleTimeSeconds: 11,
Sends: 6428,
Receives: 6428,
CumulativeActiveRequests: 12154,
MaximumRPCSlotsUsed: 24,
CumulativeSendingQueue: 26,
CumulativePendingQueue: 5726,
Transport: []NFSTransportStats{
{
Protocol: "tcp",
Port: 832,
Connect: 1,
IdleTimeSeconds: 11,
Sends: 6428,
Receives: 6428,
CumulativeActiveRequests: 12154,
MaximumRPCSlotsUsed: 24,
CumulativeSendingQueue: 26,
CumulativePendingQueue: 5726,
},
},
},
},
Expand Down Expand Up @@ -431,39 +441,41 @@ func TestMountStats(t *testing.T) {
Errors: 0,
},
},
Transport: NFSTransportStats{
Protocol: "rdma",
Port: 0,
Bind: 0,
Connect: 5808,
ConnectIdleTime: 62,
IdleTimeSeconds: 0,
Sends: 494490723,
Receives: 494490687,
BadTransactionIDs: 36,
CumulativeActiveRequests: 10032963746,
CumulativeBacklog: 1282789,
MaximumRPCSlotsUsed: 0,
CumulativeSendingQueue: 0,
CumulativePendingQueue: 0,
ReadChunkCount: 107150285,
WriteChunkCount: 1226637531,
ReplyChunkCount: 2673889,
TotalRdmaRequest: 135120843409861,
PullupCopyCount: 135119397156505,
HardwayRegisterCount: 266368832,
FailedMarshalCount: 75716996,
BadReplyCount: 0,
MrsRecovered: 7853,
MrsOrphaned: 0,
MrsAllocated: 0,
EmptySendctxQ: 0,
TotalRdmaReply: 0,
FixupCopyCount: 119328,
ReplyWaitsForSend: 1336431717,
LocalInvNeeded: 0,
NomsgCallCount: 96,
BcallCount: 0,
Transport: []NFSTransportStats{
{
Protocol: "rdma",
Port: 0,
Bind: 0,
Connect: 5808,
ConnectIdleTime: 62,
IdleTimeSeconds: 0,
Sends: 494490723,
Receives: 494490687,
BadTransactionIDs: 36,
CumulativeActiveRequests: 10032963746,
CumulativeBacklog: 1282789,
MaximumRPCSlotsUsed: 0,
CumulativeSendingQueue: 0,
CumulativePendingQueue: 0,
ReadChunkCount: 107150285,
WriteChunkCount: 1226637531,
ReplyChunkCount: 2673889,
TotalRdmaRequest: 135120843409861,
PullupCopyCount: 135119397156505,
HardwayRegisterCount: 266368832,
FailedMarshalCount: 75716996,
BadReplyCount: 0,
MrsRecovered: 7853,
MrsOrphaned: 0,
MrsAllocated: 0,
EmptySendctxQ: 0,
TotalRdmaReply: 0,
FixupCopyCount: 119328,
ReplyWaitsForSend: 1336431717,
LocalInvNeeded: 0,
NomsgCallCount: 96,
BcallCount: 0,
},
},
},
}},
Expand Down