metricbeat/module/mongodb/collstats/_meta/docs.md
This is the collstats metricset of the module mongodb.
The collstats metricset collects collection-level operational and storage statistics from MongoDB. It transparently uses either the deprecated collStats database command (legacy) or the $collStats aggregation stage (MongoDB 6.2+) depending on server version and feature availability.
Notes:
shardCount summary. It does not emit a per-shard breakdown (no shards.*).indexSizes.* map) are intentionally not collected at this time.The collstats metricset uses the top administrative command to return usage statistics for each collection. It provides the amount of time, in microseconds, used and a count of operations for the following types:
It requires the following privileges, which is covered by the clusterMonitor role:
top action on cluster resourcecollStats action on collection resourcesaggregate action on collection resources (for MongoDB 6.2+)On mongos routers, the top command is not available. In such cases, only storage statistics are populated. Operation counters (for example: total, read, write, and query) may be absent.
Optional settings for this metricset:
scale (integer, default: 1): Server-side scale factor for size values reported by collStats/$collStats (for example, set to 1024 to receive sizes in KiB). Values are not rescaled client-side.