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)
评论列表
文章目录