Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mongo] add comments to metrics to indicate which collector it comes from #18611

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion mongo/datadog_checks/mongo/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
Core metrics collected by default.
"""
BASE_METRICS = {
# server_status collector
"asserts.msg": RATE,
"asserts.regular": RATE,
"asserts.rollovers": RATE,
Expand Down Expand Up @@ -125,14 +126,17 @@
"opcountersRepl.insert": RATE,
"opcountersRepl.query": RATE,
"opcountersRepl.update": RATE,
# replication_info collector
"oplog.logSizeMB": GAUGE,
"oplog.usedSizeMB": GAUGE,
"oplog.timeDiff": GAUGE,
# replica collector
"replSet.health": GAUGE,
"replSet.replicationLag": GAUGE,
"replSet.state": GAUGE,
"replSet.votes": GAUGE,
"replSet.voteFraction": GAUGE,
# db_stats collector
"stats.avgObjSize": GAUGE,
"stats.collections": GAUGE,
"stats.dataSize": GAUGE,
Expand All @@ -150,8 +154,10 @@
"stats.fsUsedSize": GAUGE,
"stats.fsTotalSize": GAUGE,
"stats.views": GAUGE,
# session_stats collector
"sessions.count": GAUGE,
"uptime": GAUGE,
# host_info collector
"system.memSizeMB": (GAUGE, "system.mem.total"), # total amount of system memory
"system.memLimitMB": (GAUGE, "system.mem.limit"), # memory usage limit
"system.numCores": (GAUGE, "system.cpu.cores"), # number of CPU cores
Expand Down Expand Up @@ -186,7 +192,8 @@
https://docs.mongodb.org/manual/reference/command/serverStatus/#serverStatus.metrics.commands
"""
COMMANDS_METRICS = {
# Required version >
# Required version > 3.0.0
# server_status collector
"metrics.commands.count.failed": RATE,
"metrics.commands.count.total": GAUGE,
"metrics.commands.createIndexes.failed": RATE,
Expand All @@ -210,6 +217,7 @@
https://docs.mongodb.org/manual/reference/command/serverStatus/#server-status-locks
"""
LOCKS_METRICS = {
# server_status collector
"locks.Collection.acquireCount.R": RATE,
"locks.Collection.acquireCount.r": RATE,
"locks.Collection.acquireCount.W": RATE,
Expand Down Expand Up @@ -262,6 +270,7 @@
TCMalloc memory allocator report.
"""
TCMALLOC_METRICS = {
# server_status collector
"tcmalloc.generic.current_allocated_bytes": GAUGE,
"tcmalloc.generic.heap_size": GAUGE,
"tcmalloc.tcmalloc.aggressive_memory_decommit": GAUGE,
Expand All @@ -279,6 +288,7 @@
WiredTiger storage engine.
"""
WIREDTIGER_METRICS = {
# server_status collector
"wiredTiger.cache.bytes currently in the cache": (GAUGE, "wiredTiger.cache.bytes_currently_in_cache"),
"wiredTiger.cache.bytes read into cache": GAUGE,
"wiredTiger.cache.bytes written from cache": GAUGE,
Expand Down Expand Up @@ -315,6 +325,7 @@
https://docs.mongodb.org/v3.0/reference/command/top/
"""
TOP_METRICS = {
# top collector
"commands.count": RATE,
"commands.time": GAUGE,
"getmore.count": RATE,
Expand All @@ -337,6 +348,7 @@

COLLECTION_METRICS = {
# collection storage stats
# coll_stats collector
'collection.size': GAUGE,
'collection.avgObjSize': GAUGE,
'collection.count': GAUGE,
Expand Down Expand Up @@ -365,13 +377,15 @@
}

SHARDED_DATA_DISTRIBUTION_METRICS = {
# sharded_data_distribution collector
'numOrphanedDocs': (GAUGE, 'sharded_data_distribution.num_orphaned_docs'),
'numOwnedDocuments': (GAUGE, 'sharded_data_distribution.num_owned_documents'),
'ownedSizeBytes': (GAUGE, 'sharded_data_distribution.owned_size_bytes'),
'orphanedSizeBytes': (GAUGE, 'sharded_data_distribution.orphaned_size_bytes'),
}

INDEX_METRICS = {
# index stats collector
'indexes.accesses.ops': RATE,
}

Expand Down
Loading