-
Notifications
You must be signed in to change notification settings - Fork 30
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
Fix SearchMonitorsTool bugs; add corresponding ITs #151
Fix SearchMonitorsTool bugs; add corresponding ITs #151
Conversation
Signed-off-by: Tyler Ohlsen <[email protected]>
Signed-off-by: Tyler Ohlsen <[email protected]>
Signed-off-by: Tyler Ohlsen <[email protected]>
Known failures from neural sparse tool. Added IT and all UT pass on CI and locally.
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #151 +/- ##
============================================
+ Coverage 81.69% 81.73% +0.04%
+ Complexity 199 196 -3
============================================
Files 13 13
Lines 1027 1002 -25
Branches 133 132 -1
============================================
- Hits 839 819 -20
+ Misses 138 133 -5
Partials 50 50 ☔ View full report in Codecov by Sentry. |
src/test/java/org/opensearch/integTest/SearchMonitorsToolIT.java
Outdated
Show resolved
Hide resolved
mustList.add(new TermQueryBuilder("_id", monitorId)); | ||
} | ||
if (monitorName != null) { | ||
mustList.add(new TermQueryBuilder("monitor.name.keyword", monitorName)); | ||
} | ||
if (monitorNamePattern != null) { | ||
mustList.add(new WildcardQueryBuilder("monitor.name.keyword", monitorNamePattern)); | ||
} | ||
if (enabled != null) { | ||
mustList.add(new TermQueryBuilder("monitor.enabled", enabled)); | ||
} | ||
if (hasTriggers != null) { | ||
NestedQueryBuilder nestedTriggerQuery = new NestedQueryBuilder( | ||
"monitor.triggers", | ||
new ExistsQueryBuilder("monitor.triggers"), | ||
ScoreMode.None | ||
); | ||
|
||
BoolQueryBuilder triggerQuery = new BoolQueryBuilder(); | ||
if (hasTriggers) { | ||
triggerQuery.must(nestedTriggerQuery); | ||
} else { | ||
triggerQuery.mustNot(nestedTriggerQuery); |
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.
If we are adding these filters to find the monitors, I think it would be beneficial to also search by monitor type as well.
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.
This PR isn't adding any filters, it's just shown as updated due to tabbing since the overall if/else was removed. Prefer to leave the tool with the current set of params and add/remove/tune later on as more testing is done and we capture the breadth of questions and functional responses.
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.
Especially for initial release, we need to be weary about how many knobs we allow the LLM to tune. Ideally we cover as many questions as possible in a confident/consistent/accurate way, and slowly adjust or expand over time after we have a good gauge of performance.
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.
Fair enough, we can set this as a further enhancement, down the road.
Signed-off-by: Tyler Ohlsen <[email protected]>
Signed-off-by: Tyler Ohlsen <[email protected]>
^ latest commit fixes a bug found in integ tests where the mapping is |
* Fix search monitor bugs; add search monitor ITs Signed-off-by: Tyler Ohlsen <[email protected]> * Remove unused fn Signed-off-by: Tyler Ohlsen <[email protected]> * Clean up UT Signed-off-by: Tyler Ohlsen <[email protected]> * Change to beforeEach Signed-off-by: Tyler Ohlsen <[email protected]> * Fix detector_type bug Signed-off-by: Tyler Ohlsen <[email protected]> --------- Signed-off-by: Tyler Ohlsen <[email protected]> (cherry picked from commit 722bfd2) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Fix search monitor bugs; add search monitor ITs * Remove unused fn * Clean up UT * Change to beforeEach * Fix detector_type bug --------- (cherry picked from commit 722bfd2) Signed-off-by: Tyler Ohlsen <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…t#151) * Fix search monitor bugs; add search monitor ITs Signed-off-by: Tyler Ohlsen <[email protected]> * Remove unused fn Signed-off-by: Tyler Ohlsen <[email protected]> * Clean up UT Signed-off-by: Tyler Ohlsen <[email protected]> * Change to beforeEach Signed-off-by: Tyler Ohlsen <[email protected]> * Fix detector_type bug Signed-off-by: Tyler Ohlsen <[email protected]> --------- Signed-off-by: Tyler Ohlsen <[email protected]>
…t#151) (opensearch-project#153) * Fix search monitor bugs; add search monitor ITs * Remove unused fn * Clean up UT * Change to beforeEach * Fix detector_type bug --------- (cherry picked from commit 722bfd2) Signed-off-by: Tyler Ohlsen <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Signed-off-by: yuye-aws <[email protected]>
Description
This PR fixes few bugs related to the SearchMonitorsTool:
null
due to discrepancy on alerting plugin's transport vs. REST action for the search monitor API. TLDR is the REST action does post-processing by removing the nestedmonitor
field, hence we need to do the same thing in the tool.monitorID
bug due to classloading issue with thegetMonitor()
fn via common-utils. Simplified the tool to only use the search monitors transport action which improves maintainability as wellAlso fixes a bug in SearchAnomalyDetectorsTool where the mapping should be
detector_type
instead oftype
.Also adds several IT cases to cover the bugs. Completes part of #136
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.