def __init__(self, thread_count=None): """ 基于内存队列的爬虫,不支持分布式 :param thread_count: 线程数 """ super(AirSpider, self).__init__() for key, value in self.__class__.__custom_setting__.items(): setattr(setting, key, value) if thread_count: setattr(setting, "SPIDER_THREAD_COUNT", thread_count) self._thread_count = setting.SPIDER_THREAD_COUNT self._memory_db = MemoryDB() self._parser_controls = [] self._item_buffer = ItemBuffer(redis_key="air_spider") metrics.init(**setting.METRICS_OTHER_ARGS)
def init_metrics(self): """ 初始化打点系统 """ metrics.init(**setting.METRICS_OTHER_ARGS)
def __init_metrics(self): """ 初始化打点系统 @return: """ metrics.init(**setting.METRICS_OTHER_ARGS)
def __init_metrics(self): metrics.init(**setting.METRICS_OTHER_ARGS)
from feapder.utils import metrics # 初始化打点系统 metrics.init() metrics.emit_counter("key", count=1, classify="test") metrics.close()