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] Improve creation and editing of "Elasticsearch query" rule in Management #134763

Merged
merged 67 commits into from
Jul 7, 2022

Conversation

jughosta
Copy link
Contributor

@jughosta jughosta commented Jun 20, 2022

Closes #134183

Summary

This PR brings an improved and more convenient UI for creating rules to Management page as we have it now on Discover page.

Jun-27-2022 15-43-11

Steps to test:

  • From Stack Management page:
    • Open "Rules and Connectors"
    • Select "Elasticsearch query" from rules list
    • Select how to configure this new rule: KQL/Lucene or Query DSL
    • Check that both options work
  • From Discover page:
    • Press "Alerts" > "Create search threshold rule"
    • Check that it still allows to configure a rule in KQL/Lucene mode

Stack Management > New rule > Elasticsearch Query
Screenshot 2022-06-22 at 16 09 21

"KQL or Lucene" is selected
Screenshot 2022-06-22 at 16 09 29

"Query DSL" is selected
Screenshot 2022-06-22 at 16 09 45

Discover > Alerts > Create search threshold rule
Screenshot 2022-06-22 at 16 08 07

Checklist

@jughosta jughosta added release_note:enhancement Feature:Alerting backport:skip This commit does not require backporting Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. v8.4.0 labels Jun 20, 2022
@jughosta jughosta self-assigned this Jun 20, 2022
@gmmorris gmmorris requested a review from a team June 21, 2022 09:37
@gmmorris
Copy link
Contributor

Added a deploy to Cloud label so I can play around with these changes.
Thanks @jughosta

@jughosta
Copy link
Contributor Author

@elasticmachine merge upstream

@jughosta
Copy link
Contributor Author

jughosta commented Jul 4, 2022

@ymao1 Great findings! Since they are also present on main branch I created 2 separate github issues:

#135641

Also, when I created a rule using a data view, then deleted the data view, I see this when editing the rule: Screen Shot 2022-06-30 at 1 08 33 PM

Should that be a link?

#135642

This is unrelated to this PR, but when I have a user who has no access to "Stack Rules" but does have access to "Discover", I can see the rule creation flyout but when I try to save the rule, I get a permissions error. Is this a known issue?

/>
</EuiFormRow>
{createDataView ? (
<EuiPopoverFooter paddingSize="none">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@andreadelrio Updated styles for the button in the popover:

Screenshot 2022-07-04 at 14 53 59

Copy link
Contributor

Choose a reason for hiding this comment

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

@jughosta this needs a further reduction of padding. I'd remove the padding highlighted here with a CSS override.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @andreadelrio ! Updated:

Screenshot 2022-07-06 at 10 53 23

Is there anything else blocking?

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! Nice job

Copy link
Member

@kertal kertal left a comment

Choose a reason for hiding this comment

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

Lot's of great fine-tuning since the last time I've checked 👍 While giving it another testing round I encountered a reason why we should not allow the user to create data views in the rule flyout. Users could create data views without time field which would lead to invalid rules. I therefore would suggest to not provide the functionality of adding data views in this area
Bildschirmfoto 2022-07-06 um 07 49 10

One tiny nit, when I decided I don't wanna create this rule type, so returning to the selection of all rule types I'm getting an error message
Bildschirmfoto 2022-07-06 um 07 50 57

@jughosta
Copy link
Contributor Author

jughosta commented Jul 6, 2022

While giving it another testing round I encountered a reason why we should not allow the user to create data views in the rule flyout. Users could create data views without time field which would lead to invalid rules. I therefore would suggest to not provide the functionality of adding data views in this area

@kertal I would rather keep this functionality and add a separate validation message to notify that the selected data view requires to have a timestamp. Users can currently select an existing data view in flyout on Discover page too and we don't validate that:
Screenshot 2022-07-06 at 09 50 22

We could also address it as a followup PR since this problem is already present on main branch.

One tiny nit, when I decided I don't wanna create this rule type, so returning to the selection of all rule types I'm getting an error message

This also present on main branch and I think is unrelated to "Elasticsearch query" work we do here. Can we create a separate issue for it?

@jughosta
Copy link
Contributor Author

jughosta commented Jul 6, 2022

@elasticmachine merge upstream

@kertal
Copy link
Member

kertal commented Jul 6, 2022

While giving it another testing round I encountered a reason why we should not allow the user to create data views in the rule flyout. Users could create data views without time field which would lead to invalid rules. I therefore would suggest to not provide the functionality of adding data views in this area

@kertal I would rather keep this functionality and add a separate validation message to notify that the selected data view requires to have a timestamp. Users can currently select an existing data view in flyout on Discover page too and we don't validate that:
We could also address it as a followup PR since this problem is already present on main branch.

Makes sense!

One tiny nit, when I decided I don't wanna create this rule type, so returning to the selection of all rule types I'm getting an error message

This also present on main branch and I think is unrelated to "Elasticsearch query" work we do here. Can we create a separate issue for it?

Makes sense part II!

Will finish my review now, was delayed by a thunderstorm while walking to my hut

@kertal kertal self-requested a review July 6, 2022 10:54
Copy link
Member

@kertal kertal left a comment

Choose a reason for hiding this comment

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

LGTM, testes again with cloud deployment, by creating a alert rule for KQL & Lucene , and another for Query DSL. Works as expected. Thx a lot for brining this over the finishing line! 🥳

@jughosta
Copy link
Contributor Author

jughosta commented Jul 6, 2022

Copy link
Contributor

@dimaanj dimaanj left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Contributor

@andreadelrio andreadelrio left a comment

Choose a reason for hiding this comment

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

Design changes LGTM.

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
stackAlerts 132 136 +4

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
triggersActionsUi 376 377 +1

Async chunks

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

id before after diff
stackAlerts 205.3KB 209.6KB +4.3KB
triggersActionsUi 866.7KB 866.7KB +25.0B
total +4.3KB

Page load bundle

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

id before after diff
stackAlerts 13.4KB 13.8KB +494.0B
triggersActionsUi 89.2KB 89.2KB +32.0B
total +526.0B
Unknown metric groups

API count

id before after diff
triggersActionsUi 390 391 +1

History

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

cc @jughosta

@jughosta jughosta merged commit b46763f into elastic:main Jul 7, 2022
@jughosta jughosta deleted the 134183-alert-management branch July 7, 2022 09:19
@tylersmalley tylersmalley added ci:cloud-deploy Create or update a Cloud deployment and removed ci:deploy-cloud labels Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting ci:cloud-deploy Create or update a Cloud deployment Feature:Alerting release_note:enhancement Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. ui-copy Review of UI copy with docs team is recommended v8.4.0
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

[Discover][Alerting] Allow creating the new advanced Elasticsearch query alert in Management