zoukankan      html  css  js  c++  java
  • SpringCloud Hystrix 监控仪表盘

    在hystrix的回退方法中做好报警通知就可以了,Hystrix的监控仪表盘在实际开发中用得不多,此处只是作为了解。

    hystrix的监控可以检测消费者调用提供者的情况,hystrix是在消费者中设置的,hystrix的监控自然也是在消费者中设置的。

    actuator  服务调用监控

    1、在消费者中添加依赖:

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

    2、配置文件

    management:
      endpoints:
        web:
          exposure:
            include: "*"

    默认只会监控部分数据,此配置是监控服务调用所有的数据

    3、在浏览器地址栏输入 127.0.0.1:8781/actuator/hystrix.stream  ,ip、port都是消费者的

    刷新一下服务调用,已经监控到数据

    dashboard  仪表盘

    上面密密麻麻的数据不直观,Hystrix提供了仪表盘可以将数据直观地展示出来。

    可以在消费者中配置仪表盘,也可以单独写一个子模块作为仪表盘。

    1、创建时勾选Spring Cloud Circuit Breaker -> Hystrix DasdBoard [Maintenance]

    也可以手动加依赖

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

    如果是单独用一个服务来作为仪表盘,只加这个依赖即可,里面已经包含了spring-boot-start-web。

    2、引导类上加 @EnableHystrixDashboard

    单独使用一个服务作为仪表盘的话,不修改端口默认使用8080,根据需要修改端口

    3、浏览器地址栏输入 127.0.0.1:8080/hystrix , ip、port都是 dasdboard 所在应用的

    输入要监控的 actuator 的地址,dasdboard 启动时会在控制台打印出可监控的actuator地址。

  • 相关阅读:
    docker-排除故障
    python的标识符
    python的数据类型
    python的数与字符串
    场景法
    正交试验法
    错误推测法
    决策表法
    因果图法
    python基础--用python执行系统命令
  • 原文地址:https://www.cnblogs.com/chy18883701161/p/12810911.html
Copyright © 2011-2022 走看看