From b988eb855c8a513696866236ad2095ff3c9807f4 Mon Sep 17 00:00:00 2001 From: Joachim Barheine Date: Mon, 28 Nov 2016 15:33:39 +0100 Subject: [PATCH] Fix crash-loop in thresholder caused by floating point numbers used as dimension filter Example: avg(some_timer{quantile=0.99}) > 0.1) Changes: * add DECIMAL (floating point value) to allowed tokens for dimensions Without this fix, an alarm-definition like the above one once injected through the Python API will break the Java-ORM layer because the alarm-definition cannot be parsed by the generated ANTLR parser. As a consequence the thresholder worker will terminate, leading to a crash-cycle. I could not find a way to make the ORM-layer ignore non-parseable alarm-definitions. So maybe this fix should be complemented by an extension of the Python API that uses exactly the same ANTLR grammar to validate incoming alarm-definitions. Change-Id: Ibbd41e1b817ebadc74b1b4a677db898cfa173ccb --- .../main/resources/monasca/common/model/alarm/AlarmExpression.g4 | 1 + 1 file changed, 1 insertion(+) diff --git a/java/monasca-common-model/src/main/resources/monasca/common/model/alarm/AlarmExpression.g4 b/java/monasca-common-model/src/main/resources/monasca/common/model/alarm/AlarmExpression.g4 index ade3f3a9..e5655132 100644 --- a/java/monasca-common-model/src/main/resources/monasca/common/model/alarm/AlarmExpression.g4 +++ b/java/monasca-common-model/src/main/resources/monasca/common/model/alarm/AlarmExpression.g4 @@ -138,6 +138,7 @@ txt : TXT | keyword | INTEGER + | DECIMAL | STRING ;