英文:
Hystrix dashboard always showing loading screen
问题
I have developed Micro service application using Netflix-OSS libraries. I am facing issue on Hystrix dashboard running on localhost:9091/hystrix. I want to monitor request metrics between Micro service-A and Micro service-B. Endpoint "hystrix.stream" is already registered.
hystrix dashboard stucks on loading without showing any results.
I inspected browser and found jquery error -
Uncaught TypeError: e.indexOf is not a function which seems to be a jquery version issue.
I am using Jdk 14 version and Spring boot 2.3 for my development
英文:
I have developed Micro service application using Netflix-OSS libraries. I am facing issue on Hystrix dashboard running on localhost:9091/hystrix. I want to monitor request metrics between Micro service-A and Micro service-B. Endpoint "hystrix.stream" is already registered.
hystrix dashboard stucks on loading without showing any results.
I inspected browser and found jquery error -
Uncaught TypeError: e.indexOf is not a function which seems to be a jquery version issue.
I am using Jdk 14 version and Spring boot 2.3 for my development
答案1
得分: 1
@bob0the0mighty
我正在为您提供代码片段供参考。这是我的Spring Boot主类:
@SpringBootApplication
@EnableEurekaClient
@EnableCircuitBreaker
@EnableHystrixDashboard
public class DramaServiceApplication {
}
我的控制器如下:
@GetMapping("/acts")
@com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand(fallbackMethod = "fallbackMethodForGetActor", commandKey = "test-Act", groupKey = "test-Act")
public ActorList getActors() {
    ActorList actorList = restTemplate.getForObject("http://actor-service/actor/actorsList", ActorList.class);
    return actorList;
}
public ActorList fallbackMethodForGetActor() {
    return new ActorList("请求的演员页面正在维护中!");
}
application.yml文件如下:
management:
  endpoints:
    web:
      base-path: /
      exposure:
        include: hystrix.stream, health, info, metrics
多次发送请求后,我始终得到Hystrix仪表板显示为“加载中”,并且屏幕看起来像这样:
[查看图像描述][1]
[1]: https://i.stack.imgur.com/hOeZf.png
英文:
            @bob0the0mighty
            I am adding code snippet for your reference. This is my springboot main class
            @SpringBootApplication
            @EnableEurekaClient
            @EnableCircuitBreaker
            @EnableHystrixDashboard
            public class DramaServiceApplication {
            }
        My controller looks like :
        @GetMapping("/acts")
        	@com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand(fallbackMethod = "fallbackMethodForGetActor", commandKey = "test-Act", groupKey = "test-Act")
        	public ActorList getActors() {
        		ActorList actorList = restTemplate.getForObject("http://actor-service/actor/actorsList", ActorList.class);
        		return actorList;
        	}
    public ActorList fallbackMethodForGetActor() {
    		return new ActorList(" Requested Actor page is under maintenance!!");
    	}
    
    application.yml file looks like :
            
    management:
      endpoints:
        web:
          base-path: /
          exposure:
            include: hystrix.stream, health, info, metrics
After hitting request multiple times, I am getting hystrix dashboard as "loading" always
and screen looks like 
[enter image description here][1]
            	
  [1]: https://i.stack.imgur.com/hOeZf.png
答案2
得分: 0
Updating the spring-cloud-dependencies version to "Hoxton.SR7" resolved the problem for me.
There is an issue with jquery 3.4.1 with spring-cloud-dependencies version "Hoxton.SR6".
You can get the details of the issue and the fix here.
https://github.com/spring-cloud/spring-cloud-netflix/issues/3811
https://github.com/spring-cloud/spring-cloud-netflix/pull/3817
英文:
Updating the spring-cloud-dependencies version to "Hoxton.SR7" resolved the problem for me.
There is an issue with jquery 3.4.1 with spring-cloud-dependencies version "Hoxton.SR6".
You can get the details of the issue and the fix here.
https://github.com/spring-cloud/spring-cloud-netflix/issues/3811
https://github.com/spring-cloud/spring-cloud-netflix/pull/3817
答案3
得分: 0
这个问题通过添加以下配置更改来解决:
- 在 pom.xml 中更新 Hoxton 到 SR7 版本:
 
<properties>
    <java.version>14</java.version>
    <spring-cloud.version>Hoxton.SR7</spring-cloud.version>
</properties>
- 在 application.yml 中添加以下条目:
 
hystrix:
  dashboard:
    proxy-stream-allow-list: '*'
management:
  endpoints:
    web:
      base-path: /
      exposure:
        include: '*'
- 创建一个单独的配置 Java 类:
 
package com.ibm.drama.controller;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
@Configuration
public class HystrixConfig {
    @Bean
    public ServletRegistrationBean<HystrixMetricsStreamServlet> getServlet() {
        HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
        ServletRegistrationBean<HystrixMetricsStreamServlet> registrationBean = new ServletRegistrationBean<HystrixMetricsStreamServlet>(streamServlet);
        registrationBean.setLoadOnStartup(1);
        registrationBean.addUrlMappings("/actuator/hystrix.stream");
        registrationBean.setName("hystrix.stream");
        return registrationBean;
    }
}
英文:
This issue got fixed by adding following configuration changes:
1. Updating Hoxton to SR7 in pom.xml:
   <properties>
		<java.version>14</java.version>
		<spring-cloud.version>Hoxton.SR7</spring-cloud.version>
	</properties>
2. Add these entries in application.yml:
hystrix:
  dashboard:
    proxy-stream-allow-list: '*'        
        
management:
  endpoints:
    web:
      base-path: /
      exposure:
        include: '*'
3. Creating a separate config Java class:
package com.ibm.drama.controller;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
@Configuration
public class HystrixConfig {
	@Bean
	public ServletRegistrationBean<HystrixMetricsStreamServlet> getServlet() {
		HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
		ServletRegistrationBean<HystrixMetricsStreamServlet> registrationBean = new ServletRegistrationBean<HystrixMetricsStreamServlet>(streamServlet);
		registrationBean.setLoadOnStartup(1);
		registrationBean.addUrlMappings("/actuator/hystrix.stream");
		registrationBean.setName("hystrix.stream");
		return registrationBean;
	}
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论