forked from opensearch-project/alerting
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature/composite workflow execution v1 #1
Open
stevanbz
wants to merge
18
commits into
feature/composite-workflow-transport-crud-execution
Choose a base branch
from
feature/composite-workflow-execution-v1
base: feature/composite-workflow-transport-crud-execution
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 12 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
56bba0d
Added integrations tests for checking workflow creation and update sc…
stevanbz e0af305
Added transport layer for getting and deleting the workflow
stevanbz feebf0e
Updated getting and deleting the workflow in order to check if the mo…
stevanbz 22eb900
When deleting the monitor, added a check if the monitor is part of th…
stevanbz d6269ab
Added transport workflow execution layer. Adjusted monitor runners to…
stevanbz c2588a0
Removed unused classes
stevanbz ad01b70
Added rest action for executing the workflow
stevanbz 5190726
Added integration tests for workflow execution. Added script modules …
stevanbz a1e0408
Added workflow execution run result and refactored ExecutionWorkflowR…
stevanbz a77d9bb
Added integration tests for workflow execution. PR comments addressed
stevanbz b6f17a8
Code adjusted to comments. Wrapped exceptions when executing workflow
stevanbz 8ded8b8
Added logic for deleting the workflow underlying monitors. Added vali…
stevanbz a593d38
Added workflow metadata
stevanbz 8e0d28d
Added mappings for the workflow-metadata. Added integration tests for…
stevanbz af86c69
Renamed properties. Added workflow metadata dryrun integration test t…
stevanbz 4dd13ed
Added workflow integration test for verifying changing the order of t…
stevanbz a14dfea
Renamed methods for generating the workflows
stevanbz 486c5ab
Added test when updating the non-existing workflow
stevanbz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ package org.opensearch.alerting | |
import org.opensearch.action.ActionRequest | ||
import org.opensearch.action.ActionResponse | ||
import org.opensearch.alerting.action.ExecuteMonitorAction | ||
import org.opensearch.alerting.action.ExecuteWorkflowAction | ||
import org.opensearch.alerting.action.GetDestinationsAction | ||
import org.opensearch.alerting.action.GetEmailAccountAction | ||
import org.opensearch.alerting.action.GetEmailGroupAction | ||
|
@@ -27,6 +28,7 @@ import org.opensearch.alerting.core.settings.ScheduledJobSettings | |
import org.opensearch.alerting.resthandler.RestAcknowledgeAlertAction | ||
import org.opensearch.alerting.resthandler.RestDeleteMonitorAction | ||
import org.opensearch.alerting.resthandler.RestExecuteMonitorAction | ||
import org.opensearch.alerting.resthandler.RestExecuteWorkflowAction | ||
import org.opensearch.alerting.resthandler.RestGetAlertsAction | ||
import org.opensearch.alerting.resthandler.RestGetDestinationsAction | ||
import org.opensearch.alerting.resthandler.RestGetEmailAccountAction | ||
|
@@ -44,19 +46,24 @@ import org.opensearch.alerting.settings.LegacyOpenDistroAlertingSettings | |
import org.opensearch.alerting.settings.LegacyOpenDistroDestinationSettings | ||
import org.opensearch.alerting.transport.TransportAcknowledgeAlertAction | ||
import org.opensearch.alerting.transport.TransportDeleteMonitorAction | ||
import org.opensearch.alerting.transport.TransportDeleteWorkflowAction | ||
import org.opensearch.alerting.transport.TransportExecuteMonitorAction | ||
import org.opensearch.alerting.transport.TransportExecuteWorkflowAction | ||
import org.opensearch.alerting.transport.TransportGetAlertsAction | ||
import org.opensearch.alerting.transport.TransportGetDestinationsAction | ||
import org.opensearch.alerting.transport.TransportGetEmailAccountAction | ||
import org.opensearch.alerting.transport.TransportGetEmailGroupAction | ||
import org.opensearch.alerting.transport.TransportGetFindingsSearchAction | ||
import org.opensearch.alerting.transport.TransportGetMonitorAction | ||
import org.opensearch.alerting.transport.TransportGetWorkflowAction | ||
import org.opensearch.alerting.transport.TransportIndexMonitorAction | ||
import org.opensearch.alerting.transport.TransportIndexWorkflowAction | ||
import org.opensearch.alerting.transport.TransportSearchEmailAccountAction | ||
import org.opensearch.alerting.transport.TransportSearchEmailGroupAction | ||
import org.opensearch.alerting.transport.TransportSearchMonitorAction | ||
import org.opensearch.alerting.util.DocLevelMonitorQueries | ||
import org.opensearch.alerting.util.destinationmigration.DestinationMigrationCoordinator | ||
import org.opensearch.alerting.workflow.WorkflowRunnerService | ||
import org.opensearch.client.Client | ||
import org.opensearch.cluster.metadata.IndexNameExpressionResolver | ||
import org.opensearch.cluster.node.DiscoveryNodes | ||
|
@@ -80,6 +87,7 @@ import org.opensearch.commons.alerting.model.Monitor | |
import org.opensearch.commons.alerting.model.QueryLevelTrigger | ||
import org.opensearch.commons.alerting.model.ScheduledJob | ||
import org.opensearch.commons.alerting.model.SearchInput | ||
import org.opensearch.commons.alerting.model.Workflow | ||
import org.opensearch.env.Environment | ||
import org.opensearch.env.NodeEnvironment | ||
import org.opensearch.index.IndexModule | ||
|
@@ -117,8 +125,10 @@ internal class AlertingPlugin : PainlessExtension, ActionPlugin, ScriptPlugin, R | |
@JvmField val OPEN_SEARCH_DASHBOARDS_USER_AGENT = "OpenSearch-Dashboards" | ||
@JvmField val UI_METADATA_EXCLUDE = arrayOf("monitor.${Monitor.UI_METADATA_FIELD}") | ||
@JvmField val MONITOR_BASE_URI = "/_plugins/_alerting/monitors" | ||
@JvmField val WORKFLOW_BASE_URI = "/_plugins/_alerting/workflows" | ||
@JvmField val DESTINATION_BASE_URI = "/_plugins/_alerting/destinations" | ||
@JvmField val LEGACY_OPENDISTRO_MONITOR_BASE_URI = "/_opendistro/_alerting/monitors" | ||
@JvmField val LEGACY_OPENDISTRO_WORKFLOW_BASE_URI = "/_opendistro/_alerting/workflows" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This only for legacy APIs. This is a new API, so we should not have this |
||
@JvmField val LEGACY_OPENDISTRO_DESTINATION_BASE_URI = "/_opendistro/_alerting/destinations" | ||
@JvmField val EMAIL_ACCOUNT_BASE_URI = "$DESTINATION_BASE_URI/email_accounts" | ||
@JvmField val EMAIL_GROUP_BASE_URI = "$DESTINATION_BASE_URI/email_groups" | ||
|
@@ -129,6 +139,7 @@ internal class AlertingPlugin : PainlessExtension, ActionPlugin, ScriptPlugin, R | |
} | ||
|
||
lateinit var runner: MonitorRunnerService | ||
lateinit var workflowRunner: WorkflowRunnerService | ||
lateinit var scheduler: JobScheduler | ||
lateinit var sweeper: JobSweeper | ||
lateinit var scheduledJobIndices: ScheduledJobIndices | ||
|
@@ -153,6 +164,7 @@ internal class AlertingPlugin : PainlessExtension, ActionPlugin, ScriptPlugin, R | |
RestIndexMonitorAction(), | ||
RestSearchMonitorAction(settings, clusterService), | ||
RestExecuteMonitorAction(), | ||
RestExecuteWorkflowAction(), | ||
RestAcknowledgeAlertAction(), | ||
RestScheduledJobStatsHandler("_alerting"), | ||
RestSearchEmailAccountAction(), | ||
|
@@ -180,8 +192,11 @@ internal class AlertingPlugin : PainlessExtension, ActionPlugin, ScriptPlugin, R | |
ActionPlugin.ActionHandler(SearchEmailGroupAction.INSTANCE, TransportSearchEmailGroupAction::class.java), | ||
ActionPlugin.ActionHandler(GetDestinationsAction.INSTANCE, TransportGetDestinationsAction::class.java), | ||
ActionPlugin.ActionHandler(AlertingActions.GET_ALERTS_ACTION_TYPE, TransportGetAlertsAction::class.java), | ||
ActionPlugin.ActionHandler(AlertingActions.GET_FINDINGS_ACTION_TYPE, TransportGetFindingsSearchAction::class.java) | ||
|
||
ActionPlugin.ActionHandler(AlertingActions.GET_FINDINGS_ACTION_TYPE, TransportGetFindingsSearchAction::class.java), | ||
ActionPlugin.ActionHandler(AlertingActions.INDEX_WORKFLOW_ACTION_TYPE, TransportIndexWorkflowAction::class.java), | ||
ActionPlugin.ActionHandler(AlertingActions.GET_WORKFLOW_ACTION_TYPE, TransportGetWorkflowAction::class.java), | ||
ActionPlugin.ActionHandler(AlertingActions.DELETE_WORKFLOW_ACTION_TYPE, TransportDeleteWorkflowAction::class.java), | ||
ActionPlugin.ActionHandler(ExecuteWorkflowAction.INSTANCE, TransportExecuteWorkflowAction::class.java) | ||
) | ||
} | ||
|
||
|
@@ -193,7 +208,8 @@ internal class AlertingPlugin : PainlessExtension, ActionPlugin, ScriptPlugin, R | |
QueryLevelTrigger.XCONTENT_REGISTRY, | ||
BucketLevelTrigger.XCONTENT_REGISTRY, | ||
ClusterMetricsInput.XCONTENT_REGISTRY, | ||
DocumentLevelTrigger.XCONTENT_REGISTRY | ||
DocumentLevelTrigger.XCONTENT_REGISTRY, | ||
Workflow.XCONTENT_REGISTRY | ||
) | ||
} | ||
|
||
|
@@ -227,6 +243,21 @@ internal class AlertingPlugin : PainlessExtension, ActionPlugin, ScriptPlugin, R | |
.registerDocLevelMonitorQueries(DocLevelMonitorQueries(client, clusterService)) | ||
.registerConsumers() | ||
.registerDestinationSettings() | ||
workflowRunner = WorkflowRunnerService | ||
.registerClusterService(clusterService) | ||
.registerClient(client) | ||
.registerNamedXContentRegistry(xContentRegistry) | ||
.registerScriptService(scriptService) | ||
.registerSettings(settings) | ||
.registerThreadPool(threadPool) | ||
.registerAlertIndices(alertIndices) | ||
.registerInputService(InputService(client, scriptService, namedWriteableRegistry, xContentRegistry)) | ||
.registerTriggerService(TriggerService(scriptService)) | ||
.registerAlertService(AlertService(client, xContentRegistry, alertIndices)) | ||
.registerDocLevelMonitorQueries(DocLevelMonitorQueries(client, clusterService)) | ||
.registerWorkflowService(WorkflowService(client, xContentRegistry)) | ||
.registerConsumers() | ||
.registerDestinationSettings() | ||
scheduledJobIndices = ScheduledJobIndices(client.admin(), clusterService) | ||
docLevelMonitorQueries = DocLevelMonitorQueries(client, clusterService) | ||
scheduler = JobScheduler(threadPool, runner) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
let's discuss offline about cluster/node level settings for composite workflows
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.
Ok sounds good.