Unable to connect to Command Metric Stream 'api/turbine/stream?cluster=REPORTS' Error: {"isTrusted"}

Spring  Boot Admin 整合Hystrix UI Module,Turbine UI Module.

报如下错误: 

​首先确保你的admin-server引入了一下的依赖:

<!--引入hystrix -->
		<dependency>
			<groupId>de.codecentric</groupId>
			<artifactId>spring-boot-admin-server-ui-hystrix</artifactId>
			<version>1.5.7</version>
		</dependency>
		<!--引入turbine  -->
		<dependency>
			<groupId>de.codecentric</groupId>
			<artifactId>spring-boot-admin-server-ui-turbine</artifactId>
			<version>1.5.7</version>
		</dependency>

application.propertes添加如下配置:

spring.boot.admin.routes.endpoints=env,metrics,dump,jolokia,info,configprops,trace,logfile,refresh,flyway,liquibase,heapdump,loggers,auditevents,hystrix.stream
spring.boot.admin.turbine.clusters=default
#turbine服务id,turbine服务可以作为单独的服务
#Turbine服务器的ServiceId或URL(不包含/turbine.stream)。 必须可以从管理服务器访问。

spring.boot.admin.turbine.location=hystrix-dashboard-turbine

对于spring.boot.admin.turbine.location 的配置默认为‘turbine’服务。  Turbine服务器配置可以是serviceId或者是URL(具体可以参考官方文档)

上面的hystrix-dashboard-turbine是我turbine服务器的servceId.具体不懂可参考https://blog.csdn.net/niugang0920/article/details/80107804

其实底层是用Hystrix进行实施监控的。HystrixCommand和HystrixObservableCommand在执行时,会生成执行结果和运行指标,比如每秒执行的请求数、成功等。

其实就是对方法上的@HystrixCommand进行监控。

上述配置正确就ok了。

微信公众号

                          
原文地址:https://www.cnblogs.com/niugang0920/p/12187250.html