This is the stream processor engine, which is a fancy name to a component that is able to apply functions over a set of events.
It is important to notice that you do not interact with this directly.
Rather it is used by other components, like
xmpp, to fulfill a
Nevertheless, as the functions available here are usually used as-is by users through these higher level components, the first part of this documentation focuses on the available functions, whereas the second part contains detailed explanation about the protocol.
Each function contains a name, usually as ascii encoded string,
followed by zero or more arguments. For instance, the
function, which computes the maximum value of a set of events, takes
no arguments. Operators are the sole exception to this rule, as they
are enclosed by parenthesis or brackets. Currently all functions (as
well as operators) depends only on the input. They will only produce a
result when it receives one or more events. In other words, they are
You may compose functions using the
| (pipe) operator which
resembles greatly the unix pipe operator. So you may think of each
function as a combinator and using the pipe operator allow you to grow
bigger pipelines. For instance, suppose you have a event that ranges
from 0 to 1, the following function should compute the mean of
the current set of events and then multiply this value by 100 (left
to right application), only returning those greater than 50:
mean | (* 100) | [> 50]
Operators are always enclosed by parenthesis or brackets. Parenthesis
are used for arithmetic operators whereas brackets are used for
comparison operators. The syntax allow the operator to be placed
either on the left or right side. For instance,
(/ 100) will
divide by 100 whereas
(100 /) will divide 100 by the value of the
event. The same applies for comparison operators.
There are four arithmetic operators defined:
/, which respectively computes the
multiplication, addition, subtraction and division.
And there are six comparison operators defined:
> [greater than],
< [less than],
>= [greater than or equal to],
than or equal to],
= [equal to] and
/= [not equal to].
Computes the absolute value a number.
Smallest integral value that is not less than the current number.
Largest integral value not greater than the current value.
Round towards infinity.
Round towards zero.
The mean of the set of events.
Computes the simple moving average. The
actual implementation makes use of
1-2/(n+1) as the
Computes the exponential weighted moving average using :alpha as the alpha parameter.
|n:||A positive integer number;|
n elements out from a population of
m items. The exact
frequency of elements generated by this function is defined as
L the total of elements:
n * (L (mod m)) + minimum n (L (mod m))
|n:||The number of elements pick out of m;|
|m:||The so called population size;|
sma 30 | sample 1/5
The minimum value.
The maximum value.
Multiplication of all values in the stream.
Summation of all values in the stream.
Creates an window of
n items and when this is full applies a
function to produce a result.
|n:||An positive integer number [
|pipeline:||The function to apply, enclosed with parenthesis. You may
use the pipe to combine multiple functions, and all
functions here defined but
window 30 (mean | (* 100))
The identity function:
id x == x.
|>:||Greater than (e.g:
|>=:||Greater than or equal to (e.g:
|<=:||Less than equal to (e.g:
|>:||Less than (e.g:
|=:||Equal to (e.g:
|/=:||Not equal to (e.g: