初次使用Hystrix Dashboard(豪猪哥图像化界面)出现以下提示 莫慌,打开控制台看下什么原因
Origin parameter: http://localhost:8989/hystrix.stream is not in the allowed list of proxy host names. If it should be allowed add it to hystrix.dashboard.proxyStreamAllowList
当出现上述原因,尝试在两个地方做修改: 1.修改对应的Hystrix Dashboard工程中的配置文件,加入以下配置
hystrix.dashboard.proxy-stream-allow-list=localhost
2.在被监控工程的主启动类中加入以下配置
@Bean
public ServletRegistrationBean getServlet()
{
HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
registrationBean.setLoadOnStartup(1);
registrationBean.addUrlMappings("/hystrix.stream");
registrationBean.setName("HystrixMetricsStreamServlet");
return registrationBean;
}
上述工作做完再打开豪猪哥图形化界面 紧接着浏览器输入测试地址,监测成功
ps:SpringBoot为2.3版本,SpringCloud版本为Hoxton.SR8,监测工程和被监控工程pom文件中都必须添加以下依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
以上为个人学习中遇到的问题及解决
|