Skip to content

Commit

Permalink
[mongo] Add WiredTiger metrics
Browse files Browse the repository at this point in the history
[yann@datadoghq.com] rebased on #1979 → `wiredtiger` option.
  • Loading branch information
Ben McCann authored and yannmh committed Nov 2, 2015
1 parent 0962b19 commit 93cf083
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
35 changes: 29 additions & 6 deletions checks.d/mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,25 @@ class MongoDb(AgentCheck):
}

"""
Associates with the metric list to collect.
WiredTiger storage engine.
"""
AVAILABLE_METRICS = {
'durabilty': DURABILITY_METRICS,
'locks': LOCKS_METRICS,
'metrics.commands': COMMANDS_METRICS,
'tcmalloc': TCMALLOC_METRICS,
WIREDTIGER_METRICS = {

"wiredTiger.cache.bytes currently in the cache": GAUGE,
"wiredTiger.cache.failed eviction of pages that exceeded the in-memory maximum": GAUGE,
"wiredTiger.cache.in-memory page splits": GAUGE,
"wiredTiger.cache.maximum bytes configured": GAUGE,
"wiredTiger.cache.maximum page size at eviction": GAUGE,
"wiredTiger.cache.pages currently held in the cache": GAUGE,
"wiredTiger.cache.pages evicted because they exceeded the in-memory maximum": GAUGE,
"wiredTiger.cache.pages evicted by application threads": GAUGE,
"wiredTiger.concurrentTransactions.read.available": GAUGE,
"wiredTiger.concurrentTransactions.read.out": GAUGE,
"wiredTiger.concurrentTransactions.read.totalTickets": GAUGE,
"wiredTiger.concurrentTransactions.write.available": GAUGE,
"wiredTiger.concurrentTransactions.write.out": GAUGE,
"wiredTiger.concurrentTransactions.write.totalTickets": GAUGE,
}

"""
Expand All @@ -256,6 +268,17 @@ class MongoDb(AgentCheck):
'\.w\\b': ".intent_exclusive",
}

"""
Associates with the metric list to collect.
"""
AVAILABLE_METRICS = {
'durabilty': DURABILITY_METRICS,
'locks': LOCKS_METRICS,
'metrics.commands': COMMANDS_METRICS,
'tcmalloc': TCMALLOC_METRICS,
'wiredtiger': WIREDTIGER_METRICS,
}

def __init__(self, name, init_config, agentConfig, instances=None):
AgentCheck.__init__(self, name, init_config, agentConfig, instances)
self._last_state_by_server = {}
Expand Down
4 changes: 2 additions & 2 deletions checks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def normalize(self, metric, prefix=None):
"""Turn a metric into a well-formed metric name
prefix.b.c
"""
name = re.sub(r"[,\+\*\-/()\[\]{}]", "_", metric)
name = re.sub(r"[,\+\*\-/()\[\]{}\s]", "_", metric)
# Eliminate multiple _
name = re.sub(r"__+", "_", name)
# Don't start/end with _
Expand Down Expand Up @@ -759,7 +759,7 @@ def normalize(self, metric, prefix=None, fix_case=False):
if prefix is not None:
prefix = self.convert_to_underscore_separated(prefix)
else:
name = re.sub(r"[,\+\*\-/()\[\]{}]", "_", metric)
name = re.sub(r"[,\+\*\-/()\[\]{}\s]", "_", metric)
# Eliminate multiple _
name = re.sub(r"__+", "_", name)
# Don't start/end with _
Expand Down
2 changes: 2 additions & 0 deletions conf.d/mongo.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ instances:
# * `locks` - Locks
# * `metrics.commands` - Use of database commands
# * `tcmalloc` - TCMalloc memory allocator
# * `wiredtiger` - WiredTiger storage engine
# additional_metrics:
# - durability
# - locks
# - metrics.commands
# - tcmalloc
# - wiredtiger

0 comments on commit 93cf083

Please sign in to comment.