and
There are two variants of the :and
operator.
Choosing¶
Input Stack:
|
⇨ | Output Stack:
|
This first variant is used for choosing the set of time series to operate on. It is a binary operator that matches if both of the sub-queries match.
Parameters¶
- query1: First query condition that must match
- query2: Second query condition that must also match
Examples¶
Combine two conditions to select specific time series:
For example, consider the following query:
nf.app,alerttest,:eq, name,ssCpuUser,:eq, :and
When matching against the sample data in the table below, the highlighted time series would be included in the result set:
Name | nf.app | nf.node |
---|---|---|
ssCpuUser | alerttest | i-0123 |
ssCpuSystem | alerttest | i-0123 |
ssCpuUser | nccp | i-0abc |
ssCpuSystem | nccp | i-0abc |
numRequests | nccp | i-0abc |
ssCpuUser | api | i-0456 |
Math¶
Input Stack:
|
⇨ | Output Stack:
|
Compute a new time series where each interval has the value (a AND b)
where a
and b
are the corresponding intervals in the input time series.
Parameters¶
- ts1: First time series expression
- ts2: Second time series expression
Examples¶
Boolean AND operation on time series values:
Time | a | b | a AND b |
---|---|---|---|
00:01 | 0.0 | 0.0 | 0.0 |
00:01 | 0.0 | 1.0 | 0.0 |
00:02 | 1.0 | 0.0 | 0.0 |
00:03 | 1.0 | 1.0 | 1.0 |
00:04 | 0.5 | 1.7 | 1.0 |
The result will be a signal time series that will
be 1.0
for all intervals where the corresponding values of a
and b
are both non-zero.
Creating a signal that's true only when time is between 300 and 310 minutes:
Before | After |
minuteOfDay,:time, :dup, 300,:gt, :swap, 310,:lt | minuteOfDay,:time, :dup, 300,:gt, :swap, 310,:lt, :and |