-
Notifications
You must be signed in to change notification settings - Fork 73
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
Add rule validation in AnomalyDetector constructor #1341
Conversation
This commit introduces rule validation within the AnomalyDetector constructor. Any validation errors are now propagated and displayed on the frontend to ensure immediate feedback. Testing: * Verified that validation errors are properly propagated and shown on the frontend. * Added UTs to cover the new validation logic. Signed-off-by: Kaituo Li <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1341 +/- ##
============================================
+ Coverage 79.68% 80.08% +0.39%
- Complexity 5630 5675 +45
============================================
Files 533 533
Lines 23410 23429 +19
Branches 2323 2335 +12
============================================
+ Hits 18654 18762 +108
+ Misses 3651 3563 -88
+ Partials 1105 1104 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
* @param configId config Id | ||
* @return a map of model id to its memory size | ||
*/ | ||
public Map<String, Long> getModelSize(String configId) { |
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.
where these just never used anymore?
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.
yeah, they are not used after recent refactoring.
|
||
// Null check for features | ||
if (features == null) { | ||
// Cannot proceed with validation if features are null but rules are not 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.
nit: could add || features.isEmpty()
same we do for rules above
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.
yeah, fixed.
// Null check for features | ||
if (features == null) { | ||
// Cannot proceed with validation if features are null but rules are not null | ||
this.errorMessage = "Suppression Rule Error: Features are not defined while suppression rules are provided."; |
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.
nit: "Suppression Rule Error" can be put in a constant
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.
fixed.
|| thresholdType == ThresholdType.EXPECTED_OVER_ACTUAL_RATIO) { | ||
// Check if the value is not NaN | ||
double value = condition.getValue(); | ||
if (Double.isNaN(value)) { |
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.
btw I will be changing value section to be okay with Null if threshold type is ACTUAL_IS_OVER_EXPECTED or EXPECTED_IS_OVER_ACTUAL. Will make sure those aren't passed to RCF and seen as not a rule in that case later on too
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.
thanks.
Signed-off-by: Kaituo Li <[email protected]>
* Add rule validation in AnomalyDetector constructor This commit introduces rule validation within the AnomalyDetector constructor. Any validation errors are now propagated and displayed on the frontend to ensure immediate feedback. Testing: * Verified that validation errors are properly propagated and shown on the frontend. * Added UTs to cover the new validation logic. Signed-off-by: Kaituo Li <[email protected]> * address Amit's comments Signed-off-by: Kaituo Li <[email protected]> --------- Signed-off-by: Kaituo Li <[email protected]> (cherry picked from commit 9cdbcee) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Add rule validation in AnomalyDetector constructor This commit introduces rule validation within the AnomalyDetector constructor. Any validation errors are now propagated and displayed on the frontend to ensure immediate feedback. Testing: * Verified that validation errors are properly propagated and shown on the frontend. * Added UTs to cover the new validation logic. * address Amit's comments --------- (cherry picked from commit 9cdbcee) Signed-off-by: Kaituo Li <[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>
Description
This commit introduces rule validation within the AnomalyDetector constructor. Any validation errors are now propagated and displayed on the frontend to ensure immediate feedback.
Testing:
Check List
--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.