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

License checks for alerts plugin #85649

Merged
merged 13 commits into from
Dec 15, 2020
Merged

License checks for alerts plugin #85649

merged 13 commits into from
Dec 15, 2020

Conversation

YulNaumenko
Copy link
Contributor

@YulNaumenko YulNaumenko commented Dec 10, 2020

Resolve #60767

In this PR, we're making alert types license aware and adding the proper behaviors to the APIs.
This branch is a feature branch that sub PRs are merging into until the feature is complete.

[Alerts][License] Define minimum license required for each alert type (#84997)

  1. Add a minimumLicenseRequired attribute to each alert type definition
  2. Define a minimum license requirement in each alert type
  3. Only '.geo-containment' and '.geo-threshold' is under the gold+ license. The rest of alert types was set to basic

[Alerts][License] Add license checks to alerts HTTP APIs and execution (#85223)

  1. Was added 403 Forbidder response for executing alert API (create, update, enable, disable, muteAll, unmuteAll, muteInstance, unmuteInstance) with the higher level alert type license.
  2. Delete API remain available to remove higher license alerts.
  3. When the task is running for a scheduled alert with the higher level license, the event log will provide the next execution status:
executionStatus: {lastExecutionDate: "2020-12-09T06:30:15.749Z", status: "error", error: {reason: "license",…}}
error: {reason: "license",…}
message: "Alert type .geo-threshold is disabled because your basic license does not support it. Please upgrade your license."
reason: "license"
lastExecutionDate: "2020-12-09T06:30:15.749Z"
status: "error"

[Alerting UI][License] Disable alert types in UI when the license doesn't support it. (#85496)

Current PR covers the licensing UI for the alert types.

  1. In the Alert flyouts (Create and Edit), alert types disabled by the license restriction is displayed similarly as unavailable action types in the Connector flyout:
    img
    The sort order is a bit more complicated then for action types, because we have groups of alert types by the solution.
    Current PR implements sort order by keeping the solutions alphabet order if the solution contains at least one available alert type and if all alert types under solution is disabled by the license restriction it will be sorted after the solutions with available alert types.
    Then inside the solution group we sort solution items inside by the license availability and then alphabetically by alert type name.
  2. Alerts, which has alert type belongs to the higher order license displayed disabled with the tooltip in the alerts list in Management UI, similarly as it designed for connectors list, but without icon tip, because details link is available.

Screen Shot 2020-12-10 at 10 38 31 AM

  1. User have a possibility to delete alerts with the higher order alert type license (same as for the action types).

  2. There is an option to navigate to the alert details page. The purpose of this usage is to see the error message generated by the current alert execution behavior for the expired alerts - continue running with the error license reason.

Screen Shot 2020-12-10 at 11 43 52 AM

User is able to manage the license from this message.
  1. All messages for licensing tooltips are corresponding to the action types design.

YulNaumenko and others added 5 commits December 8, 2020 12:41
…#84997)

* Define minimum license required for each alert type

* fixed typechecks

* fixed tests

* fixed tests

* fixed due to comments

* fixed due to comments

* removed file

* removed casting to LicenseType
#85223)

* [Alerts][License] Add license checks to alerts HTTP APIs and execution

* fixed typechecks

* resolved conflicts

* resolved conflicts

* added router tests

* fixed typechecks

* added license check support for alert task running

* fixed typechecks

* added integration tests

* fixed due to comments

* fixed due to comments

* fixed tests

* fixed typechecks
…sn't support it. (#85496)

* [Alerting UI][License] Disable alert types in UI when the license doesn't support it.

* fixed typechecks

* added licensing for alert list and details page

* fixed multy select menu

* fixed due to comments

* fixed due to comments

* fixed due to comments
@YulNaumenko YulNaumenko added Feature:Alerting v8.0.0 release_note:skip Skip the PR/issue when compiling release notes needs_docs Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v7.11.0 labels Dec 10, 2020
@YulNaumenko YulNaumenko self-assigned this Dec 10, 2020
@YulNaumenko YulNaumenko marked this pull request as ready for review December 10, 2020 22:24
@YulNaumenko YulNaumenko requested review from a team as code owners December 10, 2020 22:24
@YulNaumenko YulNaumenko requested a review from a team December 10, 2020 22:24
@YulNaumenko YulNaumenko requested a review from a team as a code owner December 10, 2020 22:24
@elasticmachine
Copy link
Contributor

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

Copy link
Contributor

@mdefazio mdefazio left a comment

Choose a reason for hiding this comment

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

Approving—nothing looks different from the previous PR :)

@botelastic botelastic bot added Team:APM All issues that need APM UI Team support Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability labels Dec 10, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/uptime (Team:uptime)

@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui (Team:apm)

Copy link
Contributor

@phillipb phillipb left a comment

Choose a reason for hiding this comment

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

Infra change LGTM

@gchaps
Copy link
Contributor

gchaps commented Dec 10, 2020

Suggestions for texxt:

Error in 1 alert

View | Dismiss


Cannot run alert

Alert metrics.alert.inventory.threshold is disabled because it requires a Gold license.

Dismiss | Manage license

@alexfrancoeur Can you please weigh in the wording around licensing?

Copy link
Contributor

@smith smith left a comment

Choose a reason for hiding this comment

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

APM changes look good.

Copy link
Contributor

@FrankHassanabad FrankHassanabad left a comment

Choose a reason for hiding this comment

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

LGTM

@gmmorris
Copy link
Contributor

@elasticmachine merge upstream

@mikecote mikecote self-requested a review December 14, 2020 13:14
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.

Feature LGTM! I ran a scenario where I created an alert in gold, downgraded my license and saw the proper error and UX. 👍

Copy link
Contributor

@ymao1 ymao1 left a comment

Choose a reason for hiding this comment

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

LGTM! Works as expected.

@alexfrancoeur
Copy link

What do you think about this @gchaps? Adding a CTA.

Cannot run alert

Alert metrics.alert.inventory.threshold is disabled because it requires a Gold license. Contact your administrator to upgrade your license.

Dismiss | Manage license

@gchaps
Copy link
Contributor

gchaps commented Dec 14, 2020

@alexfrancoeur, @YulNaumenko. I like the the second sentence with the CTA to contact your administrator. In which, case I think we should remove the "Manage license" link":

Cannot run alert

Alert metrics.alert.inventory.threshold is disabled because it requires a Gold license. Contact your administrator to upgrade your license.

Dismiss

@alexfrancoeur
Copy link

I think it's fine keeping the manage your license link, if they are the administrator, a streamlined navigation experience couldn't hurt. Is there a way we can phrase the text in which the CTA can live with the manage license button?

@YulNaumenko
Copy link
Contributor Author

I think it's fine keeping the manage your license link, if they are the administrator, a streamlined navigation experience couldn't hurt. Is there a way we can phrase the text in which the CTA can live with the manage license button?

Need to check this with @mikecote.
Current design is like this:
Screen Shot 2020-12-14 at 12 54 17 PM

@gchaps
Copy link
Contributor

gchaps commented Dec 15, 2020

For the message

Remove the period at the end of the title: Cannot run alert

We could make the text "upgrade your license" the link. But that still means removing the Manage license button.

@YulNaumenko
Copy link
Contributor Author

For the message

Remove the period at the end of the title: Cannot run alert

We could make the text "upgrade your license" the link. But that still means removing the Manage license button.

I have no objections about naming the link as "upgrade your license". Only wanted to have the same as Connectors UX has.
Screen Shot 2020-12-14 at 4 42 59 PM

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
triggersActionsUi 298 309 +11

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
triggersActionsUi 1.5MB 1.6MB +10.4KB

Distributable file count

id before after diff
default 47138 47902 +764

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
alerts 68.5KB 68.6KB +54.0B
apm 48.8KB 49.0KB +124.0B
total +178.0B

History

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

@YulNaumenko YulNaumenko merged commit 37525f8 into master Dec 15, 2020
gmmorris added a commit to ymao1/kibana that referenced this pull request Dec 15, 2020
* master: (66 commits)
  [Alerting] fixes broken Alerting Example plugin (elastic#85774)
  [APM] Service overview instances table (elastic#85770)
  [Security Solution] Unskip timeline creation Cypress test (elastic#85871)
  properly recognize enterprise licenses (elastic#85849)
  [SecuritySolution][Detections] Adds SavedObject persistence to Signals Migrations (elastic#85690)
  [TSVB] Fix functional tests flakiness and unskip them (elastic#85388)
  [Fleet] Change permissions for Fleet enroll role (elastic#85802)
  Gauge visualization can no longer be clicked to filter on values since Kibana 7.10.0 (elastic#84768)
  [Security Solution][Detections] Add alert source to detection rule action context (elastic#85488)
  [Discover] Don't display hide/show button for histogram when there's no time filter (elastic#85424)
  skip flaky suite (elastic#78553)
  License checks for alerts plugin (elastic#85649)
  skip flaky suite (elastic#84992)
  skip 'query return results valid for scripted field' elastic#78553
  Allow action types to perform their own mustache variable escaping in parameter templates (elastic#83919)
  [ML] More machine learning links in doc_links_service.ts (elastic#85365)
  Removed Alerting & Event Log deprecated fields that should not be using (elastic#85652)
  Closes elastic#79995 by adding new tab in transaction details to show related trace logs. (elastic#85859)
  Fix outdated jest snapshot
  [Maps] Surface on prem EMS (elastic#85729)
  ...
@spalger spalger deleted the alerts/license-checks branch May 8, 2022 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Alerting needs_docs release_note:skip Skip the PR/issue when compiling release notes Team:APM All issues that need APM UI Team support Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Alert framework level license check