prometheus/rules
Julius Volz d411a7d810 Allow reversing vector and scalar arguments in binops.
This allows putting a scalar as the first argument of a binary operator
in which the second argument is a vector:

  <scalar> <binop> <vector>

For example,

  1 / http_requests_total

...will output a vector in which every sample value is 1 divided by the
respective input vector element.

This even works for filter binary operators now:

  1 == http_requests_total

Returns a vector with all values set to 1 for every element in
http_requests_total whose initial value was 1.

Note: For filter binary operators, the resulting values are always taken
from the left-hand-side of the operation, no matter whether the scalar
or the vector argument is the left-hand-side. That is,

  1 != http_requests_total

...will set all result vector sample values to 1, although these are
exactly the sample elements that were != 1 in the input vector.

If you want to just filter elements without changing their sample
values, you still need to do:

  http_requests_total != 1

The new filter form is a bit exotic, and so probably won't be used
often. But it was easier to implement it than disallow it completely or
change its behavior.

Change-Id: Idd083f2bd3a1219ba1560cf4ace42f5b82e797a5
2014-04-08 17:16:18 +02:00
..
ast Allow reversing vector and scalar arguments in binops. 2014-04-08 17:16:18 +02:00
fixtures Add alertmanager notification support to Prometheus. 2013-07-30 17:23:41 +02:00
alerting.go Use custom timestamp type for sample timestamps and related code. 2013-12-03 09:11:28 +01:00
helpers.go Add regex-matching support for labels. 2014-04-01 14:24:53 +02:00
helpers_test.go Convert metric.Values to slice of values. 2014-03-11 18:23:37 +01:00
lexer.l Add regex-matching support for labels. 2014-04-01 14:24:53 +02:00
lexer.l.go Add regex-matching support for labels. 2014-04-01 14:24:53 +02:00
load.go Use github.com/golang/glog for all logging. 2013-08-12 17:54:36 +02:00
Makefile Swap rules lexer for much faster one. 2013-07-11 19:35:29 +02:00
manager.go Merge "Display filename when encountering bad rule file." 2013-12-13 15:01:02 +01:00
parser.y Add regex-matching support for labels. 2014-04-01 14:24:53 +02:00
parser.y.go Add regex-matching support for labels. 2014-04-01 14:24:53 +02:00
recording.go Use custom timestamp type for sample timestamps and related code. 2013-12-03 09:11:28 +01:00
rules.go Use custom timestamp type for sample timestamps and related code. 2013-12-03 09:11:28 +01:00
rules_test.go Allow reversing vector and scalar arguments in binops. 2014-04-08 17:16:18 +02:00
telemetry.go add evalDuration histogram and ruleCount counter for rules 2013-12-11 15:42:53 -05:00