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);
                }
            });
  • 相关阅读:
    Keras & Theano 输出中间层结果
    keras & tensorflow 列出可用GPU 和 切换CPU & GPU
    Visualizing CNN Layer in Keras
    [python]使用django快速生成自己的博客小站,含详细部署方法
    [JetBrains注册] 利用教育邮箱注册JetBrains产品(pycharm、idea等)的方法
    【python】pycharm常用配置快速入门。
    一道笔试题来理顺Java中的值传递和引用传递
    集群扩容的常规解决:一致性hash算法
    [面经]春季跳槽面筋总结 [2018年3月17]
    TestNG的简单使用
  • 原文地址:https://www.cnblogs.com/zhangwanhua/p/8192231.html
Copyright © 2011-2022 走看看