public WebEndpointResponse<Health> getHealth(SecurityContext securityContext, ShowDetails showDetails) { return this.responseMapper.map(this.delegate.health(), securityContext, showDetails); }
@ReadOperation public WebEndpointResponse<Health> healthForComponent(SecurityContext securityContext, @Selector String component) { Supplier<Health> health = () -> this.delegate.healthForComponent(component); return this.responseMapper.mapDetails(health, securityContext); }
@ReadOperation public WebEndpointResponse<Health> healthForComponentInstance( SecurityContext securityContext, @Selector String component, @Selector String instance) { Supplier<Health> health = () -> this.delegate .healthForComponentInstance(component, instance); return this.responseMapper.mapDetails(health, securityContext); }
/** * Return the {@link Health} of a particular {@code instance} managed by the specified * {@code component} or {@code null} if that particular component is not a * {@link CompositeHealthIndicator} or if such instance does not exist. * @param component the name of a particular {@link CompositeHealthIndicator} * @param instance the name of an instance managed by that component * @return the {@link Health} for the component instance of {@code null} */ @ReadOperation public Health healthForComponentInstance(@Selector String component, @Selector String instance) { HealthIndicator indicator = getNestedHealthIndicator(this.healthIndicator, component); HealthIndicator nestedIndicator = getNestedHealthIndicator(indicator, instance); return (nestedIndicator != null) ? nestedIndicator.health() : null; }
@Bean @ConditionalOnMissingBean public HealthEndpoint healthEndpoint(HealthAggregator healthAggregator, HealthIndicatorRegistry registry) { return new HealthEndpoint( new CompositeHealthIndicator(healthAggregator, registry)); }
/** * Return the {@link Health} of a particular component or {@code null} if such * component does not exist. * @param component the name of a particular {@link HealthIndicator} * @return the {@link Health} for the component or {@code null} */ @ReadOperation public Health healthForComponent(@Selector String component) { HealthIndicator indicator = getNestedHealthIndicator(this.healthIndicator, component); return (indicator != null) ? indicator.health() : null; }
@ReadOperation public WebEndpointResponse<Health> health(SecurityContext securityContext) { return this.responseMapper.map(this.delegate.health(), securityContext); }
@SshdShellCommand(value = "component", description = "Health for component") public String healthForComponent(String arg) { if (StringUtils.isEmpty(arg)) { return "Usage: health component <component>"; } return JsonUtils.asJson(healthEndpoint.healthForComponent(arg)); }
@SshdShellCommand(value = "componentInstance", description = "Health for component instance") public String healthForComponentInstance(String arg) { if (StringUtils.isEmpty(arg)) { return "Usage: health componentInstance {\"component\":\"<component>\",\"instance\":\"<instance>\"}"; } return CommandUtils.process(log, () -> { ComponentInstance ci = JsonUtils.stringToObject(arg, ComponentInstance.class); return JsonUtils.asJson(healthEndpoint.healthForComponentInstance(ci.component, ci.instance)); }); }
/** * Health method * * @return health */ @ShellMethod(key = "health", value = "Display health endpoint.") @ShellMethodAvailability("healthAvailability") public Health health() { return health.health(); }
@SshdShellCommand(value = "info", description = "Health info for all components") public String healthInfo(String arg) { return JsonUtils.asJson(healthEndpoint.health()); }
@GetMapping("/health") public ResponseEntity<Map> getHealth() { Health health = healthEndpoint.health(); Map body = new HashMap(); body.put("status", health.getStatus().getCode()); body.put("zipkin", health.getDetails().get("zipkin")); return ResponseEntity.status(statusMapper.mapStatus(health.getStatus())).body(body); }
/** * Health method * * @return health */ @ShellMethod(key = "health", value = "Display health endpoint.") @ShellMethodAvailability("healthAvailability") public Object health() { return prettify(health.health()); }
/** * Handle request. * * @return the map */ @ReadOperation public Map<String, Object> handle() { val model = new LinkedHashMap<String, Object>(); val health = this.healthEndpoint.health(); val status = health.getStatus(); if (status.equals(Status.DOWN) || status.equals(Status.OUT_OF_SERVICE)) { model.put("status", HttpStatus.SERVICE_UNAVAILABLE.value()); model.put("description", HttpStatus.SERVICE_UNAVAILABLE.name()); } else { model.put("status", HttpStatus.OK.value()); model.put("description", HttpStatus.OK.name()); } model.put("health", status.getCode()); model.put("host", StringUtils.isBlank(casProperties.getHost().getName()) ? InetAddressUtils.getCasServerHostName() : casProperties.getHost().getName()); model.put("server", casProperties.getServer().getName()); model.put("version", CasVersion.asString()); return model; } }