use of se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus in project webcert by sklintyg.
the class HealthCheckServiceImpl method checkPrivatlakarportal.
@Override
public HealthStatus checkPrivatlakarportal() {
Stopwatch stopWatch = Stopwatch.createStarted();
boolean ok = pingPrivatlakarportal();
stopWatch.stop();
HealthStatus status = createStatusWithTiming(ok, stopWatch);
logStatus("pingPrivatlakarportal", status);
return status;
}
use of se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus in project webcert by sklintyg.
the class HealthCheckServiceImpl method checkSignatureQueue.
@Override
public HealthStatus checkSignatureQueue() {
try {
int queueDepth = jmsCertificateSenderTemplate.browse((session, browser) -> {
Enumeration<?> enumeration = browser.getEnumeration();
int qd = 0;
while (enumeration.hasMoreElements()) {
enumeration.nextElement();
qd++;
}
return qd;
});
LOG.info("Operation checkSignatureQueue completed with queue size {}", queueDepth);
return new HealthStatus(queueDepth, true);
} catch (Exception e) {
LOG.warn("Error when checking queue depth", e);
return new HealthStatus(-1, false);
}
}
use of se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus in project webcert by sklintyg.
the class HealthCheckServiceImpl method checkDB.
@Override
@Transactional
public HealthStatus checkDB() {
boolean ok;
Stopwatch stopWatch = Stopwatch.createStarted();
ok = checkTimeFromDb();
stopWatch.stop();
HealthStatus status = createStatusWithTiming(ok, stopWatch);
logStatus("getDbStatus", status);
return status;
}
use of se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus in project webcert by sklintyg.
the class PingForConfigurationResponderImpl method pingForConfiguration.
// CHECKSTYLE:OFF LineLength
@Override
public PingForConfigurationResponseType pingForConfiguration(@WebParam(partName = "LogicalAddress", name = "LogicalAddress", targetNamespace = "urn:riv:itintegration:registry:1", header = true) String logicalAddress, @WebParam(partName = "parameters", name = "PingForConfiguration", targetNamespace = "urn:riv:itintegration:monitoring:PingForConfigurationResponder:1") PingForConfigurationType parameters) {
// CHECKSTYLE:ON LineLength
PingForConfigurationResponseType response = new PingForConfigurationResponseType();
response.setPingDateTime(new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()));
LOG.info("Version String: " + projectVersion);
response.setVersion(projectVersion);
HealthStatus db = healthCheck.checkDB();
HealthStatus jms = healthCheck.checkJMS();
HealthStatus queueSize = healthCheck.checkSignatureQueue();
HealthStatus pingIntygstjanst = healthCheck.checkIntygstjanst();
HealthStatus pingPrivatlakarportal = healthCheck.checkPrivatlakarportal();
HealthStatus uptime = healthCheck.checkUptime();
HealthStatus nbrOfUsers = healthCheck.checkNbrOfUsers();
addConfiguration(response, "buildNumber", buildNumberString);
addConfiguration(response, "buildTime", buildTimeString);
addConfiguration(response, "systemUptime", DurationFormatUtils.formatDurationWords(uptime.getMeasurement(), true, true));
addConfiguration(response, "dbStatus", db.isOk() ? "ok" : "error");
addConfiguration(response, "jmsStatus", jms.isOk() ? "ok" : "error");
addConfiguration(response, "intygstjanst", pingIntygstjanst.isOk() ? "ok" : "no connection");
addConfiguration(response, "privatlakarportal", pingPrivatlakarportal.isOk() ? "ok" : "no connection");
addConfiguration(response, "signatureQueueSize", Long.toString(queueSize.getMeasurement()));
addConfiguration(response, "nbrOfUsers", Long.toString(nbrOfUsers.getMeasurement()));
return response;
}
use of se.inera.intyg.webcert.web.service.monitoring.dto.HealthStatus in project webcert by sklintyg.
the class HealthCheckServiceImplTest method testCheckPrivatlakarportal.
@Test
public void testCheckPrivatlakarportal() {
when(privatlakarportalPingForConfiguration.pingForConfiguration(eq(PP_LOGICAL_ADDRESS), any(PingForConfigurationType.class))).thenReturn(new PingForConfigurationResponseType());
HealthStatus res = service.checkPrivatlakarportal();
assertNotNull(res);
assertTrue(res.isOk());
assertNotNull(res.getMeasurement());
verify(privatlakarportalPingForConfiguration).pingForConfiguration(eq(PP_LOGICAL_ADDRESS), any(PingForConfigurationType.class));
}
Aggregations