From 26f6415b0a79363b21d83b074e526996a6a77b43 Mon Sep 17 00:00:00 2001 From: Carlo Cabanilla Date: Thu, 24 Oct 2013 16:50:22 -0400 Subject: [PATCH] collect redis commands as a per second metric instead of per flush interval (fixes #697) --- checks.d/redisdb.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/checks.d/redisdb.py b/checks.d/redisdb.py index e3ffc3d062..b3aa1d356b 100644 --- a/checks.d/redisdb.py +++ b/checks.d/redisdb.py @@ -67,7 +67,6 @@ class Redis(AgentCheck): def __init__(self, name, init_config, agentConfig): AgentCheck.__init__(self, name, init_config, agentConfig) - self.previous_total_commands = {} self.connections = {} def get_library_versions(self): @@ -162,12 +161,8 @@ def _check_db(self, instance, custom_tags=None): [self.rate (self.RATE_KEYS[k], info[k], tags=tags) for k in self.RATE_KEYS if k in info] # Save the number of commands. - total_commands = info['total_commands_processed'] - 1 - tuple_tags = tuple(tags) - if tuple_tags in self.previous_total_commands: - count = total_commands - self.previous_total_commands[tuple_tags] - self.gauge('redis.net.commands', count, tags=tags) - self.previous_total_commands[tuple_tags] = total_commands + self.rate('redis.net.commands', info['total_commands_processed'], + tags=tags) def check(self, instance): try: