def _dump_crawl_stats(self):
        '''
        Dumps flattened crawling stats so the spiders do not have to
        '''
        extras = {}
        spiders = {}

        spider_set = set()
        total_spider_count = 0

        keys = self.redis_conn.keys('stats:crawler:*:*:*')
        for key in keys:
            # we only care about the spider
            elements = key.split(":")
            spider = elements[3]

            if spiders not in spider:
                spiders[spider] = 0

            if len(elements) == 6:
                # got a time based stat
                response = elements[4]
                end = elements[5]

                final = '{s}_{r}_{e}'.format(s=spider, r=response, e=end)

                if end == 'lifetime':
                    value = self.redis_conn.execute_command("PFCOUNT", key)
                else:
                    value = self.redis_conn.zcard(key)

                extras[final] = value

            elif len(elements) == 5:
                # got a spider identifier
                spiders[spider] += 1
                total_spider_count += 1
                spider_set.add(spider)

            else:
                self.logger.warn("Unknown crawler stat key", {"key":key})

        # simple counts
        extras['unique_spider_count'] = len(spider_set)
        extras['total_spider_count'] = total_spider_count

        for spider in spiders:
            extras['{k}_spider_count'.format(k=spider)] = spiders[spider]

        if not self.logger.json:
            self.logger.info('Crawler Stats Dump:\n{0}'.format(
                    json.dumps(extras, indent=4, sort_keys=True)))
        else:
            self.logger.info('Crawler Stats Dump', extra=extras)
dataset/ETHPy150Open istresearch/scrapy-cluster/redis-monitor/redis_monitor.py/RedisMonitor._dump_crawl_stats/swapped operands of `not in`