statsd 五种类型数据发送形式拟测试

StatsD Metric Types

Counting

gorets:1|c

This is a simple counter. Add 1 to the "gorets" bucket. At each flush the current count is sent and reset to 0. If the count at flush is 0 then you can opt to send no metric at all for this counter, by setting config.deleteCounters (applies only to graphite backend). Statsd will send both the rate as well as the count at each flush.

Sampling

gorets:1|c|@0.1

Tells StatsD that this counter is being sent sampled every 1/10th of the time.

Timing

glork:320|ms|@0.1

The glork took 320ms to complete this time. StatsD figures out percentiles, average (mean), standard deviation, sum, lower and upper bounds for the flush interval. The percentile threshold can be tweaked with config.percentThreshold.

The percentile threshold can be a single value, or a list of values, and will generate the following list of stats for each threshold:

stats.timers.$KEY.mean_$PCT
stats.timers.$KEY.upper_$PCT
stats.timers.$KEY.sum_$PCT

Where $KEY is the stats key you specify when sending to statsd, and $PCT is the percentile threshold.

Note that the mean metric is the mean value of all timings recorded during the flush interval whereas mean_$PCT is the mean of all timings which fell into the $PCT percentile for that flush interval. And the same holds for sum and upper. Seeissue #157 for a more detailed explanation of the calculation.

If the count at flush is 0 then you can opt to send no metric at all for this timer, by setting config.deleteTimers.

Use the config.histogram setting to instruct statsd to maintain histograms over time. Specify which metrics to match and a corresponding list of ordered non-inclusive upper limits of bins (class intervals). (use inf to denote infinity; a lower limit of 0 is assumed) Each flushInterval, statsd will store how many values (absolute frequency) fall within each bin (class interval), for all matching metrics. Examples:

  • no histograms for any timer (default): []
  • histogram to only track render durations, with unequal class intervals and catchall for outliers:

      [ { metric: 'render', bins: [ 0.01, 0.1, 1, 10, 'inf'] } ]
    
  • histogram for all timers except 'foo' related, with equal class interval and catchall for outliers:

      [ { metric: 'foo', bins: [] },{ metric: '', bins: [ 50, 100, 150, 200, 'inf'] } ]
    

Statsd also maintains a counter for each timer metric. The 3rd field specifies the sample rate for this counter (in this example @0.1). The field is optional and defaults to 1.

Note:

  • first match for a metric wins.
  • bin upper limits may contain decimals.
  • this is actually more powerful than what's strictly considered histograms, as you can make each bin arbitrarily wide, i.e. class intervals of different sizes.

Gauges

StatsD now also supports gauges, arbitrary values, which can be recorded.

gaugor:333|g

If the gauge is not updated at the next flush, it will send the previous value. You can opt to send no metric at all for this gauge, by setting config.deleteGauges

Adding a sign to the gauge value will change the value, rather than setting it.

gaugor:-10|g
gaugor:+4|g

So if gaugor was 333, those commands would set it to 333 - 10 + 4, or 327.

Note:

This implies you can't explicitly set a gauge to a negative number without first setting it to zero.

Sets

StatsD supports counting unique occurences of events between flushes, using a Set to store all occuring events.

uniques:765|s

If the count at flush is 0 then you can opt to send no metric at all for this set, by setting config.deleteSets.

Multi-Metric Packets

StatsD supports receiving multiple metrics in a single packet by separating them with a newline.

gorets:1|c\nglork:320|ms\ngaugor:333|g\nuniques:765|s

Be careful to keep the total length of the payload within your network's MTU. There is no single good value to use, but here are some guidelines for common network scenarios:

  • Fast Ethernet (1432) - This is most likely for Intranets.
  • Gigabit Ethernet (8932) - Jumbo frames can make use of this feature much more efficient.
  • Commodity Internet (512) - If you are routing over the internet a value in this range will be reasonable. You might be able to go higher, but you are at the mercy of all the hops in your route.

而在国外基于 StatsD 产生了一系列的工具,或者在成熟的项目基础之上,开始兼容 StatsD。如果按照方向可以划分为如图的几个方向。

有了数据和信息可以做很多事,包括数据集成、可视化、可视化+存储、事件流,甚至将这些结合做出一体化解决方案,针对不同的需求,不同的市场,每一个方向都能产生独特价值。接下来我们大致介绍一下这几个方向。

Integrations

StatsD 本身并不负责定义指标的涵义,所以如果要从数据库或者操作系统中采集数据,需要进行脚本的开发。其中在这方面做出突出贡献的是 Datadog。Datadog 开发的 dd-agent 项目在 GitHub 多达 150 个贡献者,兼容 60 多种操作系统、中间件、数据库。

除此之外,Librato 和 App First 也加入到 StatsD 的阵营中。而基础设施管理的解决方案:Puppet 和 Chef 也开始兼容将 StatsD 批量安装到基础设施中。

Visualization & Data Hosting

光有数据是不够的,良好的可视化才能将数据的作用发挥出来。在可视化这一块影响力较大的 Graphite 作为一个可视化的控件,不仅包含可视化还自带存储的部分。但也有不少人反映 Graphite 自带的界面太难看,得益于开源世界的伟大,我们有了 Grafana 可用,直接部署在nginx上面就行,使用node.js 实现的数据抓取。单论可视化,Grafana 是做得最好的一家,其展现形式丰富,可配置项目巨细靡遗。Signal FX 后来居上,也参与到竞争中。

在数据可视化的基础之上,也有服务开始从事可视化数据的托管服务。例如:Host Graphite。

时间序列数据库和事件处理引擎

其实 StatsD 和时间序列数据库的出现,是相辅相成的。在 OpenTSDB 和 InfluxDB 基础之上,StatsD 的应用才日渐丰满。InfluxDB 是一个开源分布式时序、事件和指标数据库,使用 Go 语言编写,无需外部依赖。对于运维工程师而言,OpenTSDB 可以获取基础设施和服务的实时状态信息,展示集群的各种软硬件错误,性能变化以及性能瓶颈。

再说说事件处理引擎,比如 Bosun 是一个新型的监控和告警系统,使用 golfing 编写,支持定义复杂的告警规则,支持 OpenTSDB、Graphite、Logstash-Elasticsearch 等数据源。Riemann 也开始与时间序列数据库,或者基于 StastD 的一体化解决方案对接,来弥补一些数据展现产品在报警这个方向上的不足。

一体化解决方案

那么,有没有能包含数据集成、可视化、数据存储、事件流处理于一体的解决方案呢?对于中小型企业尤其创业公司来说,自主开发或者利用现有的开源工具进行监控或多或少都会遇到一些问题,既要考虑成本又怕踩坑。这时候除开上述细分的方向之外,提供一体化解决方案的厂商及时出现了。国外这样的厂商有 Datadog、Librato 等等。其中 Datadog 在国外拥有 Facebook、Airbnb 等重量级客户,正大展风头。

StatsD 五种类型数据发送形式拟测试相关推荐

  1. 在Oracle中CHAR,NCHAR,VARCHAR,VARCHAR2,NVARCHAR2这五种类型的区别

    [在Oracle中CHAR,NCHAR,VARCHAR,VARCHAR2,NVARCHAR2这五种类型的区别 ] 1.CHAR(size)和VARCHAR(size)的区别  CHAR为定长的字段,最 ...

  2. 做短视频可以选哪些领域?推荐五种类型短视频,选对方向很重要

    做短视频可以选哪些领域?推荐五种类型短视频,选对方向很重要 刚刚进入短视频行业的小伙伴们想必都在苦恼如何选择短视频领域,毕竟想要长久发展短视频的话,那么就必须要选对方向,按照选择好的方向一直走,才能够 ...

  3. 五种大数据框架你必须要知道

    学习大数据不可不知的五种大数据框架,码笔记分享大数据框架Hadoop.Storm.Samza.Spark和Flink五种大数据框架详解: 一:Hadoop大数据框架 Hadoop 大数据框架?第一映入 ...

  4. 什么是通知?有哪五种类型的通知?

    通知是个在方法执行前或执行后要做的动作,实际上是程序执行时要通过SpringAOP框架触发的代码段. Spring切面可以应用五种类型的通知: a.before:前置通知,在一个方法执行前被调用. b ...

  5. 什么内容的短视频可以吸引粉丝?分享五种类型短视频,供你选择

    什么内容的短视频可以吸引粉丝?分享五种类型短视频,供你选择 短视频的制作其实并不难,主要难点还是在于短视频的内容选题.引流等.那么今天我们就一起来着重的了解一下看什么内容的短视频可以吸引粉丝,这里简单 ...

  6. linux下的文件可以分为哪五种类型,LINUX系统文件类型分类

    使用LINUX过程中,时常会对文件进行操作.但是linux中文件究竟有哪些分类呢?今天让我们大家来总结一下吧! 概述: linux文件可以分为五种类型,分别为:普通文件.目录.字符设备或块设备.套接口 ...

  7. Oracle 索引扫描的五种类型

    之前在讨论CBO和RBO的时候提到了索引扫描的几种类型. Oracle Optimizer CBO RBO http://blog.csdn.net/tianlesoftware/archive/20 ...

  8. 三种类型数据,轻松转换成 Excel

    大家好,从PDF中提取信息是办公场景中经常需要用到的操作,也是经常又读者在后台问的一个操作. 内容少的话我们可以手动复制粘贴,但如果需要批量提取就可以考虑使用Python,之前我也转载过相关文章,提到 ...

  9. 项目管理中项目评审的五种类型

    项目管理过程中,项目评审可以为广泛的利益相关者服务,并发挥各种作用.因此,企业对最重要的项目进行几种不同类型的评审也就不足为奇了.本文将介绍五种常用的项目评审类型,每一种都各有侧重点. 1.项目评审 ...

最新文章

  1. iptables 过滤条件(Matches)
  2. JZOJ__Day 1:【普及模拟】PLES
  3. 你是否觉得.Net Web Service 中asmx文件是多余的?
  4. halcon模板匹配学习(一) Matching 初印象
  5. FAT和EXFAT文件系统
  6. 【每日SQL打卡】​​​​​​​​​​​​​​​DAY 5丨员工奖金【难度简单】
  7. 爬虫之操作excel
  8. Vue3 + cli4 配置路由
  9. springmvc07 Json处理
  10. Xcode真机调试不了,提示 “Please reconnect the device”
  11. XML学习之做过的实验——实验一
  12. 《舵机控制基本原理》
  13. 微信隐藏代码功能大汇总-你不知道的微信命令行.doc
  14. TCP/IP 系列之你真的知道什么叫做IP吗?
  15. linux安全-用户行为监控
  16. 有关南怀瑾、朱熹周易断卦法的个人观点
  17. 在软件测试面试过程中如何进行自我介绍?
  18. PTA题目 : 用指针实现将一个3*3的整型矩阵转置
  19. springboot 2.X——短信网关使用初体验
  20. Catagory分类

热门文章

  1. 自定义ro.build.fingerprint
  2. 对称加密算法AES联合设备IMEI码设计的加密机制
  3. ListView缓存机制小结
  4. 使用MyEntunnel和Proxifier搭建代理服务器
  5. 初等数论 - 定理证明
  6. 计算机硬件型号,怎样检测电脑硬件型号
  7. 什么是业务流程管理BPM
  8. 【历史上的今天】10 月 6 日:互联网先驱诞生日;莲花公司宣布上市
  9. 云效·Insight(效能洞察)一款面向企业研发管理层的研发效能数字化度量服务
  10. linux redis病毒,Linux系统之Redis扩散病毒继续分析