Hi All,
We recently upgraded to metricbeat 8.14.3 so we could support our mongodb 5.0 upgrade. Since the upgrade, we noticed high cpu usage.
Traced it to the mongodb replstatus metricset. It is running this expensive query on the oplog that is taking 8s, runs every 10s. Query is running a COLLSCAN on oplog.rs
{
"$group": {
"minTS": {
"$min": "$ts"
},
"_id": 1,
"maxTS": {
"$max": "$ts"
}
}
}
Our oplog.rs collection is about 3gb. Not super huge but we do have much larger oplogs in other environments. Couldn't the same information be gathered by calling a db.getReplicationInfo() function call without the COLLSCAN?
I noticed this was a change added to fix this problem
I have reduced the frequency of the mongodb metrics for now and having that run on the secondary as a work around for now.
Thanks,
Jay