hystrix源码小贴士之Servo Publisher

Posted zwh1988

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了hystrix源码小贴士之Servo Publisher相关的知识,希望对你有一定的参考价值。

HystrixServoMetricsPublisher

  继承HystrixMetricsPublisher,创建HystrixServoMetricsPublisherCommand、HystrixServoMetricsPublisherThreadPool、HystrixServoMetricsPublisherCollapser。

    @Override
    public HystrixMetricsPublisherCommand getMetricsPublisherForCommand(HystrixCommandKey commandKey, HystrixCommandGroupKey commandGroupKey, HystrixCommandMetrics metrics, HystrixCircuitBreaker circuitBreaker, HystrixCommandProperties properties) {
        return new HystrixServoMetricsPublisherCommand(commandKey, commandGroupKey, metrics, circuitBreaker, properties);
    }

    @Override
    public HystrixMetricsPublisherThreadPool getMetricsPublisherForThreadPool(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolMetrics metrics, HystrixThreadPoolProperties properties) {
        return new HystrixServoMetricsPublisherThreadPool(threadPoolKey, metrics, properties);
    }

    @Override
    public HystrixMetricsPublisherCollapser getMetricsPublisherForCollapser(HystrixCollapserKey collapserKey, HystrixCollapserMetrics metrics, HystrixCollapserProperties properties) {
        return new HystrixServoMetricsPublisherCollapser(collapserKey, metrics, properties);
    }

HystrixServoMetricsPublisherCommand

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

HystrixServoMetricsPublisherThreadPool

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

HystrixServoMetricsPublisherCollapser

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

以上是关于hystrix源码小贴士之Servo Publisher的主要内容,如果未能解决你的问题,请参考以下文章

hystrix源码小贴士之调用异常处理

hystrix源码小贴士之调用timeout实现

hystrix源码小贴士之之hystrix-metrics-event-stream

hystrix源码小贴士之命令四种调用方式的异同

hystrix源码小贴士之中断

spring-boot-starter-actuator 与 hystrix-servo-metrics-publisher 冲突