(self, conn, tags)
Get command-specific statistics from redis' INFO COMMANDSTATS command
Get command-specific statistics from redis' INFO COMMANDSTATS command
Get command - specific statistics from redis INFO COMMANDSTATS command
def _check_command_stats(self, conn, tags):
        """Get command-specific statistics from redis' INFO COMMANDSTATS command"""
        try:
            command_stats = conn.info("commandstats")
        except Exception:
            self.warning('Could not retrieve command stats from Redis. INFO COMMANDSTATS only works with Redis >= 2.6.')
            return

        for key, stats in iteritems(command_stats):
            command = key.split('_', 1)[1]
            command_tags = tags + ['command:{}'.format(command)]

            # When `host:` is passed as a command, `calls` ends up having a leading `:`
            # see https://github.com/DataDog/integrations-core/issues/839
            calls = stats.get('calls') if command != 'host' else stats.get(':calls')

            self.gauge('redis.command.calls', calls, tags=command_tags)
            self.gauge('redis.command.usec_per_call', stats['usec_per_call'], tags=command_tags)
def _check_command_stats ( self , conn , tags ) : try : command_stats = conn . info ( "commandstats" ) except Exception : self . warning ( 'Could not retrieve command stats from Redis. INFO COMMANDSTATS only works with Redis >= 2.6.' ) return for key , stats in iteritems ( command_stats ) : command = key . split ( '_' , 1 ) [ 1 ] command_tags = tags + [ 'command:{}' . format ( command ) ] # When `host:` is passed as a command, `calls` ends up having a leading `:` # see https://github.com/DataDog/integrations-core/issues/839 calls = stats . get ( 'calls' ) if command != 'host' else stats . get ( ':calls' ) self . gauge ( 'redis.command.calls' , calls , tags = command_tags ) self . gauge ( 'redis.command.usec_per_call' , stats [ 'usec_per_call' ] , tags = command_tags )