提交 e84c3b59 编写于 作者: Q qinyingjie

fix:加入dashboard

上级 52c11347
......@@ -35,6 +35,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
</dependencies>
......
......@@ -4,12 +4,13 @@ package com.kwan.springcloud;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
/**
*
* http://localhost:9909/hystrix
*@version : 2.2.0
*@author : qinyingjie
*@date : 2023/1/14 15:33
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/1/14 15:33
*/
@EnableHystrixDashboard
@SpringBootApplication
......@@ -19,4 +20,5 @@ public class HystrixDashboardApplication {
SpringApplication.run(HystrixDashboardApplication.class, args);
}
}
......@@ -5,3 +5,7 @@ server:
spring:
application:
name: hystrix-dashboard-service #服务名称
hystrix:
dashboard:
proxy-stream-allow-list: "localhost"
\ No newline at end of file
......@@ -34,10 +34,13 @@
<artifactId>spring-cloud-openfeign-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
<version>1.4.7.RELEASE</version>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
</dependencies>
......
package com.kwan.springcloud;
import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
/**
*
* http://localhost:8080/portal/hystrix/1
......@@ -23,4 +27,14 @@ public class PortalApplication {
SpringApplication.run(PortalApplication.class, args);
}
@Bean
public ServletRegistrationBean getServlet() {
HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
registrationBean.setLoadOnStartup(1);
registrationBean.addUrlMappings("/hystrix.stream");
registrationBean.setName("HystrixMetricsStreamServlet");
return registrationBean;
}
}
......@@ -32,3 +32,10 @@ ribbon:
client:
enabled: true #开启ribbon超时管理
ConnectTimeout: 2000 #连接超时时间
management:
endpoints:
web:
exposure:
include: "*"
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册