예제 #1
0
 def __init__(self, service_name):
     self._service_name = service_name
     self._expected_start_time = time.time()
     self._status = None
     self._linked_services = []
     # Initialize the counter for each service
     UNEXPECTED_SERVICE_RESTARTS.labels(
         service_name=self._service_name).inc(0)
예제 #2
0
 def update(self, start_time, status):
     self._status = status
     if start_time <= self._expected_start_time:
         # Probably a race in service starts, or magmad restarted
         return
     if (start_time - self._expected_start_time >
             self.SERVICE_RESTART_BUFFER_TIME):
         UNEXPECTED_SERVICE_RESTARTS.labels(
             service_name=self._service_name).inc()
         self._expected_start_time = start_time
예제 #3
0
        async def fetch_info():
            restart_frequencies = {}
            await service_poller._get_service_info()
            for service_name in service_poller.service_info.keys():
                restarts = int(
                    UNEXPECTED_SERVICE_RESTARTS.labels(
                        service_name=service_name)._value.get())
                restart_frequencies[service_name] = RestartFrequency(
                    count=restarts, time_interval='')

            return restart_frequencies