public HealthResult CheckHealth() { var endpointHealthResult = _endpointHealth.CheckHealth(); return(_healthy && endpointHealthResult.Status == BusHealthStatus.Healthy ? HealthResult.Healthy("Ready", endpointHealthResult.Data) : HealthResult.Unhealthy($"Not ready: {_failureMessage}", data: endpointHealthResult.Data)); }
public HealthResult CheckHealth() { var endpointHealthResult = _endpointHealth.CheckHealth(); var data = new Dictionary <string, object> { ["Endpoints"] = endpointHealthResult.Data }; return(_healthy && endpointHealthResult.Status == BusHealthStatus.Healthy ? HealthResult.Healthy("Ready", data) : HealthResult.Unhealthy($"Not ready: {_failureMessage}", data: data)); }
public HealthResult CheckHealth() { (var status, var description, IReadOnlyDictionary <string, EndpointHealthResult> results) = _endpointHealth.CheckHealth(); var exception = results.Where(x => x.Value.Exception != null).Select(x => x.Value.Exception).FirstOrDefault(); return(_healthy && status == BusHealthStatus.Healthy ? HealthResult.Healthy("Ready", results) : _healthy && status == BusHealthStatus.Degraded ? HealthResult.Degraded(description, exception, results) : HealthResult.Unhealthy($"Not ready: {_failureMessage}", exception, results)); }
public HealthResult CheckHealth() { EndpointStatus[] faulted = _endpoints.Values.Where(x => !x.Ready).ToArray(); Dictionary <string, object> data = _endpoints.ToDictionary(x => x.Key.ToString(), x => x.Value.GetData()); HealthResult healthCheckResult; if (faulted.Any()) { healthCheckResult = HealthResult.Unhealthy($"Unhealthy Endpoints: {string.Join(",", faulted.Select(x => x.InputAddress.GetLastPart()))}", faulted.Select(x => x.LastException).FirstOrDefault(e => e != null), data); } else { healthCheckResult = HealthResult.Healthy("Endpoints are healthy", data); } return(healthCheckResult); }