Spring Cloud Turbine AMQP 不适用于 Hystrix 仪表板

Posted

技术标签:

【中文标题】Spring Cloud Turbine AMQP 不适用于 Hystrix 仪表板【英文标题】:Spring Cloud Turbine AMQP doesn't working with Hystrix Dashboard 【发布时间】:2018-07-07 07:21:02 【问题描述】:

我正在尝试设置 spring 云涡轮 amqp 和 hystrix 仪表板。但是当我启动所有应用程序时,hystrix 仪表板没有显示任何内容: hystrix-dashboard-screenshot-link

但是当我打开涡轮流链接时,我看到的不是空数据: turbine-stream-data-screenshot-link

当我停止涡轮机服务并运行示例时:https://github.com/spring-cloud-samples/turbine

它正在工作: working-hystrix-dashboard-screenshot-link

所以,问题出在我的涡轮机服务上。 这是 TurbineApplication.java:

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.turbine.stream.EnableTurbineStream;

@EnableTurbineStream
@SpringBootApplication
public class TurbineApplication 
    public static void main(String[] args) 
        SpringApplication.run(TurbineApplication.class, args);
    

这是application.yml:

server:
  port: $PORT:8989

eureka:
  user:
    name: "cipher6c627b546202f13ffa9e3edf39974a3bfca5d615f58dcbfc23065661968b13c5"
    password: "cipher75efd89c7c4d79220a5b3f35e9ad692a69c820fa0b99e9c48ae9433d45ba016db808ab9dce78382235e529291f8aa0be"
  instance:
    preferIpAddress: true
  client:
    registerWithEureka: true
    fetchRegistry: true
    serviceUrl:
      defaultZone: http://$eureka.user.name:$eureka.user.password@127.0.0.1:8761/eureka/

这是 bootstrap.yml:

spring:
  application:
    name: turbine-service

这是 gradle.build:

buildscript 
    ext 
        springBootVersion = '1.5.9.RELEASE'
        dockerPluginVersion = '1.2'
    
    repositories 
        mavenCentral()
    
    dependencies 
        classpath("org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion")
        classpath("se.transmode.gradle:gradle-docker:$dockerPluginVersion")
    


apply plugin: 'java'
apply plugin: 'docker'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'

group = 'com.pda'

jar 
    baseName = 'turbine-service'
    version = 'latest'


sourceCompatibility = 1.8

repositories 
    mavenCentral()



ext 
    springCloudVersion = 'Edgware.RELEASE'


dependencies 
    compile('org.springframework.boot:spring-boot-starter-actuator')
    compile('org.springframework.boot:spring-boot-starter-web')

    compile('org.springframework.cloud:spring-cloud-starter-turbine-stream')
    compile('org.springframework.cloud:spring-cloud-starter-stream-rabbit')



dependencyManagement 
    imports 
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:$springCloudVersion"
    


eclipse 
    classpath 
        containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
        containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
    


task buildDocker(type: Docker, dependsOn: build) 
    push = false
    applicationName = jar.baseName
    dockerfile = file('src/main/docker/Dockerfile')
    doFirst 
        copy 
            from jar
            into stageDir
        
    

看来问题出在依赖版本上。

【问题讨论】:

【参考方案1】:

问题出在 Edgware.RELEASE(和 Edgware.SR1)版本中。需要降级spring cloud的版本(比如降级到Dalston.SR5),或者使用Edgware.BUILD-SNAPSHOT。

描述:https://github.com/spring-cloud/spring-cloud-netflix/issues/2637

【讨论】:

以上是关于Spring Cloud Turbine AMQP 不适用于 Hystrix 仪表板的主要内容,如果未能解决你的问题,请参考以下文章

spring cloud:Turbine的应用

spring cloud:hystrix-dashboard-turbine

Spring Cloud Turbine

Spring Cloud Turbine 空流

spring cloud 熔断面板 聚合熔断 turbine

hystrix.stream、management.port 和 Spring Cloud Turbine