use of io.pravega.shared.health.ContributorNotFoundException in project pravega by pravega.
the class HealthEndpointImpl method getHealth.
/**
* Validates that the {@link HealthContributor} exists and requests it's {@link Health}.
*
* @param id The id/name of the {@link HealthContributor} to check the {@link Health} of.
* @return The {@link Health} result of the {@link HealthContributor} with name 'id'. Returns NULL if 'id' does not map to
* a {@link HealthContributor}.
*/
@NonNull
@Override
public Health getHealth(String id) {
Health health;
if (id == null || id.equals(root.getName())) {
health = updater.getLatestHealth();
} else {
List<String> path = Arrays.asList(id.split(DELIMITER));
health = search(path, updater.getLatestHealth());
}
if (health == null) {
throw new ContributorNotFoundException(String.format("No HealthContributor found with name '%s'", id), 404);
}
return health;
}
Aggregations