Trying to use the Rate process to weed out spikes in data.
From the explanation, it seems that it is not a ‘rate’ that is specified, but the maximum absolute change allowed between last and now. Is that correct? If so, I cannot seem to get it to work (and yes REDIS is running).
public function ifRateGtEqualSkip($arg, $time, $value, $options)
{
global $redis;
if ($redis) {
$redispath = "process:ifRateGtEqualSkip:".$options['sourcetype'].":".$options['sourceid']."_".$this->parentProcessModel->proc_goto;
//$this->log->info("ifRateGtEqualSkip() time=$time value=$value redispath=$redispath");
if ($redis->exists($redispath)) {
$lastvalue = $redis->hmget($redispath,array('time','value'));
$change = abs($value - $lastvalue['value']);
if ($change >= $arg)
$this->parentProcessModel->proc_skip_next = true;
}
$redis->hMset($redispath, array('time' => $time, 'value' => $value));
}
return $value;
}
It looks like it starts by saving the last time and value to a redis key. and then if that time and value exists previously it calculated the difference between the current value and the last value as an absolute value.
If that difference is more than the provided argument it should skip the next process.
Let’s say the input value is 100, if the change is <10 the multiplier process does not get skipped and so the feed value ends up being e.g 10000. If the change is >=10 the value does not have the multiplier applied and so ends up being the original value.
If I send an input value say 100 twice that gets logged fine as difference is less than 10. If I then send 120 that value is skipped. If I send 120 the second time that gets logged…
Ok, not understanding why mine stops. I’m still on V10 though - have you had a chance to check on whether the update script will work on a Debian based version?