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

Extended existing alerting functionality to support preconfigured only action types #64030

Merged

Conversation

YulNaumenko
Copy link
Contributor

@YulNaumenko YulNaumenko commented Apr 21, 2020

Resolve #63166
Extend existing UI to be able to support preconfigured action types.
Current functionality is based on skipping preconfigured action type in xpack.actions.enabledActionTypes: ['.server-log', '.email', '.index'] and having only preconfigured connectors of this action type:
xpack.actions.preconfigured:
- id: 'my-slack1' # action/connector id
actionTypeId: .slack #use the built in slack action type
name: 'Slack #xyz'
# sensitive config like secrets are preferably stored in Kibana keystore
config:
webhookUrl: 'https://hooks.slack.com/services/abcd/efgh/ijklmnopqrstuvwxyz'

User shouldn't be able to create a connector of preconfigured action type:
img1

img2
But still should have an option to attach the preconfigured connectors to an alert:
img3

@YulNaumenko YulNaumenko added Feature:Alerting v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Feature:Actions Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v7.8.0 labels Apr 21, 2020
@YulNaumenko YulNaumenko requested a review from a team as a code owner April 21, 2020 01:02
@YulNaumenko YulNaumenko self-assigned this Apr 21, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-alerting-services (Team:Alerting Services)

Copy link
Member

@pmuellr pmuellr left a comment

Choose a reason for hiding this comment

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

LGTM; tested out various combinations of enabled-via-config action types, pre-configured action types, everything worked as expected

@mikecote mikecote self-requested a review April 21, 2020 19:59
@YulNaumenko YulNaumenko requested a review from gchaps April 21, 2020 23:45
Copy link
Contributor

@mikecote mikecote left a comment

Choose a reason for hiding this comment

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

It seems the pre-configured only actions don't run on the server side, I get the following error:

server    log   [09:34:19.767] [warning][alerting][alerting][plugins][plugins] Alert "3ba5d2d2-12fb-40db-8ed6-a7b4741a56ba" skipped scheduling action "log" because it is disabled

This could be worth an API Integration test to ensure pre-configured only action types work.

It also seems that the sort order is off when mixing pre-configured only action types in the alert flyout (the clickable ones should be first and ordered alphabetically). Below only "Index" and "Server Log" are clickable:

Screen Shot 2020-04-22 at 9 36 08 AM

Copy link
Contributor

@mikecote mikecote left a comment

Choose a reason for hiding this comment

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

So far the remaining from my previous review LGTM, great work! I will defer to @gchaps to review the docs portion. Maybe there's something in common between the docs for preconfigured action types and the docs for preconfigured connectors.

…y-action-types

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
@YulNaumenko YulNaumenko requested a review from mikecote April 22, 2020 20:21
Copy link
Contributor

@gchaps gchaps left a comment

Choose a reason for hiding this comment

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

A few comments

Copy link
Contributor

@mikecote mikecote left a comment

Choose a reason for hiding this comment

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

Getting close, looks like there's two more places on the server side that need to allow preconfigured actions and they should run afterwards.

I use the following test scenario to see if a preconfigured action works:

  • Disable the .server-log action type by removing it from xpack.actions.enabledActionTypes
  • Create a preconfigured server log action type within xpack.actions.preconfigured
  • Create an alert where .kibana_task_manager count is below 1000 and send a server log (preconfigured) as the action
  • Wait for message to display

@YulNaumenko YulNaumenko requested a review from mikecote April 24, 2020 00:15
Copy link
Contributor

@mikecote mikecote left a comment

Choose a reason for hiding this comment

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

LGTM! Pulled down locally and was able to get a preconfigured only connector to log something on the server. Just one comment about the logic within isActionTypeExecutable.

x-pack/plugins/actions/server/action_type_registry.ts Outdated Show resolved Hide resolved
…y-action-types

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@YulNaumenko YulNaumenko merged commit 6bf0e73 into elastic:master Apr 24, 2020
YulNaumenko added a commit to YulNaumenko/kibana that referenced this pull request Apr 24, 2020
…y action types (elastic#64030)

* Extended existing alerting functionality to support preconfigured only action types

* fixed functional test

* Adding documentation

* Fixed UI part due to comments

* added missing tests

* fixed action type execution

* Fixed documentation

* Fixed due to comments

* fixed type checks

* extended isActionExecutable to check exact action id if it is in the preconfigured list
YulNaumenko added a commit to YulNaumenko/kibana that referenced this pull request Apr 25, 2020
…y action types (elastic#64030)

* Extended existing alerting functionality to support preconfigured only action types

* fixed functional test

* Adding documentation

* Fixed UI part due to comments

* added missing tests

* fixed action type execution

* Fixed documentation

* Fixed due to comments

* fixed type checks

* extended isActionExecutable to check exact action id if it is in the preconfigured list
YulNaumenko added a commit to YulNaumenko/kibana that referenced this pull request Apr 27, 2020
…y action types (elastic#64030)

* Extended existing alerting functionality to support preconfigured only action types

* fixed functional test

* Adding documentation

* Fixed UI part due to comments

* added missing tests

* fixed action type execution

* Fixed documentation

* Fixed due to comments

* fixed type checks

* extended isActionExecutable to check exact action id if it is in the preconfigured list
YulNaumenko added a commit that referenced this pull request Apr 27, 2020
…y action types (#64030) (#64525)

* Extended existing alerting functionality to support preconfigured only action types

* fixed functional test

* Adding documentation

* Fixed UI part due to comments

* added missing tests

* fixed action type execution

* Fixed documentation

* Fixed due to comments

* fixed type checks

* extended isActionExecutable to check exact action id if it is in the preconfigured list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Actions Feature:Alerting release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v7.8.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Action type to determine what configuration mode it supports (pre-configured / runtime)
6 participants