private static Dictionary <string, string> ProcessApiErrors(DeepHealthCheckResponse respVm) { // This processing is done at the request of DYNATRACE team //Parse the deep health check responses, throw & catch the exception for dynatrace monitoring. But return OK from the controller. Dictionary <string, string> apiErrors = null; try { var failedHealthCheck = respVm.HealthStatus.Any(x => x.StatusCode != StatusCode.Ok && x.StatusCode != StatusCode.NotImplemented); if (failedHealthCheck) { throw new DeepHealthCheckException { ErrorString = "One or more dependencies have failed.", DetailString = JsonProcessor.SerializeObject(respVm) }; } } catch (DeepHealthCheckException exc) { apiErrors = new Dictionary <string, string> { { "DeepHealthCheckException", exc.ErrorString } }; } return(apiErrors); }
public ApiResponse <DeepHealthCheckResponse, ApiData> DeepHealthCheck() { var respVm = new DeepHealthCheckResponse { HealthStatus = new List <HealthCheckResponse> { _agentConnectIntegration.HealthCheck(), _dlsIntegration.HealthCheck(), _partnerServiceIntegration.HealthCheck(), _openAmIntegration.HealthCheck(), _openIdmIntegration.HealthCheck(), _cacheIntegration.HealthCheck() } }; var apiErrors = ProcessApiErrors(respVm); return(new ApiResponse <DeepHealthCheckResponse, ApiData> { BusinessMetadata = MapperHelper.SetResponseProperties(null, DataSource.Support), ResponseData = respVm, ApiErrors = apiErrors }); }