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. 写这篇文章的目的是因为用到了它,但因为用的次数较多,又或者是具体 ...
随机推荐
- Android SDK 环境的搭建 --图形界面模式和命令行模式
Android 开发首先就是要搭建开发环境,没有用过Eclipse(ADT)开发过,直接用的Android Studio,其中最主要的就是 Android SDK的安装和搭建,所以这里只是总结下And ...
- 免费验证码接收网站&不停开小号方法
手机号注册:免费验证码接收网站 0.http://getfreesmsnumber.com/ 9个外国网站,访问后要快点点击链接,否则2秒会检测出adblocker 1.http://smsrecei ...
- firewall几个常用命令
systemctl status firewalld firewall-cmd --zone=public --add-port=80/tcp --permanent firewall-cmd --r ...
- CentOS7 更改默认启动桌面(或命令行)模式
centos7以后是这样的,7以前就是别的版本了 1.systemctl get-default命令获取当前模式 2.systemctl set-default graphical.target 修改 ...
- linux tmpfs及消耗内存脚本
一.tmpfs介绍 tmpfs是一种虚拟内存文件系统,正如这个定义它最大的特点就是它的存储空间在VM里面VM是由linux内核里面的vm子系统管理的东西,现在大多数操作系统都采用了虚拟内存管理机制VM ...
- Java中校验身份证号合法性(真伪),获取出生日期、年龄、性别、籍贯
开发过程中有用的身份证号的业务场景,那么校验身份证的合法性就很重要了,另外还有通过身份证获取出生日期.年龄.性别.籍贯等信息, 下面是本人在开发中用到的关于校验身份证真伪的工具类,可以直接拿来使用,非 ...
- LG P4161 [SCOI2009]游戏/LG P6280 [USACO20OPEN]Exercise G
Description(P4161) windy学会了一种游戏. 对于1到N这N个数字,都有唯一且不同的1到N的数字与之对应. 最开始windy把数字按顺序1,2,3,……,N写一排在纸上. 然后再在 ...
- Java多线程_生产者消费者模式1
生产者消费者模型 具体来讲,就是在一个系统中,存在生产者和消费者两种角色,他们通过内存缓冲区进行通信,生产者生产消费者需要的资料,消费者把资料做成产品.生产消费者模式如下图.(图片来自网络 ...
- 区块链入门到实战(25)之以太坊(Ethereum) – 以太币单位
以太币的主要单位是以太/Ether,即一个以太币,以太币的最小单位是wei. 以太币最小单位 wei 是以虚拟币先驱人物:戴伟 Wei Dai 命名,戴伟 W Dai 是一位兴趣广泛的密码学专家,他在 ...
- 新手学习seo写原创文章的方法
http://www.wocaoseo.com/thread-102-1-1.html 前两天都是写自己公司克拉玛依电信公司年终活动和总结的事,今天继续学习seo技术,其实说难也难说容易也容易,关键的 ...