zoukankan      html  css  js  c++  java
  • Hystrix dashboard - Unable to connect to Command Metric Stream.

    在使用boot 2.0.*以上版本 + cloud Finchley.RELEASE

    查看仪表盘的时候会报错

    Unable to connect to Command Metric Stream

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

    解决方案:

      
    在项目中添加配置注意红色部分

    package com.amber.config;
    
    import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
    import org.springframework.boot.web.servlet.ServletRegistrationBean;
    import org.springframework.context.annotation.Bean;
    import org.springframework.context.annotation.Configuration;
    
    @Configuration
    public class HystrixConfig {
    
        @Bean
        public ServletRegistrationBean getServlet(){
            HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
            ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
            registrationBean.setLoadOnStartup(1);
            registrationBean.addUrlMappings("/actuator/hystrix.stream");
            registrationBean.setName("HystrixMetricsStreamServlet");
            return registrationBean;
        }
    }                                                                                                     

    然后就成功了

  • 相关阅读:
    CSS练习
    关于进度模型和进度计划
    信息管理系统/记录管理系统/配置管理系统
    分析技术在PMP中的应用
    渐进明细的几个点
    android手机内的通讯录数据库
    用FileExplorer查看android手机中的数据库
    VCard介绍
    org.apache.http.client.methods.HttpGet 转到定义找不到源代码
    Android : Your APK does not seem to be designed for tablets.
  • 原文地址:https://www.cnblogs.com/amberbar/p/10123892.html
Copyright © 2011-2022 走看看