You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
I wanted to define a trigger condition that checks for free storage to be under 2 GiB which is 2147483648 bytes. The trigger though created error alerts like " Error: Failed evaluating trigger: ... ggregations.when.value < 2147483648 ^---- HERE" whereas my trigger with the 1 GiB condition (1073741824 bytes) worked fine.
Turns out that 2147483648 happens to be the first value that requires a long type. So I reduced my condition value by 1 to 2147483647 to make it an int and now it works.
The underlying code should check the size the required numeric type and correctly handle it.
The text was updated successfully, but these errors were encountered:
kid4git
changed the title
Alert trigger condition accepts long values, but the underlying code can only handle ints
Alert trigger condition accepts long values, but the underlying code can only handle integers
Feb 11, 2021
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I wanted to define a trigger condition that checks for free storage to be under 2 GiB which is 2147483648 bytes. The trigger though created error alerts like " Error: Failed evaluating trigger: ... ggregations.when.value < 2147483648 ^---- HERE" whereas my trigger with the 1 GiB condition (1073741824 bytes) worked fine.
Elasticsearch showed this error:
{"type": "server", "timestamp": "2021-02-11T05:40:11,996Z", "level": "INFO", "component": "c.a.o.a.MonitorRunner", "cluster.name": "docker-cluster", "node.name": "a2b866ffc78a", "message": "Error running script for monitor WCKXincBaPvy5iOM-xEB, trigger: eOd1jHcBhFIUwSF3Wqsb", "cluster.uuid": "9I8_HRIQQJOf_2cXGVqZuw", "node.id": "eNkdYkOrSZi5QeKWtI2oWQ" , "stacktrace": ["org.elasticsearch.script.ScriptException: compile error", "at org.elasticsearch.painless.PainlessScriptEngine.convertToScriptException(PainlessScriptEngine.java:506) ~[?:?]", "at org.elasticsearch.painless.PainlessScriptEngine.compile(PainlessScriptEngine.java:417) ~[?:?]", "at org.elasticsearch.painless.PainlessScriptEngine.compile(PainlessScriptEngine.java:145) ~[?:?]", "at org.elasticsearch.script.ScriptCache.lambda$compile$0(ScriptCache.java:110) ~[elasticsearch-7.10.1.jar:7.10.1]", "at org.elasticsearch.common.cache.Cache.computeIfAbsent(Cache.java:433) ~[elasticsearch-7.10.1.jar:7.10.1]", "at org.elasticsearch.script.ScriptCache.compile(ScriptCache.java:99) ~[elasticsearch-7.10.1.jar:7.10.1]", "at org.elasticsearch.script.ScriptService.compile(ScriptService.java:384) ~[elasticsearch-7.10.1.jar:7.10.1]", "at com.amazon.opendistroforelasticsearch.alerting.MonitorRunner.runTrigger(MonitorRunner.kt:405) [opendistro_alerting-1.12.0.2.jar:1.12.0.2]", "at com.amazon.opendistroforelasticsearch.alerting.MonitorRunner.runMonitor(MonitorRunner.kt:242) [opendistro_alerting-1.12.0.2.jar:1.12.0.2]", "at com.amazon.opendistroforelasticsearch.alerting.MonitorRunner$runMonitor$1.invokeSuspend(MonitorRunner.kt) [opendistro_alerting-1.12.0.2.jar:1.12.0.2]", "at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) [kotlin-stdlib-1.3.72.jar:1.3.72-release-468 (1.3.72)]", "at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:233) [kotlinx-coroutines-core-1.1.1.jar:?]", "at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594) [kotlinx-coroutines-core-1.1.1.jar:?]", "at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60) [kotlinx-coroutines-core-1.1.1.jar:?]", "at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:742) [kotlinx-coroutines-core-1.1.1.jar:?]", "Caused by: java.lang.IllegalArgumentException: Invalid int constant [2147483648]. If you want a long constant then change it to [2147483648L].", "at org.elasticsearch.painless.PainlessScript$Script.compile(return ctx.results[0].aggregations.when.value == null ? false : ctx.results[0].aggregations.when.value < 2147483648:106) ~[?:?]", "at org.elasticsearch.painless.phase.DefaultSemanticAnalysisPhase.visitNumeric(DefaultSemanticAnalysisPhase.java:1925) ~[?:?]", "at org.elasticsearch.painless.phase.DefaultSemanticAnalysisPhase.visitNumeric(DefaultSemanticAnalysisPhase.java:161) ~[?:?]", "at org.elasticsearch.painless.node.ENumeric.visit(ENumeric.java:52) ~[?:?]", "at org.elasticsearch.painless.phase.DefaultSemanticAnalysisPhase.checkedVisit(DefaultSemanticAnalysisPhase.java:196) ~[?:?]", "at org.elasticsearch.painless.phase.DefaultSemanticAnalysisPhase.visitComp(DefaultSemanticAnalysisPhase.java:1274) ~[?:?]", "at org.elasticsearch.painless.phase.DefaultSemanticAnalysisPhase.visitComp(DefaultSemanticAnalysisPhase.java:161) ~[?:?]", "at org.elasticsearch.painless.node.EComp.visit(EComp.java:59) ~[?:?]", "at org.elasticsearch.painless.phase.DefaultSemanticAnalysisPhase.checkedVisit(DefaultSemanticAnalysisPhase.java:196) ~[?:?]", "at org.elasticsearch.painless.phase.DefaultSemanticAnalysisPhase.visitConditional(DefaultSemanticAnalysisPhase.java:1411) ~[?:?]", "at org.elasticsearch.painless.phase.DefaultSemanticAnalysisPhase.visitConditional(DefaultSemanticAnalysisPhase.java:161) ~[?:?]", "at org.elasticsearch.painless.node.EConditional.visit(EConditional.java:58) ~[?:?]", "at org.elasticsearch.painless.phase.DefaultSemanticAnalysisPhase.checkedVisit(DefaultSemanticAnalysisPhase.java:196) ~[?:?]", "at org.elasticsearch.painless.phase.PainlessSemanticAnalysisPhase.visitReturn(PainlessSemanticAnalysisPhase.java:165) ~[?:?]", "at org.elasticsearch.painless.phase.PainlessSemanticAnalysisPhase.visitReturn(PainlessSemanticAnalysisPhase.java:52) ~[?:?]", "at org.elasticsearch.painless.node.SReturn.visit(SReturn.java:44) ~[?:?]", "at org.elasticsearch.painless.phase.DefaultSemanticAnalysisPhase.visit(DefaultSemanticAnalysisPhase.java:185) ~[?:?]", "at org.elasticsearch.painless.phase.DefaultSemanticAnalysisPhase.visitBlock(DefaultSemanticAnalysisPhase.java:304) ~[?:?]", "at org.elasticsearch.painless.phase.DefaultSemanticAnalysisPhase.visitBlock(DefaultSemanticAnalysisPhase.java:161) ~[?:?]", "at org.elasticsearch.painless.node.SBlock.visit(SBlock.java:48) ~[?:?]", "at org.elasticsearch.painless.phase.DefaultSemanticAnalysisPhase.visit(DefaultSemanticAnalysisPhase.java:185) ~[?:?]", "at org.elasticsearch.painless.phase.PainlessSemanticAnalysisPhase.visitFunction(PainlessSemanticAnalysisPhase.java:91) ~[?:?]", "at org.elasticsearch.painless.phase.DefaultSemanticAnalysisPhase.visitClass(DefaultSemanticAnalysisPhase.java:220) ~[?:?]", "at org.elasticsearch.painless.Compiler.compile(Compiler.java:222) ~[?:?]", "at org.elasticsearch.painless.PainlessScriptEngine$2.run(PainlessScriptEngine.java:412) ~[?:?]", "at org.elasticsearch.painless.PainlessScriptEngine$2.run(PainlessScriptEngine.java:408) ~[?:?]", "at java.security.AccessController.doPrivileged(AccessController.java:391) ~[?:?]", "at org.elasticsearch.painless.PainlessScriptEngine.compile(PainlessScriptEngine.java:408) ~[?:?]", "... 13 more"] }
Turns out that 2147483648 happens to be the first value that requires a long type. So I reduced my condition value by 1 to 2147483647 to make it an int and now it works.
The underlying code should check the size the required numeric type and correctly handle it.
This is [email protected]
The text was updated successfully, but these errors were encountered: