我是靠谱客的博主 英勇蚂蚁,这篇文章主要介绍turbine聚合监控:监控服务间调用和监控熔断,现在分享给大家,希望可以做个参考。

HystrixDashboard 主要的功能是可以针对于某一项微服务进行监控,但是如果说现在有许多的微服务需要进行整体的监控,那 么这种情况下就可以利用 turbine 技术来实现。

com.netflix.turbine.monitor.instance.InstanceMonitor$MisconfiguredHostException: [{"timestamp":"2019-08-27T06:12:01.654+0000","status":401,"error":"Unauthorized","message":"Unauthorized","path":"/actuator/hystrix.stream"}]

解决方案:

复制代码
1
2
3
4
5
6
7
8
9
@EnableWebSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Override public void configure(WebSecurity web) { // turbine web.ignoring().antMatchers("/actuator/hystrix.stream", "/turbine.stream"); }

一直loading:

最后是这个,实际中发现无论怎么访问接口,就是没监控数据,后台测试发现,你所访问的接口必须要有熔断,即普通方法要有fallback:

一直loading解决方案

注意!!! 必须在provider的controller方法上注解@HystrixCommand, 才能被监测到, 否则检测不到, 啥都不显示

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
@GetMapping(value = "/dept/get/{id}") @HystrixCommand(fallbackMethod = "getFallback") // 如果当前调用的get()方法出现了错误,则执行fallback public Object get(@PathVariable("id") long id) { Dept dept = this.deptService.get(id); if (dept == null) {// 数据不存在,假设让它抛出个错误 throw new RuntimeException("部门信息不存在!"); } return dept; } public Object getFallback(@PathVariable("id") long id) { // 此时方法的参数 与get()一致 Dept vo = new Dept() ; vo.setDeptno(999999L); vo.setDname("【ERROR】Microcloud-Dept-Hystrix"); // 错误的提示 vo.setLoc("DEPT-Provider"); return vo ; }

最后

以上就是英勇蚂蚁最近收集整理的关于turbine聚合监控:监控服务间调用和监控熔断的全部内容,更多相关turbine聚合监控内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(74)

评论列表共有 0 条评论

立即
投稿
返回
顶部