`
raymond.chen
  • 浏览: 1446364 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

Hystrix DashBoard监控面板

 
阅读更多

Hystrix-dashboard是一款针对Hystrix进行实时监控的工具,提供了数据监控和友好的图形化界面。通过Hystrix Dashboard可以直观地看到Hystrix的各项指标信息。通过Hystrix Dashboard反馈的实时信息,可以帮助我们快速发现系统中存在的问题。

 

Spring Cloud Hystrix Dashboard的底层原理是间隔一定时间去“Ping”目标服务,返回的结果是最新的监控数据,最后将数据显示出来。

 

Hystrix Dashboard监控单实例节点需要通过访问实例的/hystrix.stream端点来实现的,所以需要为服务实例添加这个端点。

 

 

 

为服务消费者工程添加/hystrix.stream端点

    在pom.xml文件添加以下依赖:

<dependency>
	<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>

 

 

    在启动类定义 ServletRegistrationBean 对象,配置hystix.stream端点

/**
 * SpringBoot2+版本需要手动配置hystrix.stream端点
 */
@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;
}

 

 

    在浏览器访问hystix.stream端点,查看监控的指标信息

             http://localhost:9003/hystrix.stream


 

 

 

创建Hystrix DashBoard监控工程

    pom.xml文件关键配置:

<parent>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-parent</artifactId>
	<version>2.0.7.RELEASE</version>
	<relativePath/>
</parent>

<properties>
	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
	<java.version>1.8</java.version>
</properties>

<dependencies>
	<dependency>
	   <groupId>org.springframework.cloud</groupId>
	   <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
	</dependency>
	<dependency>
		<groupId>org.springframework.cloud</groupId>
		<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
	</dependency>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-actuator</artifactId>
	</dependency>
</dependencies>

<dependencyManagement>
	<dependencies>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-dependencies</artifactId>
			<version>Finchley.RELEASE</version>
			<type>pom</type>
			<scope>import</scope>
		</dependency>
	</dependencies>
</dependencyManagement>

 

    启动类

    添加@EnableHystrixDashboard注解

@SpringBootApplication
@EnableHystrixDashboard //启用Hystrix Dashboard功能
public class Main {
	public static void main(String[] args) {
		SpringApplication.run(Main.class, args);
	}
}

 

    application.properties文件的配置

spring.application.name=hystrix-dashboard
server.port=6001

 

    运行该工程,在浏览器访问 http://localhost:6001/hystrix ,即可看到Hystrix Dashboard主界面


 

在主界面上输入一个服务消费者的hystix.stream端点地址,点击“Monitor Stream”按钮进行实时监控。仅使用Hystrix Dashboard只能监控到单个断路器的状态


 

监控页面详细说明如下图所示:


 

  • 大小: 270.9 KB
  • 大小: 49.6 KB
  • 大小: 45.3 KB
  • 大小: 30.7 KB
分享到:
评论

相关推荐

    SpringCloud -Hystrix监控面板及数据聚合(Turbine)介绍与使用示例

    Hystrix Dashboard 和 Turbine 是配套的监控工具,帮助开发者实时监控服务的运行状态,确保系统的稳定性和高可用性。下面将详细介绍这两个工具的功能、使用方法以及集成步骤。 **Hystrix Dashboard** Hystrix ...

    微服务系统和数据库设计方案.docx

    Eureka、负载均衡、路由配置 ZUUL 网关、 feign 调用、断路器 hystrix、监控功能、SpringCloud Config 进行统一的配置管理、Hystrix 监控和断路器功能、Hystrix Dashboard 监控面板、Turbine 监控聚合等。...

    基于SringCloud微服务系统设计方案.docx

    (7)Hystrix Dashboard:监控面板,他提供了一个界面,可以监控各个服务上的服务调用所消耗的时间等。 (8)Turbine:监控聚合,使用Hystrix监控,我们需要打开每一个服务实例的监控信息来查看。而Turbine可以帮助...

    微服务架构和SpringCloud专题培训课件.ppt

    * Hystrix Dashboard:监控面板,他提供了一个界面,可以监控各个服务上的服务调用所消耗的时间等。 * Hystrix Turbine:监控聚合,使用Hystrix监控,我们需要打开每一个服务实例的监控信息来查看。而Turbine可以...

    spring-cloud.zip

    同时,还需要正确地引入依赖并编写相应的代码,例如使用 @EnableEurekaServer 注解启动 Eureka 服务器,使用 @FeignClient 注解声明服务消费者,使用 @HystrixDashboard 和 @EnableCircuitBreaker 注解启动 Hystrix ...

    微服务架构与PPT学习教案.pptx

    Hystrix Dashboard 是一个监控面板,他提供了一个界面,可以监控各个服务上的服务调用所消耗的时间等。Hystrix Turbine 是一个监控聚合,使用 Hystrix 监控,我们需要打开每一个服务实例的监控信息来查看。而 ...

    Spring Cloud Netflix架构浅析(小结)

    `@SpringBootApplication`表明这是一个Spring Boot应用,`@EnableEurekaServer`启动Eureka Server,`@EnableHystrixDashboard`开启Hystrix监控面板。对应的Maven依赖也需要添加,如`spring-cloud-starter-eureka-...

    springcloud.zip

    - `springcloud-dashboard`:可能实现了SpringCloud的监控面板,如Hystrix Dashboard或Spring Cloud Admin。 - `.idea`:IDEA的项目元数据,不直接参与代码运行。 - `springcloud-8081-consumer`:服务消费者,用于...

    weshop-微信小程序应用商城

    ├── weshop-hystrix-dashboard -- 断路器监控面板[端口:1301] ├── weshop-example -- 项目示例工程 | ├── weshop-example-api -- 远程服务api接口 | ├── weshop-example-provider -- 服务提供方[端口:...

Global site tag (gtag.js) - Google Analytics