Fix panic in mongodb input if ShardStats is nil (#6680)
This commit is contained in:
parent
7ff6ec1963
commit
a66b6729e9
|
@ -983,6 +983,7 @@ func NewStatLine(oldMongo, newMongo MongoStatus, key string, all bool, sampleSec
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set shard stats
|
// Set shard stats
|
||||||
|
if newMongo.ShardStats != nil {
|
||||||
newShardStats := *newMongo.ShardStats
|
newShardStats := *newMongo.ShardStats
|
||||||
returnVal.TotalInUse = newShardStats.TotalInUse
|
returnVal.TotalInUse = newShardStats.TotalInUse
|
||||||
returnVal.TotalAvailable = newShardStats.TotalAvailable
|
returnVal.TotalAvailable = newShardStats.TotalAvailable
|
||||||
|
@ -999,6 +1000,7 @@ func NewStatLine(oldMongo, newMongo MongoStatus, key string, all bool, sampleSec
|
||||||
|
|
||||||
returnVal.ShardHostStatsLines[host] = *shardStatLine
|
returnVal.ShardHostStatsLines[host] = *shardStatLine
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return returnVal
|
return returnVal
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue