zoukankan      html  css  js  c++  java
  • hystrix源码小贴士之Yammer Publisher

    HystrixYammerMetricsPublisher

      继承HystrixMetricsPublisher,创建HystrixYammerMetricsPublisherCommand、HystrixYammerMetricsPublisherThreadPool、HystrixYammerMetricsPublisherCollapser。

     @Override
        public HystrixMetricsPublisherCommand getMetricsPublisherForCommand(HystrixCommandKey commandKey, HystrixCommandGroupKey commandGroupKey, HystrixCommandMetrics metrics, HystrixCircuitBreaker circuitBreaker, HystrixCommandProperties properties) {
            return new HystrixYammerMetricsPublisherCommand(commandKey, commandGroupKey, metrics, circuitBreaker, properties, metricsRegistry);
        }
    
        @Override
        public HystrixMetricsPublisherThreadPool getMetricsPublisherForThreadPool(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolMetrics metrics, HystrixThreadPoolProperties properties) {
            return new HystrixYammerMetricsPublisherThreadPool(threadPoolKey, metrics, properties, metricsRegistry);
        }
    
        @Override
        public HystrixMetricsPublisherCollapser getMetricsPublisherForCollapser(HystrixCollapserKey collapserKey, HystrixCollapserMetrics metrics, HystrixCollapserProperties properties) {
            return new HystrixYammerMetricsPublisherCollapser(collapserKey, metrics, properties, metricsRegistry);
        }

     HystrixYammerMetricsPublisherCommand

      从HystrixCommandMetrics获取数据,然后设置到MetricsRegistry中。

    例如:

    protected void createExecutionLatencyPercentileGauge(final String name, final double percentile) {
            metricsRegistry.newGauge(createMetricName(name), new Gauge<Integer>() {
                @Override
                public Integer value() {
                    return metrics.getExecutionTimePercentile(percentile);
                }
            });
        }

     HystrixYammerMetricsPublisherThreadPool

      从HystrixThreadPoolMetrics获取数据,然后设置到MetricsRegistry中。

    例如:

    metricsRegistry.newGauge(createMetricName("rollingMaxActiveThreads"), new Gauge<Number>() {
                @Override
                public Number value() {
                    return metrics.getRollingMaxActiveThreads();
                }
            });

    HystrixYammerMetricsPublisherCollapser

      从HystrixCollapserMetrics获取数据,然后设置到MetricsRegistry中。

    例如:

    metricsRegistry.newGauge(createMetricName("shardSize_percentile_50"), new Gauge<Integer>() {
                @Override
                public Integer value() {
                    return metrics.getShardSizePercentile(50);
                }
            });
  • 相关阅读:
    Zookeeper安装
    JDK安装(Linux)
    Zookeeper简介
    修改tomcat配置解决定时任务多次重复执行
    解决.net mvc session超时的问题
    C#- JSON的操作
    Android SharedPreferences的理解与使用
    大屏适配:flexible.js的源码及配置
    charles抓包工具,抓手机端https设置
    Sanic二十:Sanic 扩展之sanic-openapi生成接口文档之sanic-openapi支持的数据类型
  • 原文地址:https://www.cnblogs.com/zhangwanhua/p/8192231.html
Copyright © 2011-2022 走看看