Add option to disable mongodb cluster status (#7515)
It can be expensive to compute these metrics. In particular, when retrieveing the amount of jumbo chunks, an index is not being used and consequently the query triggers an expensive COLLSCAN. For big databases, this query has negative impact on the cluster performance.
This commit is contained in:
@@ -192,7 +192,7 @@ func (s *Server) gatherCollectionStats(colStatsDbs []string) (*ColStats, error)
|
||||
return results, nil
|
||||
}
|
||||
|
||||
func (s *Server) gatherData(acc telegraf.Accumulator, gatherDbStats bool, gatherColStats bool, colStatsDbs []string) error {
|
||||
func (s *Server) gatherData(acc telegraf.Accumulator, gatherClusterStatus bool, gatherDbStats bool, gatherColStats bool, colStatsDbs []string) error {
|
||||
s.Session.SetMode(mgo.Eventual, true)
|
||||
s.Session.SetSocketTimeout(0)
|
||||
|
||||
@@ -218,9 +218,13 @@ func (s *Server) gatherData(acc telegraf.Accumulator, gatherDbStats bool, gather
|
||||
}
|
||||
}
|
||||
|
||||
clusterStatus, err := s.gatherClusterStatus()
|
||||
if err != nil {
|
||||
s.Log.Debugf("Unable to gather cluster status: %s", err.Error())
|
||||
var clusterStatus *ClusterStatus
|
||||
if gatherClusterStatus {
|
||||
status, err := s.gatherClusterStatus()
|
||||
if err != nil {
|
||||
s.Log.Debugf("Unable to gather cluster status: %s", err.Error())
|
||||
}
|
||||
clusterStatus = status
|
||||
}
|
||||
|
||||
shardStats, err := s.gatherShardConnPoolStats()
|
||||
|
||||
Reference in New Issue
Block a user