private async Task <KeyValuePair <string, HealthCheckDependencyModel> > RunAsync(IHealthCheck healthCheck, CancellationToken ct) { using (Logger.BeginScope("HealthCheckName:'{name}'", healthCheck.Name)) { Logger.LogDebug("Performing an health check"); HealthCheckStatus status; try { await healthCheck.UpdateStatusAsync(ct); status = healthCheck.Status; if (Logger.IsEnabled(LogLevel.Information)) { Logger.LogInformation("Health check status '{status}'", status.ToString("G")); } } catch (Exception e) { Logger.LogError(e, "Health check failed"); status = HealthCheckStatus.Red; } return(new KeyValuePair <string, HealthCheckDependencyModel>( healthCheck.Name, new HealthCheckDependencyModel { Status = status, Required = healthCheck.Required, Tags = healthCheck.Tags.ToArray() })); } }