Gelinski
(Matheus Gelinski Pires)
September 6, 2023, 4:35pm
1
Hello folks,
I am trying to create an Alert Rule of 'Metric threshold' type where I am using the 'custom equation' condition option to calculate a percentage.
The details of the rule are bellow:
Condition
When custom equation is above or equal to 0.05
Aggregations
Aggregation A = Document count of query filter for field A
Aggregation B = Document count of query filter for field B
Equation
A/(A+B)
Even with A and B returning valid values, I got the following error at rule execution:
search_phase_execution_exception Caused by: script_exception: compile error, caused by: "compile error,cannot resolve symbol [B]"
I did a simple test changing the equation to A+B and it works.
Could this be a bug?
Thanks,
Matheus
This is a bug... the work around would be to do:
Aggregations
Aggregation A = Document count of query filter for field A
Aggregation B = Document count of query filter for field B
Aggregation C = Document count of query filter for field A
Equation
A/(C+B)
opened 03:23PM - 14 Sep 23 UTC
bug
Team: Actionable Observability
**Kibana version:**
8.7+
**Original install method (e.g. download page, yu… m, from source, etc.):**
ANY
**Describe the bug:**
When you use the same variable twice in the custom equation, the rule and preview throws a 500.
**Steps to reproduce:**
1. Create a Metric Threshold rule with a custom equation
2. Add 2 metrics, `A` and `B`
3. Change the equation to `A / (A + B)`
**Expected behavior:**
It should work correctly.
**Additional context:**
We need to change `acc.replace` to `acc.replaceAll` on this line:
https://github.com/elastic/kibana/blob/6ab7ec48cfd962b573e6f3f7ff9f4b12779df413/x-pack/plugins/infra/server/lib/create_custom_metrics_aggregations.ts#L77
1 Like
system
(system)
Closed
October 12, 2023, 3:31pm
3
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.