-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creates bucket level monitors for rules containing aggregations #92
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
size(0)
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. |
@@ -90,6 +97,8 @@ public class Detector implements Writeable, ToXContentObject { | |||
|
|||
private List<String> monitorIds; | |||
|
|||
private Map<String, String> ruleIdMonitorId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's have the suffix map in variable name for better readability
mayberuleIdMonitorIdMap
@@ -73,7 +72,7 @@ public void testCountAggregationWithGroupBy() throws IOException, SigmaError { | |||
String aggQuery = aggQueries.getAggQuery(); | |||
String bucketTriggerQuery = aggQueries.getBucketTriggerQuery(); | |||
|
|||
Assert.assertEquals("\"aggs\":{\"result_agg\":{\"terms\":{\"field\":\"fieldB\"}}}", aggQuery); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how was this assert working if you needed to change the structuring of the fields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.