Creates bucket level monitors for rules containing aggregations#92
Conversation
…c for creating bucket level monitors Signed-off-by: Stevan Buzejic <stevan.buzejic@htecgroup.com>
Signed-off-by: Stevan Buzejic <stevan.buzejic@htecgroup.com>
357aaa0 to
fd8c6f5
Compare
Added integration tests for checking update of bucket level monitors Signed-off-by: Stevan Buzejic <stevan.buzejic@htecgroup.com>
16b0781 to
658f353
Compare
Signed-off-by: Stevan Buzejic <stevan.buzejic@htecgroup.com>
…name Signed-off-by: Stevan Buzejic <stevan.buzejic@htecgroup.com>
Signed-off-by: Stevan Buzejic <stevan.buzejic@htecgroup.com>
| // Build query string filter | ||
| .query(QueryBuilders.queryStringQuery(rule.getQueries().get(0).getValue())) | ||
| .aggregation(aggregationQueries.getAggBuilder()) | ||
| .size(10000); |
Codecov Report
@@ Coverage Diff @@
## main #92 +/- ##
============================================
- Coverage 40.71% 39.79% -0.93%
- Complexity 882 886 +4
============================================
Files 174 175 +1
Lines 6317 6551 +234
Branches 772 796 +24
============================================
+ Hits 2572 2607 +35
- Misses 3508 3704 +196
- Partials 237 240 +3
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
|
|
||
| private List<String> monitorIds; | ||
|
|
||
| private Map<String, String> ruleIdMonitorId; |
There was a problem hiding this comment.
let's have the suffix map in variable name for better readability
mayberuleIdMonitorIdMap
| String aggQuery = aggQueries.getAggQuery(); | ||
| String bucketTriggerQuery = aggQueries.getBucketTriggerQuery(); | ||
|
|
||
| Assert.assertEquals("\"aggs\":{\"result_agg\":{\"terms\":{\"field\":\"fieldB\"}}}", aggQuery); |
There was a problem hiding this comment.
how was this assert working if you needed to change the structuring of the fields
There was a problem hiding this comment.
You can see one line below that I just removed aggs part ie.
Assert.assertEquals("{"result_agg":{"terms":{"field":"fieldB"}}}", aggQuery);
| aggregationBuilder = new ValueCountAggregationBuilder(name).field(name); | ||
| break; | ||
| default: | ||
| return null; |
There was a problem hiding this comment.
let's surface a not supported exception for better debugging.
Signed-off-by: Stevan Buzejic <stevan.buzejic@htecgroup.com>
|
LGTM |
Signed-off-by: Stevan Buzejic <stevan.buzejic@htecgroup.com>
Signed-off-by: Stevan Buzejic <stevan.buzejic@htecgroup.com>
Signed-off-by: Stevan Buzejic <stevan.buzejic@htecgroup.com> (cherry picked from commit 2f0abe6)
Signed-off-by: Stevan Buzejic <stevan.buzejic@htecgroup.com> (cherry picked from commit 2f0abe6)
Description
Enables creation of bucket level monitors based on the aggregation rules.
Issues Resolved
[List any issues this PR will resolve]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.