org.springframework.boot.actuate.health.CompositeHealthIndicator Java Examples

The following examples show how to use org.springframework.boot.actuate.health.CompositeHealthIndicator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HealthAutoConfiguration.java    From sdmq with Apache License 2.0 6 votes vote down vote up
@Bean
@Autowired(required = false)
@ConditionalOnMissingBean
public HealthIndicator jikexiuHealthIndicator(RedisQueueImpl redisQueue,
                                              RedisQueueProperties properties) {
    CompositeHealthIndicator compositeHealthIndicator = new
            CompositeHealthIndicator(healthAggregator);
    Map<String, LeaderManager> leaderManagerMap = AppEnvContext.getCtx().getBeansOfType(LeaderManager.class);
    LeaderManager              manager          = null;
    if (leaderManagerMap != null && !leaderManagerMap.isEmpty()) {
        manager = AppEnvContext.getCtx().getBean(SimpleLeaderManager.class);
    }

    compositeHealthIndicator.addHealthIndicator("dq", new QueueHealthIndicator(
            redisQueue, manager, properties));
    return compositeHealthIndicator;
}
 
Example #2
Source File: PipelineController.java    From kayenta with Apache License 2.0 6 votes vote down vote up
@Autowired
public PipelineController(
    ExecutionLauncher executionLauncher,
    ExecutionRepository executionRepository,
    ObjectMapper kayentaObjectMapper,
    ConfigurableApplicationContext context,
    HealthIndicatorRegistry healthIndicators,
    HealthAggregator healthAggregator,
    ScheduledAnnotationBeanPostProcessor postProcessor) {
  this.executionLauncher = executionLauncher;
  this.executionRepository = executionRepository;
  this.kayentaObjectMapper = kayentaObjectMapper;
  this.context = context;
  this.healthIndicator = new CompositeHealthIndicator(healthAggregator, healthIndicators);
  this.postProcessor = postProcessor;
}
 
Example #3
Source File: HealthAutoConfiguration.java    From mykit-delay with Apache License 2.0 5 votes vote down vote up
@Bean
@Autowired(required = false)
@ConditionalOnMissingBean
public HealthIndicator jikexiuHealthIndicator(RedisQueue redisQueue, RedisQueueProperties properties) {
    CompositeHealthIndicator compositeHealthIndicator = new  CompositeHealthIndicator(healthAggregator);
    Map<String, LeaderManager> leaderManagerMap = AppEnvContext.getCtx().getBeansOfType(LeaderManager.class);
    LeaderManager manager = null;
    if (leaderManagerMap != null && !leaderManagerMap.isEmpty()) {
        manager = AppEnvContext.getCtx().getBean(SimpleLeaderManager.class);
    }

    compositeHealthIndicator.addHealthIndicator(Constants.HEALTH_INDICATOR_NAME, new QueueHealthIndicator(redisQueue, manager, properties));
    return compositeHealthIndicator;
}
 
Example #4
Source File: HealthMetricsConfiguration.java    From summerframework with Apache License 2.0 5 votes vote down vote up
public HealthMetricsConfiguration(HealthAggregator healthAggregator, List<HealthIndicator> healthIndicators,
    MeterRegistry registry, PlatformTag platformTag) {
    healthIndicator = new CompositeHealthIndicator(healthAggregator);
    healthIndicators.forEach(h -> {
        registry.gauge("health." + h.getClass().getSimpleName().replace("HealthIndicator", "").toLowerCase(),
            platformTag.getTags(), h, HealthMetricsConfiguration::getStatusCode);
        healthIndicator.addHealthIndicator(h.toString(), h);
    });
    registry.gauge("health", platformTag.getTags(), healthIndicator, HealthMetricsConfiguration::getStatusCode);
}
 
Example #5
Source File: DbCountAutoConfiguration.java    From Spring-Boot-2.0-Cookbook-Second-Edition with MIT License 5 votes vote down vote up
@Bean
public HealthIndicator dbCountHealthIndicator(Collection<CrudRepository> repositories) {
    CompositeHealthIndicator compositeHealthIndicator = new CompositeHealthIndicator(healthAggregator);
    for (CrudRepository repository : repositories) {
        String name = DbCountRunner.getRepositoryName(repository.getClass());
        compositeHealthIndicator.addHealthIndicator(name, new DbCountHealthIndicator(repository));
    }
    return compositeHealthIndicator;
}
 
Example #6
Source File: DbCountAutoConfiguration.java    From Spring-Boot-2.0-Cookbook-Second-Edition with MIT License 5 votes vote down vote up
@Bean
public HealthIndicator dbCountHealthIndicator(Collection<CrudRepository> repositories) {
    CompositeHealthIndicator compositeHealthIndicator = new CompositeHealthIndicator(healthAggregator);
    for (CrudRepository repository : repositories) {
        String name = DbCountRunner.getRepositoryName(repository.getClass());
        compositeHealthIndicator.addHealthIndicator(name, new DbCountHealthIndicator(repository));
    }
    return compositeHealthIndicator;
}
 
Example #7
Source File: DbCountAutoConfiguration.java    From Spring-Boot-2.0-Cookbook-Second-Edition with MIT License 5 votes vote down vote up
@Bean
public HealthIndicator dbCountHealthIndicator(Collection<CrudRepository> repositories) {
    CompositeHealthIndicator compositeHealthIndicator = new CompositeHealthIndicator(healthAggregator);
    for (CrudRepository repository : repositories) {
        String name = DbCountRunner.getRepositoryName(repository.getClass());
        compositeHealthIndicator.addHealthIndicator(name, new DbCountHealthIndicator(repository));
    }
    return compositeHealthIndicator;
}
 
Example #8
Source File: BootHealthCheckHandler.java    From kork with Apache License 2.0 5 votes vote down vote up
public BootHealthCheckHandler(
    ApplicationInfoManager applicationInfoManager,
    HealthAggregator aggregator,
    Map<String, HealthIndicator> healthIndicators) {
  this.applicationInfoManager =
      Objects.requireNonNull(applicationInfoManager, "applicationInfoManager");
  this.aggregateHealth = new CompositeHealthIndicator(aggregator, healthIndicators);
}