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);
}
});
hystrix源码小贴士之Yammer Publisher的更多相关文章
- hystrix源码小贴士之Servo Publisher
HystrixServoMetricsPublisher 继承HystrixMetricsPublisher,创建HystrixServoMetricsPublisherCommand.Hystrix ...
- hystrix源码小贴士之之hystrix-metrics-event-stream
hystrix-metrics-event-stream主要提供了一些servlet,可以让用户通过http请求获取metrics信息. HystrixSampleSseServlet 继承了Http ...
- hystrix源码小贴士之调用异常处理
executeCommandAndObserve方法处理onerror异常. return execution.doOnNext(markEmits) .doOnCompleted(markOnCom ...
- hystrix源码小贴士之中断
execution.isolation.thread.interruptOnCancel可以设置当cancellation发生时是否需要中断.通过Future的cancel方法和线程的中断方法来实现是 ...
- 【一起学源码-微服务】Hystrix 源码一:Hystrix基础原理与Demo搭建
说明 原创不易,如若转载 请标明来源! 欢迎关注本人微信公众号:壹枝花算不算浪漫 更多内容也可查看本人博客:一枝花算不算浪漫 前言 前情回顾 上一个系列文章讲解了Feign的源码,主要是Feign动态 ...
- Django 源码小剖: 响应数据 response 的返回
响应数据的返回 在 WSGIHandler.__call__(self, environ, start_response) 方法调用了 WSGIHandler.get_response() 方法, 由 ...
- Django 源码小剖: 初探 WSGI
Django 源码小剖: 初探 WSGI python 作为一种脚本语言, 已经逐渐大量用于 web 后台开发中, 而基于 python 的 web 应用程序框架也越来越多, Bottle, Djan ...
- urllib2 源码小剖
urllib2 源码小剖 2013-08-25 23:38 by 捣乱小子, 272 阅读, 0 评论, 收藏, 编辑 两篇小剖已经完成: urllib 源码小剖 urllib2 源码小剖 urlli ...
- urllib 源码小剖
urllib 源码小剖 urllib 是 python 内置的网络爬虫模块,如果熟悉 python 一定能很快上手使用 urllib. 写这篇文章的目的是因为用到了它,但因为用的次数较多,又或者是具体 ...
随机推荐
- 《Head First 设计模式》:适配器模式
正文 一.定义 适配器模式将一个类的接口(被适配者),转换成客户期望的另一个接口.适配器让原本接口不兼容的类可以合作无间. 要点: 适配器实现了目标接口,并持有被适配者的实例. 适配器使用被适配者的方 ...
- 「查缺补漏」巩固你的RocketMQ知识体系
Windows安装部署 下载 地址:[https://www.apache.org/dyn/closer.cgi?path=rocketmq/4.5.2/rocketmq-all-4.5.2-bin- ...
- 求求大厂给个Offer:List面试题
前言 只有光头才能变强. 文本已收录至我的GitHub精选文章,欢迎Star:https://github.com/ZhongFuCheng3y/3y 从今天开始,我,三歪,正式开始写面试系列.我给这 ...
- Linux环境下安装Redis数据库
1.下载Redis安装包 访问https://redis.io/download,目前最新版本是5.0.5,点击下载 2.安装Redis 2.1通过远程工具把压缩包导入Linux工作盘,我的在home ...
- pandas参数设置小技巧
在日常使用pandas的过程中,由于我们所分析的数据表规模.格式上的差异,使得同样的函数或方法作用在不同数据上的效果存在差异. 而pandas有着自己的一套参数设置系统,可以帮助我们在遇到不同的数据时 ...
- [转]camera教程
camera教程 Lens一般由几片透镜组成透镜结构,按材质可分为塑胶透镜(plastic)或玻璃透镜(glass),玻璃镜片比树脂镜片贵.塑胶透镜其实是树脂镜片,透光率和感光性等光学指标比不上镀膜镜 ...
- 牛客网PAT练习场-A+B和C
签到题 .题目地址:https://www.nowcoder.com/pat/6/problem/4077 #include<iostream> #include<cstdio> ...
- promise的常用情况
因为js是单线程的,所以一旦代码中有报错,就不会执行下面的了,如下333就未打印 console.log(111)throw Error(222)console.log(333) 好像与promise ...
- foreach循環體控制
通常情況下,在程式中的cursor定義之前,整合了l_sql變量后,轉化sql語句時,通過檢查STATUS的值來判斷sql語句是否有錯誤. 語句如: if STATUS th ...
- C言语--冒泡排序
/* 冒泡排序,从小到大 */ include<stdio.h> int main(void) { int i; int t; int p; int val; int a[6]; for( ...