Hystrix仪表盘监控单实例节点

一 介绍

Hystrix DashBoard监控单实例节点需要访问实例的/hystrix.stream接口来实现。

二 项目架构

项目的实现部分见红色框起来的部分。

三 实战步骤

1 在服务实例的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-hystrix</artifactId>
</dependency>

2 在项目的启动类上加上注解@EnableCircuitBreaker,开启断路器功能

package com.didispace;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@EnableCircuitBreaker
@EnableDiscoveryClient
@SpringBootApplication
public class ConsumerApplication {

    @Bean
    @LoadBalanced
    RestTemplate restTemplate() {
        return new RestTemplate();
    }
    public static void main(String[] args) {
        SpringApplication.run(ConsumerApplication.class, args);
    }

}

3 启动项目

4 在Hystrix Dashboard的首页输入:http://localhost:9000/hystrix.stream,可以看到已启动实例的监控。

四 hystrix-Dashboard面板说明

1 页面中的Delay

该参数用来控制服务器上轮询监控信息的延迟时间,默认为2000毫秒,可通过配置该属性来降低客户端的网络和CPU消耗。

2 页面中Title

该参数对应了头部标题Hystrix Stream之后的内容,默认会使用具体监控实例的URL。

3 实心圆

通过颜色的变化反映实例的健康程序,它的健康度从绿色、黄色、橙色、红色递减。通过大小反映了请求流量的变化,流量越大,实心圆越大。

4 曲线

用来记录2分钟内容流量的相对变化,通过它来观察流量上升和下降的趋势。

5 其他指标

见图例的说明。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值