SpringCloud------断路器Dashboard监控仪表盘
Posted 玉天恒
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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/actuator/hystrix.stream (可直接访问,会采集接口的信息)(SSE:server-send-event推送信息到前端)
1)
2)
另附:
图中属性解释
以上是关于SpringCloud------断路器Dashboard监控仪表盘的主要内容,如果未能解决你的问题,请参考以下文章
SpringCloud学习系列之三----- 断路器Hystrix和断路器监控Dashboar
企业级 SpringCloud 教程 断路器(Hystrix)