zoukankan      html  css  js  c++  java
  • Hystrix Dashboard 配置及图形化监控

    除了隔离依赖服务的电泳以外, Hystrix还提供了准时的调用监控(Hystrix Dashboard), Hystrix会持续地记录所有通过Hystrix发起的请求的执行信息, 并以统计报表和图形的形式展示给用户, 包括每秒执行多少请求多少成功,多少失败等. Netflix通过 hystrix-metrics-event-stream项目实现了对以上指标的监控.SpringCloud 也提供了Hystrix Dashboard的整合, 对监控内容转化成可视化界面.

    配置

    相关依赖

     <dependencies>
    
            <!-- hystrix dashboard 图形化监控依赖 -->
            <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>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-devtools</artifactId>
                <scope>runtime</scope>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
        </dependencies>
    
    

    主启动类 再加上 @EnableHystrixDashboard 开启dashboard监控

    相关依赖

    每个被监控的服务都要有豪猪 hystrix 并且主启动类开启 @EnableCircuitBreaker 熔断

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

    另外!

    由于springcloud 升级的坑 --- SerlvetRegistrationBean 因为 springboot 的默认路径不是 "/hystrix.stream" 需要在被监控的项目的主启动类中配置一下下面的servlet

        @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;
        }
    

    说明图

    请求频率为 服务请求频率

    百分位延迟统计为 最后一分钟的百分位延迟统计

  • 相关阅读:
    路飞-课程表分析
    路飞-注册登录前台
    路飞-注册登录后台
    路飞-接口缓存
    路飞-celery框架
    路飞-Redis的使用,登录注册接口
    路飞-注册页面
    DRF ---- JWT
    DRF ---- 三大认证 认证/权限/频率 自定义
    DRF ---- 视图类 数据工具类 工具视图集 视图集
  • 原文地址:https://www.cnblogs.com/nineberg/p/12655861.html
Copyright © 2011-2022 走看看