Ejemplo n.º 1
0
 public function getEncoded(api\HealthStatus $status)
 {
     $statuses = [];
     $statuses['status'] = $status->getStatus();
     foreach ($status->getChecks() as $key => $value) {
         $statuses[$key] = $value;
     }
     return $statuses;
 }
Ejemplo n.º 2
0
 public function runAll()
 {
     $status = new api\HealthStatus();
     $status->setStatus(api\HealthStatus::UP);
     foreach ($this->checks as $check) {
         $result = api\HealthStatus::DOWN;
         try {
             $result = $check->run();
         } catch (\Exception $e) {
         }
         $status->addCheck($check->getKey(), $result);
         if ($result != api\HealthStatus::UP) {
             $status->setStatus(api\HealthStatus::DOWN);
         }
     }
     foreach ($this->optionalChecks as $check) {
         try {
             $result = $check->run();
         } catch (\Exception $e) {
         }
         if ($result != api\HealthStatus::UP) {
             $result = api\HealthStatus::WARN;
         }
         $status->addCheck($check->getKey(), $result);
     }
     return $status;
 }