Skip to content

Commit 26f6415

Browse files
author
Carlo Cabanilla
committed
collect redis commands as a per second metric instead of per flush interval (fixes #697)
1 parent 71df2cb commit 26f6415

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

checks.d/redisdb.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ class Redis(AgentCheck):
6767

6868
def __init__(self, name, init_config, agentConfig):
6969
AgentCheck.__init__(self, name, init_config, agentConfig)
70-
self.previous_total_commands = {}
7170
self.connections = {}
7271

7372
def get_library_versions(self):
@@ -162,12 +161,8 @@ def _check_db(self, instance, custom_tags=None):
162161
[self.rate (self.RATE_KEYS[k], info[k], tags=tags) for k in self.RATE_KEYS if k in info]
163162

164163
# Save the number of commands.
165-
total_commands = info['total_commands_processed'] - 1
166-
tuple_tags = tuple(tags)
167-
if tuple_tags in self.previous_total_commands:
168-
count = total_commands - self.previous_total_commands[tuple_tags]
169-
self.gauge('redis.net.commands', count, tags=tags)
170-
self.previous_total_commands[tuple_tags] = total_commands
164+
self.rate('redis.net.commands', info['total_commands_processed'],
165+
tags=tags)
171166

172167
def check(self, instance):
173168
try:

0 commit comments

Comments
 (0)