use of io.smallrye.health.SmallRyeHealth in project wildfly by wildfly.
the class MicroProfileHealthReporter method getHealth.
private SmallRyeHealth getHealth(Map<HealthCheck, ClassLoader> serverChecks, Map<HealthCheck, ClassLoader> deploymentChecks, HealthCheckResponse.Status defaultStatus) {
JsonArrayBuilder results = Json.createArrayBuilder();
HealthCheckResponse.Status status = defaultStatus;
status = processChecks(serverChecks, results, status);
status = processChecks(deploymentChecks, results, status);
JsonObjectBuilder builder = Json.createObjectBuilder();
JsonArray checkResults = results.build();
builder.add("status", status.toString());
builder.add("checks", checkResults);
JsonObject build = builder.build();
if (status.equals(HealthCheckResponse.Status.DOWN)) {
MicroProfileHealthLogger.LOGGER.healthDownStatus(build.toString());
}
return new SmallRyeHealth(build);
}
use of io.smallrye.health.SmallRyeHealth in project wildfly by wildfly.
the class CheckOperations method executeRuntimeStep.
@Override
protected void executeRuntimeStep(OperationContext context, ModelNode operation) {
ServiceName serviceName = context.getCapabilityServiceName(MicroProfileHealthSubsystemDefinition.MICROPROFILE_HEALTH_REPORTER_CAPABILITY, MicroProfileHealthReporter.class);
MicroProfileHealthReporter reporter = (MicroProfileHealthReporter) context.getServiceRegistry(false).getService(serviceName).getValue();
SmallRyeHealth health = healthOperation.apply(reporter);
ModelNode result = ModelNode.fromJSONString(health.getPayload().toString());
context.getResult().set(result);
}
Aggregations