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.
(These payload numbers take into account the maximum IP + UDP header sizes)
reference:
https://github.com/etsy/statsd/blob/master/docs/metric_types.md
相关推荐
只需几行代码,就可以定义并发送数据到StatsD服务器。 2. **多种度量类型**:支持四种基本的度量类型,包括计数器(用于统计事件发生的次数)、定时器(用于计算操作的耗时)、直方图(记录数值的分布情况)和Gauge...
总结,`node-statsd` 是前端开发者实现性能监控的一个强大工具,通过它,你可以轻松地集成统计指标收集,并将这些数据发送到后端监控系统,以便进行深入的数据分析和故障排查。其简单易用的 API 和高度可配置的特性...
Graphite可以接收StatsD发送的数据,进行长期存储,并提供丰富的图表展示功能,帮助分析趋势和异常。 5. **实际应用** 在实际项目中,StatsD常用于监控Web应用的性能,如HTTP请求的响应时间、错误率、数据库查询的...
其中,StatsD是一个流行的数据聚合服务器,它允许收集来自各种来源的统计信息,并将其转发到诸如Graphite、Elasticsearch等后端系统进行可视化和分析。本文将详细介绍一个开源项目——Alexcesaro-statsd,这是一个专...
Delphi实现StatsD客户端的关键在于创建一个UDP套接字组件,用于发送数据到StatsD服务器。在Delphi中,我们可以使用TIdUDPClient组件来实现这一功能。首先,需要设置TIdUDPClient的Host属性为StatsD服务器的IP地址,...
1. **协议支持**:statsd 使用简单的文本协议,允许应用程序通过UDP发送数据,这减少了网络延迟并提高了吞吐量。 2. **聚合**:它可以对收到的数据进行简单的聚合操作,如求和、平均值、最大值和最小值。 3. **采样*...
在这个配置文件中,你可以设置Statsd服务器的地址和端口,以及是否启用异步发送数据等选项。示例配置可能如下: ```php return [ 'host' => env('STATSD_HOST', 'localhost'), 'port' => env('STATSD_PORT', 8125...
一旦设置完毕,每次请求都将自动向statsd发送相关信息,而无需在业务代码中添加额外的监控代码。 这个开源项目“amalfra-gin-statsd”的源代码位于解压后的"gin-statsd-master"目录中,包含了中间件的实现、示例...
1. **简单集成**:`guillotina_statsd`提供了简单直观的接口,允许开发者轻松地向StatsD发送各种类型的指标,如计数器、计时器和直方图,而无需关心底层实现。 2. **自动度量**:库可以自动收集Guillotina应用程序...
2. **Python 脚本**:展示了如何使用 Python 客户端库(如 `influxdb` 和 `statsd`)来发送数据到 StatsD 以及 InfluxDB。 3. **数据收集示例**:可能包括模拟应用性能指标的代码,例如响应时间、错误率、内存使用...
Golang是一种静态类型的、编译型的语言,以其简洁的语法、高效的性能和内置的并发支持而受到欢迎,非常适合构建网络服务和系统工具,包括像statsd客户端这样的监控组件。 在压缩包文件名列表中,"fsd-master"可能...
通过UDP协议工作,StatsD允许应用程序以非侵入式的方式发送计数、计时、直方图和 gauge 类型的数据,以监控系统的性能和健康状况。 **django-statsd-unleashed 特性** 1. **自动收集**: `django-statsd-unleashed`...
Python库statsd-tags是用于扩展基本的statsd客户端的一个工具,它增加了对tags的支持,使得在数据收集和度量分析时能提供更多的元数据信息。statsd通常是一个轻量级的代理服务,它接收来自应用的性能数据,然后将...
总的来说,Flask-StatsD是Python Flask开发者的一个重要工具,它提供了一种简单的方法来监控应用性能,通过与StatsD的集成,可以实现更全面的后端性能分析。了解并正确使用这个库,可以帮助提升应用的稳定性和效率。
**statsd.cr:Crystal的statsd客户端库** ...总的来说,`statsd.cr`为Crystal开发者提供了一种简单、高效的方式来集成监控系统,通过收集和发送度量数据,可以更好地管理和优化应用程序,确保其稳定性和高性能。
这个库提供了基本的接口来发送计数、计时、 gauge 和直方图类型的指标,这些都是监控系统中最常见的数据类型。 使用nim-statsd-client,你可以: 1. **计数器(Counters)**:跟踪事件发生的频率,例如HTTP请求的...
通过这种方式,我们可以检查StatsD服务器是否能正常接收这些数据,并确保它们被正确地转发到后端存储。 StatsD的通信协议基于UDP,这是因为UDP具有更低的延迟和更高的效率,适合传输大量小数据包。然而,这也意味着...
`statsd-mysql-watcher`是一个工具,它允许开发者从MySQL数据库中收集状态数据,并通过StatsD发送到诸如Graphite或Elasticsearch这样的后端系统进行进一步的处理和可视化。这个项目基于JavaScript编写,旨在简化...
4. 发送数据:客户端会定期或在接收到一定数量的指标后自动将数据发送到 StatsD 服务器。 **项目结构分析** 在 `scala-statsd-example-master` 压缩包中,我们可能会找到以下组成部分: 1. `src/main/scala`:包含 ...
1. **StatsD**: 它是一个基于 UDP 的数据收集代理,用于接收来自应用的计数器、计时器、直方图和 Gauge 类型的指标,然后批量发送到后端存储。 2. **ZeroMQ (ZMQ)**: 高性能、轻量级的消息队列库,提供多种消息模式...