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

Additional derived Redis metrics #1015

Merged
merged 2 commits into from
Jul 7, 2014
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
9 changes: 9 additions & 0 deletions checks.d/redisdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@ def _check_db(self, instance, custom_tags=None):
for key in info.keys():
if self.db_key_pattern.match(key):
db_tags = list(tags) + ["redis_db:" + key]
# allows tracking percentage of expired keys as DD does not
# currently allow arithmetic on metric for monitoring
expires_keys = info[key]["expires"]
total_keys = info[key]["keys"]
persist_keys = total_keys - expires_keys
self.gauge("redis.persist", persist_keys, tags=db_tags)
self.gauge("redis.persist.percent", 100.0 * persist_keys / total_keys, tags=db_tags)
self.gauge("redis.expires.percent", 100.0 * expires_keys / total_keys, tags=db_tags)

for subkey in self.subkeys:
# Old redis module on ubuntu 10.04 (python-redis 0.6.1) does not
# returns a dict for those key but a string: keys=3,expires=0
Expand Down