Skip to content

Commit 1a8e97d

Browse files
committed
Merge branch 'OCD-5174' into development
2 parents 485f0dd + 4465353 commit 1a8e97d

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

chpl/chpl-service/src/main/java/gov/healthit/chpl/scheduler/job/urluptime/DatadogSyntheticsTestResultService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ public SyntheticsAPITestResultFull getDetailedTestResult(String publicTestKey, S
7070
try {
7171
return apiProvider.getApiInstance().getAPITestResult(publicTestKey, resultId);
7272
} catch (ApiException e) {
73-
LOGGER.error("Could not retrieve test result details for: {} | {}", publicTestKey, resultId);
73+
LOGGER.error("Could not retrieve test result details for: {} | {}", publicTestKey, resultId, e);
74+
LOGGER.error("Datadog API error response: " + e.getResponseBody());
7475
return null;
7576
}
7677
}

chpl/chpl-service/src/main/java/gov/healthit/chpl/scheduler/job/urluptime/DatadogUrlUptimeSynchonizer.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class DatadogUrlUptimeSynchonizer {
4040
// VARIABLE NAMING CONVENTION
4141
// ServiceBaseUrlList - these are service base url lists collected from the listings in CHPL, grouped by developer
4242
// DatadogSyntheticsTest - these are synthetic tests that exist in Datadog
43-
// UrlUptimeMonitor - these are reporting entities that are store in the table url_uptime_monitors
43+
// UrlUptimeMonitor - these are reporting entities that are store in the table url_uptime_monitor
4444

4545
private DatadogSyntheticsTestService datadogSyntheticsTestService;
4646
private DatadogSyntheticsTestResultService datadogSyntheticsTestResultService;
@@ -82,12 +82,16 @@ private void synchronizeUrlUptimeMonitorTestsWithDatadogSyntheticsTestResults()
8282
.forEach(testDate -> urlUptimeMonitorDAO.getAll().forEach(urlUptimeMonitor -> {
8383
String publicId = getDatadogPublicId(syntheticsTestDetails, urlUptimeMonitor.getUrl(), urlUptimeMonitor.getDeveloper().getId());
8484
datadogSyntheticsTestResultService.getSyntheticsTestResults(publicId, testDate).forEach(syntheticsTestResult -> {
85+
try {
8586
urlUptimeMonitorTestDAO.create(UrlUptimeMonitorTest.builder()
8687
.urlUptimeMonitorId(urlUptimeMonitor.getId())
8788
.datadogTestKey(syntheticsTestResult.getResultId())
8889
.checkTime(toLocalDateTime(syntheticsTestResult.getCheckTime().longValue()))
8990
.passed(calculatePassed(syntheticsTestResult, publicId))
9091
.build());
92+
} catch (Exception ex) {
93+
LOGGER.error("Could not process url_uptime_monitor " + publicId + " for url " + urlUptimeMonitor.getUrl() + " and developer " + urlUptimeMonitor.getDeveloper().getId());
94+
}
9195
});
9296
}));
9397
}
@@ -97,7 +101,7 @@ private boolean calculatePassed(SyntheticsAPITestResultShort result, String publ
97101
return true;
98102
} else {
99103
SyntheticsAPITestResultFull detailedResult = datadogSyntheticsTestResultService.getDetailedTestResult(publicId, result.getResultId());
100-
return isErrorIgnorable(detailedResult.getResult().getFailure().getCode());
104+
return detailedResult != null && isErrorIgnorable(detailedResult.getResult().getFailure().getCode());
101105
}
102106
}
103107

@@ -199,7 +203,7 @@ private void removeOutdatedUrlMonitors(List<UrlUptimeMonitor> existing, List<Url
199203
existing.stream()
200204
.filter(uum -> !contains(expected, uum))
201205
.forEach(urlMonitor -> {
202-
LOGGER.info("Removing the following URL to url_uptime_monitor table: {}, {}", urlMonitor.getUrl(), urlMonitor.getDeveloper().getId());
206+
LOGGER.info("Removing the following URL to url_uptime_monitor table: {}, {}, {}", urlMonitor.getUrl(), urlMonitor.getDeveloper().getId(), urlMonitor.getDatadogPublicId());
203207
urlUptimeMonitorDAO.delete(urlMonitor);
204208
});
205209
}

0 commit comments

Comments
 (0)