@@ -37,12 +37,12 @@ type collstatsCollector struct {
3737}
3838
3939// newCollectionStatsCollector creates a collector for statistics about collections.
40- func newCollectionStatsCollector (ctx context.Context , client * mongo.Client , logger * logrus.Logger , compatible , discovery bool , topology labelsGetter , collections []string ) * collstatsCollector {
40+ func newCollectionStatsCollector (ctx context.Context , client * mongo.Client , logger * logrus.Logger , discovery bool , topology labelsGetter , collections []string ) * collstatsCollector {
4141 return & collstatsCollector {
4242 ctx : ctx ,
4343 base : newBaseCollector (client , logger .WithFields (logrus.Fields {"collector" : "collstats" })),
4444
45- compatibleMode : compatible ,
45+ compatibleMode : false , //there are no compatible metrics for this collector.
4646 discoveringMode : discovery ,
4747 topologyInfo : topology ,
4848
@@ -107,8 +107,18 @@ func (d *collstatsCollector) collect(ch chan<- prometheus.Metric) {
107107 },
108108 },
109109 }
110+ project := bson.D {
111+ {
112+ Key : "$project" , Value : bson.M {
113+ "storageStats.wiredTiger" : 0 ,
114+ "storageStats.indexDetails" : 0 ,
115+ },
116+ },
117+ }
118+
119+ pipeline := mongo.Pipeline {aggregation , project }
110120
111- cursor , err := client .Database (database ).Collection (collection ).Aggregate (d .ctx , mongo. Pipeline { aggregation } )
121+ cursor , err := client .Database (database ).Collection (collection ).Aggregate (d .ctx , pipeline )
112122 if err != nil {
113123 logger .Errorf ("cannot get $collstats cursor for collection %s.%s: %s" , database , collection , err )
114124
0 commit comments