zoukankan      html  css  js  c++  java
  • SpringCloud:Hystrix dashboard流监控

    基于Hystrix的dashboard流监控

    目的:web端可视化监控微服务架构中各服务的访问量,和各服务的健康程度

    注意:该服务要启用熔断@EnableCircuitBreaker,并且只能监控有熔断注解@HystrixCommand的方法!

    流监控首页

    绑定一个服务后的监控

    主要监控当前服务的健康程度,及访问量

     图解

     配置dashboard

    一,新建一个dashboard流监控服务
    导入相关依赖

            <!--hystrix-->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-hystrix</artifactId>
                <version>1.4.6.RELEASE</version>
            </dependency>
            <!--dashboard流监控-->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
                <version>1.4.6.RELEASE</version>
            </dependency>
    View Code

    该服务仅需配置serverport和在主启动类开启流监控注解

    server.port:9001

    @EnableHystrixDashboard //开启流监控

    二,给具有hystrix熔断的服务配置

    导入相关依赖

            <!--完善eureka监控信息,属于hystrix-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-actuator</artifactId>
            </dependency>
    View Code

    增加一个servlet

    @SpringBootApplication
    @EnableDiscoveryClient //服务发现,企业级协同开发
    @EnableEurekaClient  //开启eureka客户端,在服务启动后自动注册到指定的EurekaServer中
    @EnableCircuitBreaker //开启断路器,属于hystrix的包
    public class HystrixDeptProvider_8001 {
        public static void main(String[] args) {
            SpringApplication.run(HystrixDeptProvider_8001.class,args);
        }
    
    
        //增加一个Servlet
        @Bean
        public ServletRegistrationBean hystrixMetricsStreamServlet(){
            ServletRegistrationBean bean = new ServletRegistrationBean(new HystrixMetricsStreamServlet());
            bean.addUrlMappings("/actuator/hystrix.stream");
            return bean;
    
        }
    }

    注意:dashboard服务要启用熔断@EnableCircuitBreaker,并且只能监控有熔断注解@HystrixCommand的方法!

  • 相关阅读:
    bzoj3401[Usaco2009 Mar]Look Up 仰望*
    bzoj2021[Usaco2010 Jan]Cheese Towers*
    bzoj3767A+B Problem加强版
    bzoj3942[Usaco2015 Feb]Censoring*
    bzoj1673[Usaco2005 Dec]Scales 天平*
    bzoj3670[Noi2014]动物园
    stark——pop功能(admin中添加功能)
    stark——快速过滤list_filter
    stark——分页、search、actions
    stark——增删改页面
  • 原文地址:https://www.cnblogs.com/CL-King/p/14344305.html
Copyright © 2011-2022 走看看