Skip to content

apis for get workflow alerts and acknowledge chained alerts#472

Merged
eirsep merged 3 commits intoopensearch-project:mainfrom
eirsep:get
Jul 6, 2023
Merged

apis for get workflow alerts and acknowledge chained alerts#472
eirsep merged 3 commits intoopensearch-project:mainfrom
eirsep:get

Conversation

@eirsep
Copy link
Copy Markdown
Member

@eirsep eirsep commented Jul 4, 2023

Description

  • Adds APIs for get workflow alerts and acknowledge chained alerts
  • adds associated alerts field for chained alerts: list of alert ids generated by monitors that are part of the chained alert trigger condition.

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: Surya Sashank Nistala <snistala@amazon.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Jul 4, 2023

Codecov Report

Merging #472 (6f16af3) into main (37e36b7) will increase coverage by 0.59%.
The diff coverage is 75.00%.

@@             Coverage Diff              @@
##               main     #472      +/-   ##
============================================
+ Coverage     73.77%   74.37%   +0.59%     
- Complexity      825      859      +34     
============================================
  Files           127      129       +2     
  Lines          5366     5573     +207     
  Branches        680      683       +3     
============================================
+ Hits           3959     4145     +186     
- Misses         1106     1125      +19     
- Partials        301      303       +2     
Impacted Files Coverage Δ
...search/commons/alerting/AlertingPluginInterface.kt 56.79% <57.14%> (+0.07%) ⬆️
...lin/org/opensearch/commons/alerting/model/Alert.kt 73.49% <67.83%> (-1.25%) ⬇️
...ommons/alerting/action/GetWorkflowAlertsRequest.kt 95.00% <95.00%> (ø)
...nsearch/commons/alerting/action/AlertingActions.kt 100.00% <100.00%> (ø)
...search/commons/alerting/action/GetAlertsRequest.kt 97.50% <100.00%> (+0.35%) ⬆️
...mmons/alerting/action/GetWorkflowAlertsResponse.kt 100.00% <100.00%> (ø)

... and 4 files with indirect coverage changes

Signed-off-by: Surya Sashank Nistala <snistala@amazon.com>
ActionType(SUBSCRIBE_FINDINGS_ACTION_NAME, ::SubscribeFindingsResponse)

val ACKNOWLEDGE_CHAINED_ALERTS_ACTION_TYPE =
ActionType(ACKNOWLEDGE_CHAINED_ALERTS_ACTION_NAME, ::AcknowledgeAlertResponse)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

missing @JvmField annotation?

val actionExecutionResults: List<ActionExecutionResult>,
val aggregationResultBucket: AggregationResultBucket? = null,
val executionId: String? = null,
val associatedAlertIds: List<String>,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we make associatedAlertIds optional also like executionId?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I referred findingIds in the same class which is list of string which is only applicable to the doc level alerts. that is not optional and filled with empty list.

This maintains consistency

constructor(
alerts: List<Alert>,
associatedAlerts: List<Alert>,
totalAlerts: Int?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why is totalAlerts nullable?

Copy link
Copy Markdown
Member Author

@eirsep eirsep Jul 6, 2023

Choose a reason for hiding this comment

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

this is a parallel api to get alerts. Keeping it consistent with the response structure of GetAlertsResponse which has totalAlerts as nullable

https://github.com/opensearch-project/common-utils/blob/main/src/main/kotlin/org/opensearch/commons/alerting/action/GetAlertsResponse.kt#L17

Signed-off-by: Surya Sashank Nistala <snistala@amazon.com>
@eirsep eirsep merged commit b555e24 into opensearch-project:main Jul 6, 2023
@opensearch-trigger-bot
Copy link
Copy Markdown
Contributor

The backport to 2.x failed:

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

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-472-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 b555e248898a32972567f4f7e94efd21e2872c4f
# Push it to GitHub
git push --set-upstream origin backport/backport-472-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-472-to-2.x.

eirsep added a commit to eirsep/common-utils that referenced this pull request Jul 6, 2023
…ch-project#472)

Signed-off-by: Surya Sashank Nistala <snistala@amazon.com>
eirsep added a commit to eirsep/common-utils that referenced this pull request Jul 6, 2023
…ch-project#472)

Signed-off-by: Surya Sashank Nistala <snistala@amazon.com>
eirsep added a commit to eirsep/common-utils that referenced this pull request Jul 7, 2023
…ch-project#472)

Signed-off-by: Surya Sashank Nistala <snistala@amazon.com>
eirsep added a commit to eirsep/common-utils that referenced this pull request Jul 7, 2023
…ch-project#472)

Signed-off-by: Surya Sashank Nistala <snistala@amazon.com>
eirsep added a commit that referenced this pull request Jul 7, 2023
)

Signed-off-by: Surya Sashank Nistala <snistala@amazon.com>
AWSHurneyt pushed a commit to AWSHurneyt/common-utils that referenced this pull request Apr 12, 2024
…ch-project#472) (opensearch-project#473)

Signed-off-by: Surya Sashank Nistala <snistala@amazon.com>
Signed-off-by: AWSHurneyt <hurneyt@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.

3 participants