Mathematical operations
To create more complex conditions based on mathematical operations, it is possible to use the formula editor.
Formulas input
To use formulas:
-
Switch to the manual input mode .
-
Enter the metric name in the Data source field or select it in the filtered list of options. The name of each metric must be written in braces as follow: {{metric_name}}.
-
Input the formula using mathematical symbols, constants and braces.
For example, the difference between the maximal round-trip time and of minimal round-trip time: {{roundTripMaximum}} - {{roundTripMinimal}}.
The result of calculations will automatically be displayed over the entered mathematical operation.
Available operations, operators and functions
Operations
Operation | Description |
---|---|
! |
Factorial |
^ |
Exponentiation |
* |
Multiplication |
/ |
Division |
% |
Remainder of division |
+ |
Addition |
- |
Subtraction |
|| |
Concatenation |
== |
Equal |
!= |
Not equal |
>= |
Greater or equal |
<= |
Less or equal |
> |
Greater |
< |
Less |
and |
Logical AND |
or |
Logical OR |
not |
Logical NOT |
Operators
Operator | Description |
---|---|
x! |
Factorial (x * (x-1) * (x-2) * … * 2 * 1). gamma(x + 1) for non-integers |
abs x |
The absolute value of x |
ceil x |
Round to the next integer |
floor x |
Round to the previous integer |
length x |
String length of x |
round x |
Round to the nearest integer |
sqrt x |
Square root of x |
trunc x |
Remove the fractional part of x |
exp x |
e^x (exponential/antilogarithm function with base e) |
ln x or log x |
Natural logarithm of x |
log10 x |
Base-10 logarithm of x |
acos x |
Arc cosine of x (in radians) |
acosh x |
Hyperbolic arc cosine of x (in radians) |
asin x |
Arc sine of x (in radians) |
asinh x |
Hyperbolic arc sine of x (in radians) |
atan x |
Arc tangent of x (in radians) |
atanh x |
Hyperbolic arc tangent of x (in radians) |
cos x |
Cosine of x (in radians) |
cosh x |
Hyperbolic cosine of x (in radians) |
sin x |
Sine of x (in radians) |
sinh x |
Hyperbolic sine of x (x is in radians) |
tan x |
Tangent of x (in radians) |
tanh x |
Hyperbolic tangent of x (x is in radians) |
x ? y : z |
Ternary conditional (if x then y else z) |
Functions
Function | Description |
---|---|
random(n) |
Get a random number in the range [0, n). If n is equal to zero, or not provided, it defaults to 1. |
min(a,b,…) |
Get the smallest (minimum) number in the list. |
max(a,b,…) |
Get the largest (maximum) number in the list. |
hypot(a,b) or |
Hypotenuse – the square root of the sum of squares of its arguments (sqrt(a2+b2)). |
pow(x, y) |
Equivalent of exponentiation x^y. |
atan2(y, x) |
Arc tangent of x/y – the angle between (0, 0) and (x, y) in radians. |
if(x, y, z) |
Equivalent of the ternary conditional (if x then y else z). |
delta(x) |
Difference between the current and the previous value of the x. |
deltaRoll(x) |
Only positive difference between the current and the previous value of the x. Negative value is replaced with the last non-negative result. |
timestamp() |
Timestamp of each metric from the returned series of values. The format is 13-digit integer value (milliseconds). |