# Operators

## Mathematical Operators

You may use the `+`, `-`, `*`, and `/` mathematical operators with a given metric. When using these operators, you may specify numeric literals or metric patterns on either side of the operation. The following example would return the results of adding each data point in `test.a` to its corresponding data point in `test.b` in a new metric called `test.sum`.

`test.a + test.b as test.sum`

If you perform a mathematical operation on one or more groups of metrics, that group of metrics will be transformed with the operation applied to it. For example, the following expression will return all metrics matching `test.group_a.*`, with their value transformed by the corresponding value in `test.group_b.factor`.

`test.group_a.* * test.group_b.factor`

If you attempt to perform an operation between two sets of metrics, the values on either side of the operation will be rolled into a single value and only a single metric will be returned. For instance, the following expression will return the sum of all metrics at each point in metrics matching `test.group_a.*` multiplied by all metrics at each point in metrics matching `test.group_b.*`.

`test.group_a.* * test.group_b.*`

## Boolean Operators

You may use the `<`, `<=`, `>`. and `>=` operators to express that only metrics above or below a certain threshold should be viewed. You should assume that a statement like the following:

`test.group_a.* > 50`

will return any metric matching the pattern `test.group_a.*` whose average value over the interval requested is greater than 50. This functionality is primarily useful when creating alerts.