【问题标题】:How can Spring Boot Admin send custom notifications for actuator metric change?Spring Boot Admin 如何发送执行器指标更改的自定义通知?
【发布时间】:2019-06-06 10:29:32
【问题描述】:

Spring Boot Admin 仅针对应用程序的状态向上或向下提供通知功能。我想针对执行器端点中的某些指标更改发送电子邮件通知。你能指导我如何配置它吗?

应用程序 UP/DOWN 的简单通知

@Configuration
public class NotifierConfiguration {
    @Autowired
    private Notifier notifier;

    @Primary
    @Bean(initMethod = "start", destroyMethod = "stop")
    public RemindingNotifier remindingNotifier() {
        RemindingNotifier notifier = new RemindingNotifier(notifier,          repository);
        notifier.setReminderPeriod(Duration.ofMinutes(10)); 
        notifier.setCheckReminderInverval(Duration.ofSeconds(10)); 
        return notifier;
    }
}

这是用于应用程序的 UP?DOWN。我想在执行器端点的某些指标中进行配置

【问题讨论】:

    标签: spring-boot-admin


    【解决方案1】:

    我认为目前没有简单的方法可以做到这一点。

    通知由实现Notifier 接口的类发送。这些类使用InstanceEventFlux 来生成这些通知。当实例信息/状态执行器端点发生更改时,当实例注册/取消注册等时触发这些事件。要为执行器指标创建通知,因此您应该创建一个自定义 InstanceEvent(比如 InstanceMetricsChangedEvent) 每次实例指标执行器端点发生一些变化时。也许你可以看看InstanceInfoChangedEvent 是如何被触发的,看看是否可以用你的InstanceMetricsChangedEvent 做类似的事情。看看:InfoUpdaterInfoUpdateTrigger

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-12-31
      • 1970-01-01
      • 2018-11-29
      • 1970-01-01
      • 1970-01-01
      • 2015-07-04
      • 2019-03-10
      相关资源
      最近更新 更多