关于graphite的几个function

关于graphite的几个function

scale

相当于乘法.比如15,scale(10)之后是150,sacle(10)之后是-150

Takes one metric or a wildcard seriesList followed by a constant, and multiplies the datapoint by the constant provided at each point.

scaleToSeconds

比如9,scaleToSeconds(60)=54(比如默认是10s采样一次)

Takes one metric or a wildcard seriesList and returns “value per seconds” where seconds is a last argument to this functions.Useful in conjunction with derivative or integral function if you want to normalize its result to a known resolution for arbitrary retentions

derivative

“导数”的概念,求变化值,不根据时间规范化,比如原来是56,后来是9,那么变化就是-47

This is the opposite of the integral function. This is useful for taking a running total metric and calculating the delta between subsequent data points.This function does not normalize for periods of time, as a true derivative would.

nonNegativeDerivative

非负求导数,比如原来是56,后来是9,那么差值为-47,为负数会被忽略掉。但是可以给nonNegativeDerivative传参数,比如nonNegativeDerivative(100)就相当于-47+100+1=54

Same as the derivative function above, but ignores datapoints that trend down. Useful for counters that increase for a long time, then wrap or reset. (Such as if a network interface is destroyed and recreated by unloading and re-loading a kernel module, common with USB / WiFi cards.)

integral

“积分”的概念,相当于不断累加值

This will show the sum over time, sort of like a continuous addition function. Useful for finding totals or trends in metrics that are collected per minute.

persecond

相当于scaleToSeconds(nonNegativeDerivative(metric),1)

NonNegativeDerivative adjusted for the series time interval This is useful for taking a running total metric and showing how many requests per second were handled.
该操作对于累积的counter metric非常有用,可以算出每秒的变动值,比如

关于graphite的几个function_第1张图片
count-persecond.png

加上persecond之后就可以把累积的count值转换为变化的曲线

doc

  • functions
  • What does integrate() do? Or, what's the inverse of deriv()?
  • How to do Graphite Derivatives correctly

你可能感兴趣的:(关于graphite的几个function)