一、基本方式

  • hystrix为每一个commandKey提供了计数器

二、实现流程

  • https://raw.githubusercontent.com/wiki/Netflix/Hystrix/images/metrics-generation.png

三、Hystrix event types

1、什么情况下会触发fallback方法?

2、fallback方法在什么情况下会抛出异常

四、metrics storage

1、实现原理

  • 当计数结果(metrics)产生之后,这些结果会在被推到其他系统中前存储一段时间。

2、存储结构

  • hystrix会将计数结果存储在内存数据结构里(in-memory data structures)。这个数据结构在1.5.0之后进行了改变。

2.1、高于1.4.x版本

  • HystrixRollingNumber记录events("三"中)的counts(HystrixCommandMetrics的父类HystrixMetrics的属性)
  • HystrixRollingPercentile记录感兴趣的分布的数量。例如:记录command的延迟,collapser的批量size。(HystrixCommandMetrics的属性)

注意:

  • 当command执行时,计数结果会被同步写到如上的两个数据结构中。
  • 如果该command是多个线程在执行,HystrixRollingNumber和HystrixRollingPercentile内部会有一个同步逻辑来达到线程安全(我们不需要再外部去做线程安全处理)
  • 以上这两个数据结构支持滚动模型,即只保存最新的值(而metrics会根据配置保存多个值,比如保存每一秒的值)

2.2、HystrixRollingNumber

当执行一个command的时候,HystrixRollingNumber会被初始化

五、metrics reads

1、所有hystrix-contrib中的metrics publishers and streams可以从上述的数据结构中读取信息。

2、数据结构只存储了最新的值,我们想看之前的值,只能通过分析HystrixRequestLog

3、The HystrixRequestLog tracks all events in a request, and makes them available as a string。

六、metrics event stream

1、原理

  • 只要客户端连接还连着,hystrix-metrics-event-stream就会不断的向客户端以text/event-stream的形式推送计数结果(metrics)

2、

七、metrics publisher

【附6】hystrix metrics and monitor的更多相关文章

  1. 附6 hystrix metrics and monitor

    一.基本方式 hystrix为每一个commandKey提供了计数器 二.实现流程 https://raw.githubusercontent.com/wiki/Netflix/Hystrix/ima ...

  2. 附2 hystrix详述(2)- 配置

    一.hystrix在生产中的建议 1.保持timeout的默认值(1000ms),除非需要修改(其实通常会修改) 2.保持threadpool的的线程数为10个,除非需要更多 3.依赖标准的报警和监控 ...

  3. 附1 hystrix详述(1)

    一.hystrix的作用 控制被依赖服务的延时和失败 防止在复杂系统中的级联失败 可以进行快速失败(不需要等待)和快速恢复(当依赖服务失效后又恢复正常,其对应的线程池会被清理干净,即剩下的都是未使用的 ...

  4. 第二十五章 springboot + hystrixdashboard

    注意: hystrix基本使用:第十九章 springboot + hystrix(1) hystrix计数原理:附6 hystrix metrics and monitor 一.hystrixdas ...

  5. 【第二十五章】 springboot + hystrixdashboard

    注意: hystrix基本使用:第十九章 springboot + hystrix(1) hystrix计数原理:附6 hystrix metrics and monitor 一.hystrixdas ...

  6. hystrix(2) metrics

    上一节讲到了hystrix提供的五个功能,这一节我们首先来讲hystrix中提供实时执行metrics信息的实现.为什么先讲metrics,因为很多功能都是基于metrics的数据来实现的,它是很多功 ...

  7. hystrix文档翻译之metrics

     metrics和监控 动机 HystrixCommands和HystrixObservableCommands执行过程中会产生相关运行情况的metrics.这些metrics对于监控系统表现有很大的 ...

  8. .NET Core微服务之基于Steeltoe使用Hystrix熔断保护与监控

    Tip: 此篇已加入.NET Core微服务基础系列文章索引 =>  Steeltoe目录快速导航: 1. 基于Steeltoe使用Spring Cloud Eureka 2. 基于Steelt ...

  9. Spring Cloud(六):Hystrix 监控数据聚合 Turbine【Finchley 版】

    Spring Cloud(六):Hystrix 监控数据聚合 Turbine[Finchley 版]  发表于 2018-04-17 |  更新于 2018-05-07 |  上一篇我们介绍了使用 H ...

随机推荐

  1. Why String is Immutable or Final in Java

    The string is Immutable in Java because String objects are cached in String pool. Since cached Strin ...

  2. css3写等腰三角形

    <style>            .test {                width: 0;                height: 0;                b ...

  3. mac版 android studio问题解决

    1.mac安装android studio 解决方案:如果你是安装新手,可以下载androud studio boundls 和 安装环境的jdk就可以了,不需要单独在配置环境了,如果你有经验,可以单 ...

  4. 什么是 Delta 文件

    什么是 Delta 文件 Delta 文件应用很广泛,特别是在数据库领域 What Is a Delta File? During most computer operations, copying, ...

  5. Java多线程面试、笔试方向---后续补充

    1.ThreadLocal类     线程级别的局部变量,为每个使用该变量的线程提供一个独立的变量副本,每个线程修改副本时不影响其他线程对象的副本.  ThreadLocal实例通常作为静态私有字段出 ...

  6. windows server r2 搭建 ftp服务器

    1:安装ftp服务器 开始>管理工具>服务器管理器>打开服务器管理器,找到添加角色,然后点击,弹出添加角色对话框,选择下一步>选择Web服务器(IIS),然后选择FTP服务,直 ...

  7. latex 安装和使用

    1:下载 texlivewindows 版  http://tug.org/texlive/acquire-netinstall.html 2:双击exe文件进行安装,安装时选择 将路径添加到环境变量 ...

  8. Maven项目常见错误解决方法汇总

    issue 1.Java compiler level does not match the version of the installed Java project facet. 或者 One o ...

  9. zabbix3.0 centos7 yum 安装与简单配置

    参考文档https://www.zabbix.com/documentation/3.0/start zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案.zab ...

  10. [LeetCode] 122. Best Time to Buy and Sell Stock II_Easy tag: Dynamic Programming

    Say you have an array for which the ith element is the price of a given stock on day i. Design an al ...