Add shard server stats to the mongodb input plugin (#3808)
This commit is contained in:
committed by
Daniel Nelson
parent
8147d60973
commit
18aef35c58
@@ -34,6 +34,7 @@ type MongoStatus struct {
|
||||
ReplSetStatus *ReplSetStatus
|
||||
ClusterStatus *ClusterStatus
|
||||
DbStats *DbStats
|
||||
ShardStats *ShardStats
|
||||
}
|
||||
|
||||
type ServerStatus struct {
|
||||
@@ -116,6 +117,14 @@ type WiredTiger struct {
|
||||
Cache CacheStats `bson:"cache"`
|
||||
}
|
||||
|
||||
// ShardStats stores information from shardConnPoolStats.
|
||||
type ShardStats struct {
|
||||
TotalInUse int64 `bson:"totalInUse"`
|
||||
TotalAvailable int64 `bson:"totalAvailable"`
|
||||
TotalCreated int64 `bson:"totalCreated"`
|
||||
TotalRefreshing int64 `bson:"totalRefreshing"`
|
||||
}
|
||||
|
||||
type ConcurrentTransactions struct {
|
||||
Write ConcurrentTransStats `bson:"write"`
|
||||
Read ConcurrentTransStats `bson:"read"`
|
||||
@@ -450,6 +459,9 @@ type StatLine struct {
|
||||
|
||||
// DB stats field
|
||||
DbStatsLines []DbStatLine
|
||||
|
||||
// Shard stats
|
||||
TotalInUse, TotalAvailable, TotalCreated, TotalRefreshing int64
|
||||
}
|
||||
|
||||
type DbStatLine struct {
|
||||
@@ -783,5 +795,12 @@ func NewStatLine(oldMongo, newMongo MongoStatus, key string, all bool, sampleSec
|
||||
returnVal.DbStatsLines = append(returnVal.DbStatsLines, *dbStatLine)
|
||||
}
|
||||
|
||||
// Set shard stats
|
||||
newShardStats := *newMongo.ShardStats
|
||||
returnVal.TotalInUse = newShardStats.TotalInUse
|
||||
returnVal.TotalAvailable = newShardStats.TotalAvailable
|
||||
returnVal.TotalCreated = newShardStats.TotalCreated
|
||||
returnVal.TotalRefreshing = newShardStats.TotalRefreshing
|
||||
|
||||
return returnVal
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user