【问题标题】:spring-cloud/spring-cloud-netflix, setting the hystrix origin idspring-cloud/spring-cloud-netflix,设置 hystrix origin id
【发布时间】:2016-03-31 02:37:19
【问题描述】:

我正在使用 spring-cloud-samples/customer-stores 示例并按照描述的方式工作(特别是使用 1.1.0-BUILD-SNAPSHOT)

似乎当事物流向 hystrix 时,它会附加一个源对象,如下所示:

"origin": {
  "host": "192.168.60.100",
  "port": 9000,
  "serviceId": "customers",
  "id": "customers:mysql:9000"
}

具体来说,“id”似乎是从serviceId:spring.profiles.active:server.port创建的

当你有几个不同的组合可以使用时,这很好用,但是,当我在不同的 ips 上使用相同的server.port 运行多个服务,或者正在运行多个具有相同 @987654326 的 docker 容器时@,涡轮聚合变得乱码并且毫无意义,因为数据正在自己写。

我想知道 Spring 中是否有一种特定的方式可以在我们的设置中专门影响该 id 的值。

【问题讨论】:

  • 所以...看起来这是在 org.springframework.cloud.netflix.hystrix.stream.HystrixStreamTask 类中确定的。在对addServiceData() 的调用中,它使用Autowired ApplicationContext 并执行getId()。现在的问题似乎是 - 我们可以修改 SpringBoot 使用的 ApplicationContext id 吗?

标签: java spring spring-cloud hystrix turbine


【解决方案1】:

只需按照@spencergibb 在 github 上的帖子中所述设置hystrix.stream.queue.send-id=falsehttps://github.com/spring-cloud/spring-cloud-netflix/issues/740 即可解决问题。

【讨论】:

    猜你喜欢
    • 2015-08-31
    • 2016-06-18
    • 1970-01-01
    • 2015-05-31
    • 2018-07-21
    • 2017-07-08
    • 2021-06-21
    • 2016-12-08
    • 2018-07-18
    相关资源
    最近更新 更多