Add latency stats to mongo input (#6733)

This commit is contained in:
Ross Lodge
2020-01-08 18:18:12 -08:00
committed by Daniel Nelson
parent 695678c4a5
commit 6f9f0b7f01
5 changed files with 285 additions and 0 deletions

View File

@@ -142,6 +142,29 @@ func TestAddShardStats(t *testing.T) {
}
}
func TestAddLatencyStats(t *testing.T) {
d := NewMongodbData(
&StatLine{
CommandOpsCnt: 73,
CommandLatency: 364,
ReadOpsCnt: 113,
ReadLatency: 201,
WriteOpsCnt: 7,
WriteLatency: 55,
},
tags,
)
var acc testutil.Accumulator
d.AddDefaultStats()
d.flush(&acc)
for key := range DefaultLatencyStats {
assert.True(t, acc.HasInt64Field("mongodb", key))
}
}
func TestAddShardHostStats(t *testing.T) {
expectedHosts := []string{"hostA", "hostB"}
hostStatLines := map[string]ShardHostStatLine{}