http_agent.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:oshino 作者: CodersOfTheNight 项目源码 文件源码
def process(self, event_fn):
        logger = self.get_logger()
        ts = time()
        state = None
        async with aiohttp.ClientSession() as session:
            async with session.get(self.url) as resp:
                state = self.translate_status(resp.status)
        te = time()
        span = int((te - ts) * 1000)
        logger.debug("Request to {url} returned status code {code}(as {state})"
                     "in {span} milliseconds.".format(url=self.url,
                                                      code=resp.status,
                                                      state=state,
                                                      span=span))

        event_fn(service=self.prefix + "health",
                 metric_f=span,
                 state=str(state),
                 description=self.url)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号