From 96cb3cc4bc5eeb58c29a4917f5a69bced76ef46f Mon Sep 17 00:00:00 2001 From: Deklan Dieterly Date: Mon, 20 Oct 2014 16:17:24 -0600 Subject: [PATCH] Update alarm expression BNF documentation Change-Id: I78b2530a8aa9eec1a61ff08d8db2bb5dfc71ed8b --- docs/monasca-api-spec.md | 89 +++++++++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 33 deletions(-) diff --git a/docs/monasca-api-spec.md b/docs/monasca-api-spec.md index 1186b1f4f..aa9160f4c 100644 --- a/docs/monasca-api-spec.md +++ b/docs/monasca-api-spec.md @@ -90,52 +90,75 @@ An alarm expression is a boolean equation which if it evaluates to true with the At the highest level, you have an expression, which is made up of one or more subexpressions, joined by boolean logic. Parenthesis can be used for separators. In a BNF style format where items enclosed in [] are optional: -``` -expression - : subexpression - | '(' expression ')' - | subexpression logical_operator expression -``` +```` + + ::= + | + + + ::= + | + +```` +Each subexpression is made up of several parts with a couple of options: + +```` + + ::= + | '(' [',' period] ')' threshold_value ['times' periods] + | '(' expression ')' + +```` +Period must an interger multiple of 60. The default period is 60 seconds. The logical_operators are: `and` (also `&&`), `or` (also `||`). -``` -logical_operator - : 'and' | '&&' - | 'or' | '||' +```` + ::= 'and' | '&&' + ::= 'or' | '||' ```` - - -Each subexpression is made up of several parts with a couple of options: - -``` -subexpression - : metric relational_operator threshold_value - | function '(' metric [',' period] ')' relational_operator threshold_value ['times' periods] -``` A metric can be a metric name only or a metric name followed by a list of dimensions. The dimensions further qualify the metric name. -``` -metric - : metric_name - | metric_name '{' dimension_list '} -``` + ```` -dimension_list - : dimension - | dimension ',' dimension_list -```` -```` -dimension - : dimension_name '=' dimension_value + + ::= metric_name + | metric_name '{' '}' ```` + +Any number of dimensions can follow the metric name. + +```` + + ::= + | ',' + +```` + +A dimension is simply a key-value pair. + +```` + + ::= dimension_name '=' dimension_value + +```` + The relational_operators are: `lt` (also `<`), `gt` (also `>`), `lte` (also `<=`), `gte` (also `>=`). + +```` + + ::= 'lt' | '<' | 'gt' | '>' | 'lte' | '<=' | 'gte' | '>=' + +```` +The list of available statistical functions include the following. + ``` -relational_operator - : 'min' | 'max' | 'sum' | 'count' | 'avg' + + ::= 'min' | 'max' | 'sum' | 'count' | 'avg' + ``` Threshold values are always in the same units as the metric that they are being compared to.