-
Notifications
You must be signed in to change notification settings - Fork 48
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
Fixed logic to get all alerts for a detector #965
Fixed logic to get all alerts for a detector #965
Conversation
Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com>
const alertsPromisesRes = await Promise.allSettled(getAlertsPromises); | ||
startIndex += alertsCount; | ||
} while ( | ||
// If we get 10,000 alerts as part of the previous call then there might be more alerts to fetch, |
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.
Not blocking, but can we create an issue in the alerting/SAP backend repo to track fixing the getAlerts API response, and provide a link to that issue in this comment? That will help track when we should refactor this frontend code.
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.
@riysaxen-amzn Can you create an issue in backend and reference this PR there? Thanks!
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.
Changes LGTM; approving assuming CI passes.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #965 +/- ##
==========================================
- Coverage 31.25% 31.24% -0.01%
==========================================
Files 159 159
Lines 5283 5278 -5
Branches 981 980 -1
==========================================
- Hits 1651 1649 -2
+ Misses 3458 3455 -3
Partials 174 174 ☔ 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/security-analytics-dashboards-plugin/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/security-analytics-dashboards-plugin/backport-2.x
# Create a new branch
git switch --create backport-965-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 03d3b1494f55dbc57934970ab80db3dbe0239fa3
# Push it to GitHub
git push --set-upstream origin backport-965-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/security-analytics-dashboards-plugin/backport-2.x Then, create a pull request where the |
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/security-analytics-dashboards-plugin/backport-2.13 2.13
# Navigate to the new working tree
pushd ../.worktrees/security-analytics-dashboards-plugin/backport-2.13
# Create a new branch
git switch --create backport-965-to-2.13
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 03d3b1494f55dbc57934970ab80db3dbe0239fa3
# Push it to GitHub
git push --set-upstream origin backport-965-to-2.13
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/security-analytics-dashboards-plugin/backport-2.13 Then, create a pull request where the |
Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com>
* Rule editor enhancements (#924) * rule editor enhancements Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> * updated test snapshots Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> * relax validation for author name and description Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> * added validation for level, status, log type in yaml editor Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> * fix rule creation with empty or undefined Id Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> * fixed cypress tests Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> --------- Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> * Fetch all findings and alerts for the detectors when displaying in the tables (#942) * fetching all findings using the pagination query params; optimized api calls for alert flyout, correlations Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> * fetching all alerts; updated correlations UI Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> * addressed PR comments; updated snapshots Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> --------- Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> * fixed logic to get all alerts (#965) Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> --------- Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com>
* Rule editor enhancements (#924) * rule editor enhancements Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> * updated test snapshots Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> * relax validation for author name and description Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> * added validation for level, status, log type in yaml editor Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> * fix rule creation with empty or undefined Id Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> * fixed cypress tests Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> --------- Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> * Fetch all findings and alerts for the detectors when displaying in the tables (#942) * fetching all findings using the pagination query params; optimized api calls for alert flyout, correlations Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> * fetching all alerts; updated correlations UI Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> * addressed PR comments; updated snapshots Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> --------- Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> * fixed logic to get all alerts (#965) Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> --------- Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com> (cherry picked from commit a683e9c) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Rule editor enhancements (#924) * rule editor enhancements * updated test snapshots * relax validation for author name and description * added validation for level, status, log type in yaml editor * fix rule creation with empty or undefined Id * fixed cypress tests --------- * Fetch all findings and alerts for the detectors when displaying in the tables (#942) * fetching all findings using the pagination query params; optimized api calls for alert flyout, correlations * fetching all alerts; updated correlations UI * addressed PR comments; updated snapshots --------- * fixed logic to get all alerts (#965) --------- (cherry picked from commit a683e9c) Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.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>
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/security-analytics-dashboards-plugin/backport-2.11 2.11
# Navigate to the new working tree
pushd ../.worktrees/security-analytics-dashboards-plugin/backport-2.11
# Create a new branch
git switch --create backport-965-to-2.11
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 03d3b1494f55dbc57934970ab80db3dbe0239fa3
# Push it to GitHub
git push --set-upstream origin backport-965-to-2.11
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/security-analytics-dashboards-plugin/backport-2.11 Then, create a pull request where the |
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/security-analytics-dashboards-plugin/backport-2.12 2.12
# Navigate to the new working tree
pushd ../.worktrees/security-analytics-dashboards-plugin/backport-2.12
# Create a new branch
git switch --create backport-965-to-2.12
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 03d3b1494f55dbc57934970ab80db3dbe0239fa3
# Push it to GitHub
git push --set-upstream origin backport-965-to-2.12
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/security-analytics-dashboards-plugin/backport-2.12 Then, create a pull request where the |
Description
The
total_alerts
count of getAlerts API is capped at 10000, so we cannot rely on that count to find the total number of alerts. As a mitigation, the logic has been refactored to fetch alerts until we get less than 10k alerts which would mean there are no more alerts remaining.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.