in src/App/Services/Hosted/LivenessHostedService.cs [67:86]
internal async void HealthCheck(object state)
{
try
{
_logger.LogInformation("Running HealthCheck.");
var content = await _contentProvider.GetResponseContentAsync(_clusterExporterConfiguration.AmbariServerUri);
var clusters = JsonConvert.DeserializeObject<Clusters>(content);
// Creating a temporary file which notify Kubernetes that we're healthy.
File.Create(_configuration.LivenessFilePath == null ? "/tmp/healthy" : _configuration.LivenessFilePath).Close();
}
catch (Exception e)
{
_logger.LogError(e, "HealthCheck failed.");
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(e.InnerException).Throw();
throw;
}
}