/** * Actual health check logic. * * @param HealthBuilder $builder * * @throws \Exception any Exception that should create a Status::DOWN * system status. */ protected function doHealthCheck(HealthBuilder $builder) { try { $this->connection->query('SELECT 1=1'); } catch (DBALException $e) { $builder->down($e); return; } $builder->up(); }
/** * Actual health check logic. * * @param HealthBuilder $builder * * @throws \Exception any Exception that should create a Status::DOWN * system status. */ protected function doHealthCheck(HealthBuilder $builder) { /** @var Response $response */ $response = $this->request->send(); $builder->withDetail('statusCode', $response->getStatusCode()); if (!$response->isSuccessful()) { $builder->down()->withDetail('body', $response->getBody(true)); return; } $builder->up(); }
/** * Actual health check logic. * * @param HealthBuilder $builder * * @throws \Exception any Exception that should create a Status::DOWN * system status. */ protected function doHealthCheck(HealthBuilder $builder) { try { $this->connection->reconnect(); $serverProperties = $this->connection->getServerProperties(); $builder->withDetail('version', $serverProperties['version'][1]); } catch (\Exception $e) { $builder->down($e); return; } $builder->up(); }
/** * Actual health check logic. * * @param HealthBuilder $builder * * @throws \Exception any Exception that should create a Status::DOWN * system status. */ protected function doHealthCheck(HealthBuilder $builder) { try { $version = $this->memcacheInstance->getversion(); } catch (\Exception $e) { $builder->down($e); return; } if (is_bool($version) && $version === false || is_array($version) && count($version) === 0) { $builder->down(); return; } $builder->up()->withDetail('version', $version); }
/** * Actual health check logic. * * @param HealthBuilder $builder * * @throws \Exception any Exception that should create a Status::DOWN * system status. */ protected function doHealthCheck(HealthBuilder $builder) { $directoryPath = $this->properties->getDirectory(); $diskFreeInBytes = disk_free_space($directoryPath); if ($diskFreeInBytes >= $this->properties->getThreshold()) { $builder->up(); } else { $builder->down(); } $builder->withDetail('total', disk_total_space($directoryPath)); $builder->withDetail('free', $diskFreeInBytes); $builder->withDetail('threshold', $this->properties->getThreshold()); }