HystrixDashboard图表化hystrix/turbine.stream问题探索

温疫流行,家中休息期间,再次进行微服务分布架构,HystrixDashboard图表化hystrix/turbine.stream,大部分情况不能获取数据,指示Unable to connect to Command Metric Stream

之前,调试通过的。spring boot版本2.2.4。于是按惯例为加入HystrixMetricsStream的Servlet

    @Bean
    public ServletRegistrationBean<HystrixMetricsStreamServlet> getServlet() {
         HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
         ServletRegistrationBean<HystrixMetricsStreamServlet> registrationBean = new ServletRegistrationBean<HystrixMetricsStreamServlet>(streamServlet);
         registrationBean.setLoadOnStartup(1);
         registrationBean.addUrlMappings("/actuator/hystrix.stream");
         registrationBean.setName("HystrixMetricsStreamServlet");
         return registrationBean;
    }

依然无效。

相关服务已经经过调用,不存在没有操控而一直loading的状态:

此时控制台显示:

浏览器调试页面指示:

问题点:EventSource's response has a MIME type ("text/plain") that is not "text/event-stream". Aborting the connection.

查阅HystrixDashboard的jar包的页面模板文件,它采用了HTML5的EventSource服务端推送机制实现数据刷新:

反汇编源码的纠结点处:

于是在MIME类型变换"text/plain"到"text/event-stream"上多次设法修正,依然无果。

深入查阅HystrixMetricsStreamServlet相关的源码HystrixSamlpleSseServlet:

也没有发现有不合适的操作。

疫情缓解,复工上班,将框架源码带回台式机试验,竞完全可以运行起来,而且不考虑所说的HystrixMetricsStream的Servlet,也没有问题:

在笔记本电脑上依然不可以运行。差别:笔记本电脑的开发环境版本相对高些,不应该是这个原因吧,进一步探索中...

发布了15 篇原创文章 · 获赞 0 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/u010941124/article/details/104392005
今日推荐