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

Add workflowId field in alert model #463

Merged
merged 1 commit into from
Jun 22, 2023

Conversation

eirsep
Copy link
Member

@eirsep eirsep commented Jun 21, 2023

Description

Add workflowId field in alert model.
This field would be populated when alerts are created by monitors executing within a workflow. Else field would be an empty string

Signed-off-by: Surya Sashank Nistala <[email protected]>
@codecov
Copy link

codecov bot commented Jun 21, 2023

Codecov Report

Merging #463 (a508699) into main (f1c0f1d) will decrease coverage by 0.06%.
The diff coverage is 62.50%.

@@             Coverage Diff              @@
##               main     #463      +/-   ##
============================================
- Coverage     73.83%   73.77%   -0.06%     
- Complexity      824      825       +1     
============================================
  Files           127      127              
  Lines          5354     5366      +12     
  Branches        675      680       +5     
============================================
+ Hits           3953     3959       +6     
- Misses         1104     1106       +2     
- Partials        297      301       +4     
Impacted Files Coverage Δ
...lin/org/opensearch/commons/alerting/model/Alert.kt 74.74% <62.50%> (-0.72%) ⬇️

... and 1 file with indirect coverage changes

@@ -22,6 +22,7 @@ data class Alert(
val version: Long = NO_VERSION,
val schemaVersion: Int = NO_SCHEMA_VERSION,
val monitorId: String,
val workflowId: String,
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be optional? Normal monitor executions will fail when creating an alert since workflows are not there. Also the vice versa might be an issue since the chained alert won't have a monitor id.

Copy link
Member Author

@eirsep eirsep Jun 22, 2023

Choose a reason for hiding this comment

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

monitor id would be null or empty for chained alerts
workflow Id would be null or empty for non-workflow alert

in the constructors we handle each case and set "" to handle the empty case for either field

@eirsep eirsep merged commit 110bf01 into opensearch-project:main Jun 22, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jun 22, 2023
Signed-off-by: Surya Sashank Nistala <[email protected]>
(cherry picked from commit 110bf01)
eirsep added a commit that referenced this pull request Jun 22, 2023
Signed-off-by: Surya Sashank Nistala <[email protected]>
(cherry picked from commit 110bf01)

Co-authored-by: Surya Sashank Nistala <[email protected]>
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.5 failed:

The process '/usr/bin/git' failed with exit code 128

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/common-utils/backport-2.5 2.5
# Navigate to the new working tree
pushd ../.worktrees/common-utils/backport-2.5
# Create a new branch
git switch --create backport-463-to-2.5
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 110bf0158417c3e06d08fafe6ebdccf900aecd0d
# Push it to GitHub
git push --set-upstream origin backport-463-to-2.5
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/common-utils/backport-2.5

Then, create a pull request where the base branch is 2.5 and the compare/head branch is backport-463-to-2.5.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.9 failed:

The process '/usr/bin/git' failed with exit code 128

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/common-utils/backport-2.9 2.9
# Navigate to the new working tree
pushd ../.worktrees/common-utils/backport-2.9
# Create a new branch
git switch --create backport-463-to-2.9
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 110bf0158417c3e06d08fafe6ebdccf900aecd0d
# Push it to GitHub
git push --set-upstream origin backport-463-to-2.9
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/common-utils/backport-2.9

Then, create a pull request where the base branch is 2.9 and the compare/head branch is backport-463-to-2.9.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.7 failed:

The process '/usr/bin/git' failed with exit code 128

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/common-utils/backport-2.7 2.7
# Navigate to the new working tree
pushd ../.worktrees/common-utils/backport-2.7
# Create a new branch
git switch --create backport-463-to-2.7
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 110bf0158417c3e06d08fafe6ebdccf900aecd0d
# Push it to GitHub
git push --set-upstream origin backport-463-to-2.7
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/common-utils/backport-2.7

Then, create a pull request where the base branch is 2.7 and the compare/head branch is backport-463-to-2.7.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.11 failed:

The process '/usr/bin/git' failed with exit code 128

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/common-utils/backport-2.11 2.11
# Navigate to the new working tree
pushd ../.worktrees/common-utils/backport-2.11
# Create a new branch
git switch --create backport-463-to-2.11
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 110bf0158417c3e06d08fafe6ebdccf900aecd0d
# Push it to GitHub
git push --set-upstream origin backport-463-to-2.11
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/common-utils/backport-2.11

Then, create a pull request where the base branch is 2.11 and the compare/head branch is backport-463-to-2.11.

@jowg-amazon jowg-amazon removed backport 2.9 backport PR to 2.9 backport 2.11 labels Mar 13, 2024
AWSHurneyt pushed a commit to AWSHurneyt/common-utils that referenced this pull request Apr 12, 2024
…oject#464)

Signed-off-by: Surya Sashank Nistala <[email protected]>
(cherry picked from commit 110bf01)

Co-authored-by: Surya Sashank Nistala <[email protected]>
Signed-off-by: AWSHurneyt <[email protected]>
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