SpringCloud------断路器Dashboard监控仪表盘

前提:

配置了熔断或者Feign降级的接口才会显示在仪表盘

参考:

https://www.cnblogs.com/tianhengblogs/p/12487495.html

断路器原理:

1.添加依赖

<!-- 仪表盘监控 -->
<dependency>
  <groupId>org.springframework.cloud</groupId>
  <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
</dependency>
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

2.添加启动类注解@EnableHystrixDashboard

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.cloud.openfeign.EnableFeignClients;

@SpringBootApplication
@MapperScan("cn.ytheng.order_service")
@EnableFeignClients
@EnableCircuitBreaker
@EnableHystrixDashboard
public class OrderServiceApplication {


    public static void main(String[] args) {

        SpringApplication.run(OrderServiceApplication.class, args);
    }

}

3.修改application.yml配置


server:
port: 8781

#暴露全部的监控信息 management: endpoints: web: exposure: include:
"*"

4.访问地址

http://localhost:8781/hystrix

http://localhost:8781/actuator/hystrix.stream  (可直接访问,会采集接口的信息)(SSE:server-send-event推送信息到前端)

1)

 2)

另附:

图中属性解释

原文地址:https://www.cnblogs.com/tianhengblogs/p/12491845.html