类org.springframework.boot.actuate.health.CompositeHealthIndicator源码实例Demo

下面列出了怎么用org.springframework.boot.actuate.health.CompositeHealthIndicator的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: sdmq   文件: HealthAutoConfiguration.java
@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;
}
 
源代码2 项目: kayenta   文件: PipelineController.java
@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;
}
 
源代码3 项目: mykit-delay   文件: HealthAutoConfiguration.java
@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;
}
 
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);
}
 
@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;
}
 
@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;
}
 
@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;
}
 
源代码8 项目: kork   文件: BootHealthCheckHandler.java
public BootHealthCheckHandler(
    ApplicationInfoManager applicationInfoManager,
    HealthAggregator aggregator,
    Map<String, HealthIndicator> healthIndicators) {
  this.applicationInfoManager =
      Objects.requireNonNull(applicationInfoManager, "applicationInfoManager");
  this.aggregateHealth = new CompositeHealthIndicator(aggregator, healthIndicators);
}
 
 类所在包
 类方法
 同包方法