DECAYED_SUM

Performs a sum of decayed values. That sum is based on the decay factor and the age of the original data.

Syntax

DECAYED_SUM (DECAY FACTOR, DECAY_INTERVAL, VALUE, TIME)

Arguments

DECAY FACTOR: Percentage decay for each time interval. D‌ECAY_INTERVAL: Length of time between decays. (In the example below, the entries are one minute apart, but the time interval is every 30 seconds.) VALUE: The field being aggregated. TIME: The time field.

Returns

A decimal value.

Example

Data

      "time":1628894940000,
      "cpuUsage":12.3
   },
   {
      "serverIp":"10.0.0.1",
      "time":1628895000000,
      "cpuUsage":55
   },
   {
      "serverIp":"10.0.0.2",
      "time":1628894700000,
      "cpuUsage":2.3
   },
   {
      "serverIp":"10.0.0.2",
      "time":1628894760000
   },
   {
      "serverIp":"10.0.0.2",
      "time":1628894820000,
      "cpuUsage":9.3
   },
   {
      "serverIp":"10.0.0.2",
      "time":1628894880000,
      "cpuUsage":9.6
   },
   {
      "serverIp":"10.0.0.2",
      "time":1628894940000,
      "cpuUsage":2.3
   }
]

Query For each server, calculate the decayed sum of CPU usage, with 30 second decay intervals and 5% decay per decay interval:

Results

SUM

Dialog

Last updated

Was this helpful?