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

Alerting: Add smart type selection when creating a new alert rule #71071

Merged
merged 26 commits into from
Jul 13, 2023

Conversation

soniaAguilarPeiron
Copy link
Member

@soniaAguilarPeiron soniaAguilarPeiron commented Jul 5, 2023

What is this feature?

This pull request introduces a switch button for rule type based on the user's selected queries.

In order to accomplish this, it is necessary to ensure that the cloud alert data (currently managed by the form data) and the grafana-managed alert data (currently managed by the reducer) remain synchronized.

Why do we need this feature?

We aim to simplify the user experience by letting the user be focused on the query or queries they want to use to create the alert, and afterwards, allowing or not to switch the alert rule type.

Who is this feature for?

All users

Which issue(s) does this PR fix?:

Fixes #68099

Special notes for your reviewer:

When creating a new alert rule:

new-smart.mov

When editing existing one:

editing-smart.mp4

(updated texts in last commit)

When editing existing rule:

Screenshot 2023-07-13 at 16 30 04 Screenshot 2023-07-13 at 16 30 35

When creating a new alert rule

Screenshot 2023-07-13 at 16 33 00 Screenshot 2023-07-13 at 16 32 48 Screenshot 2023-07-13 at 16 32 03 Screenshot 2023-07-13 at 16 31 56

Please check that:

  • It works as expected from a user's perspective.
  • If this is a pre-GA feature, it is behind a feature toggle.
  • The docs are updated, and if this is a notable improvement, it's added to our What's New doc.

@soniaAguilarPeiron soniaAguilarPeiron added this to the 10.1.x milestone Jul 5, 2023
@soniaAguilarPeiron soniaAguilarPeiron requested a review from a team as a code owner July 5, 2023 11:10
@soniaAguilarPeiron soniaAguilarPeiron requested review from gillesdemey and armandgrillet and removed request for a team July 5, 2023 11:10
@soniaAguilarPeiron soniaAguilarPeiron self-assigned this Jul 5, 2023
@soniaAguilarPeiron soniaAguilarPeiron marked this pull request as draft July 5, 2023 11:10
@soniaAguilarPeiron soniaAguilarPeiron force-pushed the alerting/smart-selection branch 3 times, most recently from ab9d664 to 4d5ffc1 Compare July 12, 2023 09:59
@soniaAguilarPeiron soniaAguilarPeiron merged commit 718401d into main Jul 13, 2023
14 checks passed
@soniaAguilarPeiron soniaAguilarPeiron deleted the alerting/smart-selection branch July 13, 2023 15:02
polibb pushed a commit that referenced this pull request Jul 14, 2023
…1071)

* Add smart type selection when creating a new alert rule

* Auto switch when switch button has not been clicked yet

* remove unnecessay code after the last refacgtor

* Refactor

* Remove unneeded prop

* Move SmartAlertTypeDetector to its own file

* Fix tests

* Refactor: new useSetExpressionAndDataSource hook

* Fix expressions not been propagated when switching from one type to another

* Change texts

* Update tests

* Update text in switch button

* Update texts and tests

* Refactor: move code to getCanSwitch new method

* Move smart alert after queries and remove auto-switch

* Remove expressions and restore them when switching between grafana and cloud type

* Rename previous expression state

* Fix tests

* Add data source name for data source-managed alert selection

* Update reducer when changing cloud data source

* PR review suggestions

* PR review suggestions 2nd part

* PR review suggestions 3th part

* Fix canSwitch

* Update texts on smart alert

---------

Co-authored-by: Virginia Cepeda <virginia.cepeda@grafana.com>
@ricky-undeadcoders ricky-undeadcoders modified the milestones: 10.1.x, 10.1.0 Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

'Smart' selection of the rule type while creating an alert rule
6 participants