-
Describe the bugWhen using a metric_aggregation or spike_metric_aggregation rule with As a workaround, the percentile value must be hardcoded directly inside the metric_agg_script, for example by adding percents: [95]: metric_agg_script:
script: doc['field1'].value
percents: [95]CauseThis behavior originates from the MetricAggregationRule.generate_aggregation_query method in elastalert2/elastalert/ruletypes.py Lines 1094 to 1100 in 417d5b4 If metric_agg_script exists, the method immediately returns the query part containing only the script, skipping the logic that adds the percentile_range as the percents key. QuestionIs this behavior intended? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
I suspect the author intended this to be an "either-or" usage. Either you are using the built-in aggregations, or you are fully handling the calculation via a script. As to whether you can combine them, I believe it's possible, and it seems you have already proven it. So if you want to put a PR to allow this behavior, that's fine with me. There is a CONTRIBUTING.md file that explains what is required. |
Beta Was this translation helpful? Give feedback.
I suspect the author intended this to be an "either-or" usage. Either you are using the built-in aggregations, or you are fully handling the calculation via a script. As to whether you can combine them, I believe it's possible, and it seems you have already proven it. So if you want to put a PR to allow this behavior, that's fine with me. There is a CONTRIBUTING.md file that explains what is required.