Skip to content
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

Migrate alerting tools #66

Merged
merged 8 commits into from
Dec 28, 2023
Merged

Conversation

ohltyler
Copy link
Member

@ohltyler ohltyler commented Dec 26, 2023

Description

Migrates the search alerts and search monitors tools to this repo.

Historical PRs:
opensearch-project/ml-commons#1748
opensearch-project/ml-commons#1749

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

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.

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
Copy link

codecov bot commented Dec 26, 2023

Codecov Report

Attention: 27 lines in your changes are missing coverage. Please review.

Comparison is base (30e5255) 81.76% compared to head (02695b8) 82.21%.
Report is 5 commits behind head on main.

Files Patch % Lines
...org/opensearch/agent/tools/SearchMonitorsTool.java 86.13% 10 Missing and 4 partials ⚠️
...a/org/opensearch/agent/tools/SearchAlertsTool.java 83.33% 7 Missing and 3 partials ⚠️
...search/agent/tools/SearchAnomalyDetectorsTool.java 40.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main      #66      +/-   ##
============================================
+ Coverage     81.76%   82.21%   +0.44%     
- Complexity       63      119      +56     
============================================
  Files             6       10       +4     
  Lines           373      686     +313     
  Branches         46       94      +48     
============================================
+ Hits            305      564     +259     
- Misses           38       74      +36     
- Partials         30       48      +18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -12,6 +12,7 @@ buildscript {
opensearch_version = System.getProperty("opensearch.version", "3.0.0-SNAPSHOT")
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
buildVersionQualifier = System.getProperty("build.version_qualifier", "")
kotlin_version = System.getProperty("kotlin.version", "1.8.21")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to use 1.9.22?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using the same as that of common utils which has the AlertingPluginInterface logic we use here.

sb.append("id=").append(monitor.getId()).append(",");
sb.append("name=").append(monitor.getName());
sb.append("}]");
sb.append("TotalMonitors=1");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will that be 1 all the time? What if we find 2/3 monitors?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be 1 all of the time since it is a GetMonitorResponse: https://opensearch.org/docs/latest/observing-your-data/alerting/api/#get-monitor

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment on line 93/94 above as well.

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
@ohltyler
Copy link
Member Author

ohltyler commented Dec 28, 2023

Build failure is due to some refactoring change in AD plugin, and will resolve once opensearch-project/anomaly-detection#1124 is merged. We can wait to merge until that is in first. Merged!

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
@zane-neo zane-neo merged commit 2f06f6f into opensearch-project:main Dec 28, 2023
13 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Dec 28, 2023
* Add search alerts tool

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>

* Add search monitors tool

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>

* Add param tests and number parsing error handling

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>

* Add for list-based params

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>

* Add error logs

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>

* Fix isNumeric var

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>

* Minor test coverage increase & cleanup

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>

* Cover few edge cases when param parsing

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>

---------

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
(cherry picked from commit 2f06f6f)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@ohltyler ohltyler deleted the alerting-tools branch December 28, 2023 16:38
ohltyler pushed a commit that referenced this pull request Dec 28, 2023
(cherry picked from commit 2f06f6f)

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
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>
yuye-aws pushed a commit to yuye-aws/skills that referenced this pull request Apr 26, 2024
(cherry picked from commit 2f06f6f)

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
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 <yuyezhu@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants