feat: add new rtt per op field to nfsclient (#10787)

This commit is contained in:
Joshua Powers 2022-03-11 12:56:03 -07:00 committed by GitHub
parent b526945c64
commit 02c3073f5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 11 deletions

View File

@ -62,7 +62,8 @@ If `fullstat` is set, a great deal of additional metrics are collected, detailed
- ops (integer, count) - The number of operations of this type executed. - ops (integer, count) - The number of operations of this type executed.
- retrans (integer, count) - The number of times an operation had to be retried (retrans = OP_trans - OP_ops. See nfs_ops below) - retrans (integer, count) - The number of times an operation had to be retried (retrans = OP_trans - OP_ops. See nfs_ops below)
- exe (integer, miliseconds) - The number of miliseconds it took to process the operations. - exe (integer, miliseconds) - The number of miliseconds it took to process the operations.
- rtt (integer, miliseconds) - The round-trip time for operations. - rtt (integer, miliseconds) - The total round-trip time for all operations.
- rtt_per_op (float, miliseconds) - The average round-trip time per operation.
In addition enabling `fullstat` will make many more metrics available. In addition enabling `fullstat` will make many more metrics available.

View File

@ -190,6 +190,10 @@ func (n *NFSClient) parseStat(mountpoint string, export string, version string,
fields["bytes"] = nline[3] + nline[4] fields["bytes"] = nline[3] + nline[4]
fields["rtt"] = nline[6] fields["rtt"] = nline[6]
fields["exe"] = nline[7] fields["exe"] = nline[7]
fields["rtt_per_op"] = 0.0
if nline[0] > 0 {
fields["rtt_per_op"] = float64(nline[6]) / float64(nline[0])
}
tags["operation"] = first tags["operation"] = first
acc.AddFields("nfsstat", fields, tags) acc.AddFields("nfsstat", fields, tags)
} }

View File

@ -103,11 +103,12 @@ func TestNFSClientProcessStat(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
fieldsReadstat := map[string]interface{}{ fieldsReadstat := map[string]interface{}{
"ops": uint64(600), "ops": uint64(600),
"retrans": uint64(1), "retrans": uint64(1),
"bytes": uint64(1207), "bytes": uint64(1207),
"rtt": uint64(606), "rtt": uint64(606),
"exe": uint64(607), "exe": uint64(607),
"rtt_per_op": float64(1.01),
} }
readTags := map[string]string{ readTags := map[string]string{
@ -119,11 +120,12 @@ func TestNFSClientProcessStat(t *testing.T) {
acc.AssertContainsTaggedFields(t, "nfsstat", fieldsReadstat, readTags) acc.AssertContainsTaggedFields(t, "nfsstat", fieldsReadstat, readTags)
fieldsWritestat := map[string]interface{}{ fieldsWritestat := map[string]interface{}{
"ops": uint64(700), "ops": uint64(700),
"retrans": uint64(1), "retrans": uint64(1),
"bytes": uint64(1407), "bytes": uint64(1407),
"rtt": uint64(706), "rtt": uint64(706),
"exe": uint64(707), "exe": uint64(707),
"rtt_per_op": float64(1.0085714285714287),
} }
writeTags := map[string]string{ writeTags := map[string]string{