Thanks to visit codestin.com
Credit goes to github.com

Skip to content

refactor create duplicate alert check #10544

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

Open
wants to merge 2 commits into
base: 4.19
Choose a base branch
from

Conversation

DaanHoogland
Copy link
Contributor

Description

This PR extracts a method for deciding which alert are allowed to be double.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI
  • test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

see #10367

@DaanHoogland DaanHoogland marked this pull request as ready for review March 11, 2025 15:12
Copy link

codecov bot commented Mar 11, 2025

Codecov Report

Attention: Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.

Project coverage is 15.17%. Comparing base (919c979) to head (8a2a46c).

Files with missing lines Patch % Lines
...rc/main/java/com/cloud/alert/AlertManagerImpl.java 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.19   #10544   +/-   ##
=========================================
  Coverage     15.16%   15.17%           
- Complexity    11336    11337    +1     
=========================================
  Files          5414     5414           
  Lines        475126   475130    +4     
  Branches      57976    57975    -1     
=========================================
+ Hits          72069    72087   +18     
+ Misses       394996   394981   -15     
- Partials       8061     8062    +1     
Flag Coverage Δ
uitests 4.28% <ø> (ø)
unittests 15.89% <87.50%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@DaanHoogland
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@DaanHoogland DaanHoogland added this to the 4.19.3 milestone Mar 11, 2025
@blueorangutan
Copy link

Packaging result [SF]: ✖️ el8 ✖️ el9 ✔️ debian ✖️ suse15. SL-JID 12738

@DaanHoogland DaanHoogland force-pushed the ghi10367-doubleAlerts branch from d303c45 to 0d92d30 Compare March 12, 2025 10:26
@DaanHoogland
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12752

@DaanHoogland
Copy link
Contributor Author

@blueorangutan test

@blueorangutan
Copy link

@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-12679)
Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 50458 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr10544-t12679-kvm-ol8.zip
Smoke tests completed. 132 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_01_redundant_vpc_site2site_vpn Failure 448.78 test_vpc_vpn.py
test_01_vpc_site2site_vpn Failure 309.22 test_vpc_vpn.py

@DaanHoogland DaanHoogland linked an issue Apr 8, 2025 that may be closed by this pull request
@DaanHoogland DaanHoogland force-pushed the ghi10367-doubleAlerts branch from 0d92d30 to 4a1fbe6 Compare May 6, 2025 08:46
Copy link
Contributor

@shwstppr shwstppr left a comment

Choose a reason for hiding this comment

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

Cleanup looks good. Some comments added

@DaanHoogland
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

Copy link
Contributor

@shwstppr shwstppr left a comment

Choose a reason for hiding this comment

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

code lgtm

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 13272

@DaanHoogland
Copy link
Contributor Author

@blueorangutan test

@blueorangutan
Copy link

@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

Copy link
Contributor

@Pearl1594 Pearl1594 left a comment

Choose a reason for hiding this comment

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

code lgtm

@blueorangutan
Copy link

[SF] Trillian test result (tid-13220)
Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 54847 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr10544-t13220-kvm-ol8.zip
Smoke tests completed. 132 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_02_list_cpvm_vm Failure 0.08 test_ssvm.py
test_04_cpvm_internals Failure 0.07 test_ssvm.py

@DaanHoogland DaanHoogland requested a review from Copilot May 7, 2025 06:40
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the duplicate alert check logic in AlertManagerImpl by extracting the conditional alert retrieval into a helper method.

  • Introduces a new static list of alert types designated as trivial.
  • Extracts duplicate alert check logic into the getAlertForTrivialAlertType helper method.
Comments suppressed due to low confidence (2)

server/src/main/java/com/cloud/alert/AlertManagerImpl.java:89

  • [nitpick] Consider renaming the ALERTS constant to TRIVIAL_ALERT_TYPES to more clearly indicate that these alert types bypass duplicate alert checks.
public static final List<AlertType> ALERTS = Arrays.asList(AlertType.ALERT_TYPE_HOST, ...

server/src/main/java/com/cloud/alert/AlertManagerImpl.java:782

  • [nitpick] The method name getAlertForTrivialAlertType can be misleading since it returns a non-null alert only for non-trivial alert types; consider renaming it to better reflect its behavior, such as getExistingAlertForNonTrivialType.
@Nullable private AlertVO getAlertForTrivialAlertType(AlertType alertType, long dataCenterId, Long podId, Long clusterId) {

@DaanHoogland
Copy link
Contributor Author

don’t think they are related but still investigating those two failures:

[SF] Trillian test result (tid-13220) Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8 Total time taken: 54847 seconds Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr10544-t13220-kvm-ol8.zip Smoke tests completed. 132 look OK, 1 have errors, 0 did not run Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_02_list_cpvm_vm Failure 0.08 test_ssvm.py
test_04_cpvm_internals Failure 0.07 test_ssvm.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

5 participants