-
Notifications
You must be signed in to change notification settings - Fork 31
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 detector state params in SearchAnomalyDetectorsTool #235
Conversation
Signed-off-by: Tyler Ohlsen <[email protected]>
Leaving as draft until the related AD PR is merged so the CI can pick up the updated sonatype dependency. |
Signed-off-by: Tyler Ohlsen <[email protected]>
Signed-off-by: Tyler Ohlsen <[email protected]>
Signed-off-by: Tyler Ohlsen <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #235 +/- ##
============================================
- Coverage 81.69% 81.57% -0.13%
- Complexity 206 211 +5
============================================
Files 13 13
Lines 1060 1069 +9
Branches 141 146 +5
============================================
+ Hits 866 872 +6
Misses 140 140
- Partials 54 57 +3 ☔ View full report in Codecov by Sentry. |
The backport to
To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/skills/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/skills/backport-2.x
# Create a new branch
git switch --create backport/backport-235-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 44dc2326e0da81923e8129453304a2308a361065
# Push it to GitHub
git push --set-upstream origin backport/backport-235-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/skills/backport-2.x Then, create a pull request where the |
#235) (#238) Signed-off-by: Tyler Ohlsen <[email protected]>
opensearch-project#235) (opensearch-project#238) Signed-off-by: Tyler Ohlsen <[email protected]> Signed-off-by: yuye-aws <[email protected]>
Description
This PR fixes two issues related to fetching and filtering detector state with the
SearchAnomalyDetectorsTool
.NamedWriteableRegistry
errorThis fix coincides with opensearch-project/anomaly-detection#1164 - see there for more details on the original issue.
This change injects the
NamedWriteableRegistry
to the AD-related tools, in order to construct the AD node client with its updated constructor params that now requires aNamedWriteableRegistry
. At a high level, this is used in the node client for being able to successfully serialize/deserialize theGetAnomalyDetectorResponse
used when fetching detector profiles, when theSearchAnomalyDetectorsTool
is invoked where any state-related param is passed down - e.g.,running
/failed
.Detectors filtering bug
There is an issue (uncovered after the above fix was made causing the tests to fail) of detectors with mismatching states not being filtered out. The root cause was that the profile detector transport action response does not include the detector ID by default in the
anomalyDetector
field, hence it was alwaysnull
and nothing was removed from the hits map. This changes that by using the detector name as the key in the hits map, which is returned by default.Miscellaneous
disabled
as a parameter. This caused LLM confusion, since a question like "how many stopped detectors do i have?" could lead to setting the parameters as"disabled": "true"
, or"running": "false"
. This simplifies that by only having one knob to turn instead of two. Additionally, this changes simplifies the filtering logic and the matrix combination of values shrink.The overall impact of these changes is that detector-state-related questions passed to an agent provisioned with the
SearchAnomalyDetectorsTool
now works as expected.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.