- 2023-09-19 10:58:00
- 1354 热度
- 0 评论
之前在spring for all社区看到这样一个问题:当actuator端点设置了context-path之后,turbine如何聚合数据?首先,我们要知道actuator端点设置了context-path是什么意思?也就是说,此时spring boot actuator的端点都有了一个前缀,比如:
management.context-path=/xxx |
如果设置了上面的参数,那个对于收集hystrix数据的端点将变为:/xxx/hystrix.stream
,如果我们还是拿上一篇Spring Cloud构建微服务架构:Hystrix监控数据聚合【Dalston版】中构建你的turbine应用,那么将会看到如下错误:
INFO 7812 --- [ Timer-0] c.n.t.monitor.instance.InstanceMonitor : Url for host: http://172.15.0.18:9020/hystrix.stream default |
从上述错误中我们可以知道,turbine在收集的时候由于访问的是/hystrix.stream
,而此时收集端点却是/xxx/hystrix.stream
,所以报了404错误。
那么我们要如何解决呢?通过之前的配置内容,我们可能找不到相关的配置信息,所以只能遍历一下源码,最后找到这个类:org.springframework.cloud.netflix.turbine.SpringClusterMonitor
。它的具体内容如下:
public static InstanceUrlClosure ClusterConfigBasedUrlClosure = new InstanceUrlClosure() { |
从上述源码中,我们可以找到这个参数turbine.instanceUrlSuffix
,由此该问题就迎刃而解了,我们只需要在turbine应用的配置文件中增加如下配置信息,就能正确的收集之前配置了management.context-path=/xxx
的微服务的hystrix数据了。
turbine.instanceUrlSuffix=/xxx/hystrix.stream |
相关阅读
- Spring Cloud构建微服务架构:服务注册与发现(Eureka、Consul)
- Spring Cloud构建微服务架构:服务消费者(基础)
- Spring Cloud构建微服务架构:服务消费者(Ribbon)
- Spring Cloud构建微服务架构:服务消费者(Feign)
- Spring Cloud构建微服务架构:分布式配置中心
- Spring Cloud构建微服务架构:服务容错保护(hystrix服务降级)
- Spring Cloud构建微服务架构:服务容错保护(hystrix依赖隔离)
- Spring Cloud构建微服务架构:服务容错保护(hystrix断路器)
- Spring Cloud构建微服务架构:Hystrix监控面板
- Spring Cloud构建微服务架构:Hystrix监控数据聚合
- 更多Spring Cloud内容…
0 评论
留下评论
热门标签
- Spring(403)
- Boot(208)
- Spring Boot(187)
- Spring Cloud(82)
- Java(82)
- Cloud(82)
- Security(60)
- Spring Security(54)
- Boot2(51)
- Spring Boot2(51)
- Redis(31)
- SQL(29)
- Mysql(25)
- IDE(24)
- Dalston(24)
- MVC(22)
- JDBC(22)
- IDEA(22)
- mongoDB(22)
- Web(21)
- CLI(20)
- SpringMVC(19)
- Alibaba(19)
- Docker(17)
- SpringBoot(17)
- Git(16)
- Eclipse(16)
- Vue(16)
- ORA(15)
- JPA(15)
- Apache(15)
- Tomcat(14)
- Linux(14)
- HTTP(14)
- Mybatis(14)
- Oracle(14)
- jdk(14)
- Pro(13)
- XML(13)
- JdbcTemplate(13)
- OAuth(13)
- Nacos(13)
- Data(12)
- JSON(12)
- OAuth2(12)
- Myeclipse(11)
- stream(11)
- int(11)
- not(10)
- Bug(10)
- Hystrix(9)
- ast(9)
- maven(9)
- Map(9)
- Swagger(8)
- APP(8)
- Bit(8)
- API(8)
- session(8)
- Window(8)
- HTML(7)
- Github(7)
- JavaMail(7)
- Cache(7)
- File(7)
- IntelliJ(7)
- mail(7)
- windows(7)
- too(7)
- ehcache(6)
- UDP(6)
- RabbitMQ(6)
- and(6)
- star(6)
- Excel(6)
- Log4J(6)
- pushlet(6)
- apt(6)
- read(6)
- Freemarker(6)
- WebFlux(6)
- JSP(6)
- Bean(6)
- error(6)
- nginx(6)
- Server(6)
- jar(6)
- ueditor(6)
- Sentinel(5)
- the(5)
- JWT(5)
- rdquo(5)
- PHP(5)
- Struts(5)
- string(5)
- script(5)
- Syntaxhighlighter(5)
- Tool(5)
- Controller(5)
- swagger2(5)