问题
I tried turbine + hystrix dashboard with Spring boot 2. But i get problem, turbine dashboard only shows :
Loading ...
I have working Eureka server and application (sends proper hystrix.stream)
When i look at turbine.stream its only
: ping
data: {"reportingHostsLast10Seconds":0,"name":"meta","type":"meta","timestamp":1533038381277}
I was looking in many questions but i cant get answer.
This is turbine pom file:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Finchley.RELEASE</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>com.netflix.archaius</groupId>
<artifactId>archaius-core</artifactId>
<version>0.7.1</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix-turbine</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>2.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
application.properties
server.port=9090
spring.application.name=turbine-dashboard
eureka.client.service-url.defaultZone=http://localhost:8761/eureka
turbine.app-config=RANDOMNUMBERSERVICE
app
@SpringBootApplication
@EnableDiscoveryClient
@EnableTurbine
@EnableHystrixDashboard
public class TurbineTestApplication {
public static void main(String[] args) {
SpringApplication.run(TurbineTestApplication.class, args);
}
}
回答1:
@janusz Please attach a screenshot of your dashboard for more clarity.
If you're seeing this on your screen:
It could mean:
- You need to hit the endpoint that contains the
@HystrixCommand
annotated function (in your case I'm assuming it isRANDOMNUMBERSERVICE
app's endpoint) in order to create data for the dashboard to display. - You have no running instance of serviceId
RANDOMNUMBERSERVICE
- Check if your clusters are correctly configured: http://localhost:9090/clusters should NOT return
[]
on your browser.
If you're seeing this on your screen:
- Check if your clusters are correctly configured: http://localhost:9090/clusters should NOT return
[]
on your browser. Normally this issue is due to inability to access /hystrix.steam from the configured instances but you have stated that that you are already receiving the stream.
I'd suggest using the below in your application.properties
file could recify this:
turbine.appConfig = randomnumberservice
turbine.aggregator.clusterConfig = RANDOMNUMBERSERVICE
Finally, make sure the URL you're entering for turbine enabled dahboard is pointing to the port that your dashboard is on. in your case it should be:
http://localhost:9090/turbine.stream?cluster=yourclustername
来源:https://stackoverflow.com/questions/51615494/spring-boot-turbine