code: def get_queue_stats(self):
          '''
          Gather queue stats
  
          @return: A dict of stats
          '''
          self.logger.debug("Gathering queue based stats")
  
          the_dict = {}
          keys = self.redis_conn.keys('*:*:queue')
          total_backlog = 0
          for key in keys:
              elements = key.split(":")
              spider = elements[0]
              domain = elements[1]
              spider = 'queue_' + spider
  
              if spider not in the_dict:
                  the_dict[spider] = {
                      'spider_backlog': 0,
                      'num_domains': 0,
                      'domains': []
                  }
  
              count = self.redis_conn.zcard(key)
              total_backlog += count
              the_dict[spider]['spider_backlog'] += count
              the_dict[spider]['num_domains'] += 1
              the_dict[spider]['domains'].append({'domain': domain,
                                                  'backlog': count})
  
          the_dict['total_backlog'] = total_backlog
          ret_dict = {
              'queues': the_dict
          }
  
          return ret_dicf get_queue_stats(self):
          '''
          Gather queue stats
  
          @return: A dict of stats
          '''
          self.logger.debug("Gathering queue based stats")
  
          the_dict = {}
          keys = self.redis_conn.keys('*:*:queue')
          total_backlog = 0
          for key in keys:
              elements = key.split(":")
              spider = elements[0]
              domain = elements[1]
              spider = 'queue_' + spider
  
              if spider not in the_dict:
                  the_dict[spider] = {
                      'spider_backlog': 0,
                      'num_domains': 0,
                      'domains': []
                  }
  
              count = self.redis_conn.zcard(key)
              total_backlog += count
              the_dict[spider]['spider_backlog'] += count
              the_dict[spider]['num_domains'] += 1
              the_dict[spider]['domains'].append({'domain': domain,
                                                  'backlog': count})
  
          the_dict['total_backlog'] = total_backlog
          ret_dict = {
              'queues': the_dict
          }
  
          return ret_dict
docs: Gather queue stats
  
          @return: A dict of stats