我很难理解statsd中轨距的概念。请解释它是如何工作的,并举例说明什么时候有用。在
我不太清楚doc
Set a gauge value.
stat: the name of the gauge to set. value: the current value of the gauge. rate: a sample rate, a float between 0 and 1. Will only send data this percentage of the time. The statsd server does not take the sample rate into account for gauges. Use with care. delta: whether or not to consider this a delta value or an absolute value. See the gauge type for more detail.
Gauge只是反映系统的状态,或者一些根本不想聚合的度量。在
我给你举几个例子。在
1)在您的程序中,您可以使用一些特定于语言的API来了解此进程正在使用多少内存。比如,在果朗,我们可以:
为了简单起见,当代码调用运行时API时,可以将这些度量视为内存使用量。所以你可以用量规发送到StatsD,因为它们中的每一个都可以在10秒内完美地显示内存使用情况,这是StatsD中的默认刷新周期。而且,您不需要为这些度量使用任何聚合方法,因为聚合与sum一样没有任何意义。在
除上述情况外,它还有很多使用情况,比如CPU使用率、操作系统的系统负载、进程中的线程数、服务器中的联机连接数、交易系统中当前活动的事务数。在
2)有时,我们也可以用仪表来跟踪事情发生的时间。就像
^{pr2}$因此,一旦错误发生,您可以通过查看石墨仪表板的线条来发现这一点。而且,你可以通过观察线条的形状来分析和得到出现的频率。在
相关问题 更多 >
编程相关推荐