Add shard server stats to the mongodb input plugin (#3808)

This commit is contained in:
Jake Champlin
2018-02-20 16:55:56 -05:00
committed by Daniel Nelson
parent 8147d60973
commit 18aef35c58
5 changed files with 68 additions and 1 deletions

View File

@@ -99,6 +99,27 @@ func TestAddWiredTigerStats(t *testing.T) {
}
}
func TestAddShardStats(t *testing.T) {
d := NewMongodbData(
&StatLine{
TotalInUse: 0,
TotalAvailable: 0,
TotalCreated: 0,
TotalRefreshing: 0,
},
tags,
)
var acc testutil.Accumulator
d.AddDefaultStats()
d.flush(&acc)
for key, _ := range DefaultShardStats {
assert.True(t, acc.HasInt64Field("mongodb", key))
}
}
func TestStateTag(t *testing.T) {
d := NewMongodbData(
&StatLine{
@@ -147,6 +168,10 @@ func TestStateTag(t *testing.T) {
"ttl_deletes_per_sec": int64(0),
"ttl_passes_per_sec": int64(0),
"jumbo_chunks": int64(0),
"total_in_use": int64(0),
"total_available": int64(0),
"total_created": int64(0),
"total_refreshing": int64(0),
}
acc.AssertContainsTaggedFields(t, "mongodb", fields, stateTags)
}