示例#1
0
 def save_ping_response(self, sid: str, ip_addr: str,
                        ping_resp: PingCommandResult) -> None:
     reported_time = int(round(time() * 1000))
     self._subscriber_state[sid] = ICMPMonitoringResponse(
         last_reported_time=reported_time,
         latency_ms=ping_resp.stats.rtt_avg)
     subscriber_icmp_latency_ms.labels(sid).observe(ping_resp.stats.rtt_avg)
     logging.info('{}:{} => {}ms'.format(
         sid, ip_addr, self._subscriber_state[sid].latency_ms))
示例#2
0
 def save_ping_response(self, sid: str, ip_addr: str,
                        ping_resp: PingCommandResult) -> None:
     reported_time = datetime.now().timestamp()
     self._subscriber_state[sid] = ICMPMonitoringResponse(
         last_reported_time=int(reported_time),
         latency_ms=ping_resp.stats.rtt_avg)
     SUBSCRIBER_ICMP_LATENCY_MS.labels(sid).observe(ping_resp.stats.rtt_avg)
     logging.info('{}:{} => {}ms'.format(
         sid, ip_addr, self._subscriber_state[sid].latency_ms))
示例#3
0
 def _save_ping_response(self, sid: str,
                         ping_resp: PingCommandResult) -> None:
     """
     Saves ping response to in-memory subscriber dict.
     Args:
         sid: subscriber ID
         ping_resp: response of ICMP ping command
     """
     if ping_resp.error:
         logging.debug('Failed to ping %s with error: %s', sid,
                       ping_resp.error)
     reported_time = datetime.now().timestamp()
     self._subscriber_state[sid] = ICMPMonitoringResponse(
         last_reported_time=int(reported_time),
         latency_ms=ping_resp.stats.rtt_avg)
     logging.info('{} => {}ms'.format(
         sid, self._subscriber_state[sid].latency_ms))