-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Added defaultActionMessage to index threshold alert UI type definition
#80936
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
Conversation
|
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
|
💚 CLA has been signed |
defaultActionMessage to index threshold alert UI type definition
|
Pinging @elastic/kibana-alerting-services (Team:Alerting Services) |
|
Thanks for working on this. Until the Kibana Alerting Services team gets back to you, I've added some version labels to it as it would be good to have it backported to 7.x as well. Also, don't forget to sign the CLA. |
|
@marius-dr I have signed the contributer agreement but here it is not showing. |
|
It probably took a while to update. Thanks! |
|
@elasticmachine merge upstream |
|
I'm going to do a manual test on this right now, I assume it will work as intended :-) But wondering if we can add some other useful test. Ideally, a functional test, so we can see this in action. I'll start poking around and what we might want to do. It would probably involve checking the response from invoking the action, and then matching with a regex, as |
|
is the CI stuck on this? Or maybe the CI doesn't actually run unless we specifically tell it to, for community PRs - I think that's it. |
|
jenkins retest this please |
|
With a manual test, it looks like this differs from using I'm guessing the referenced context variables are not set, maybe we don't even make those available, but then it would be good to add those to the existing context variables ... |
@pmuellr what changes I have to make here? Is there a need to do a manual check that whether those referenced variables are set or not? |
|
Ya, just checked, we don't have those context variables currently. We should add them, they'll be useful to customers in other situations anyway. Here's where the existing ones are set: kibana/x-pack/plugins/stack_alerts/server/alert_types/index_threshold/action_context.ts Lines 49 to 63 in 4c81b1a
In the definition of
Those values need to be set in the alert type definition tho, here: kibana/x-pack/plugins/stack_alerts/server/alert_types/index_threshold/alert_type.ts Lines 163 to 167 in 4c81b1a
That file will also need updates to add the new variables to the list here: kibana/x-pack/plugins/stack_alerts/server/alert_types/index_threshold/alert_type.ts Lines 103 to 110 in 4c81b1a
And then the descriptions needed to be added as i18n strings like the existing ones above that code. |
| alertParamsExpression: lazy(() => import('./expression')), | ||
| validate: validateExpression, | ||
| defaultActionMessage: i18n.translate( | ||
| 'xpack.triggers_actions_ui.builtin_alert_types.threshold.alertDefaultActionMessage', |
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.
The i18n error in the CI seems to be caused by using triggers_actions_ui instead of triggersActionsUI, for the string above.
| 'xpack.triggers_actions_ui.builtin_alert_types.threshold.alertDefaultActionMessage', | |
| 'xpack.triggersActionsUI.builtin_alert_types.threshold.alertDefaultActionMessage', |
That's a difference from other usages anyway, like this one:
Line 109 in 4c81b1a
| 'xpack.triggersActionsUI.sections.alertAdd.threshold.fixErrorInExpressionBelowValidationMessage', |
|
@pmuellr Please review the changes |
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.
This is looking good! Noted that I realized we don't actually need a new window variable, as the value it provides should be available via the alertParams variables.
| const actionVariableContextFunctionLabel = i18n.translate( | ||
| 'xpack.stackAlerts.indexThreshold.actionVariableContextFunctionLabel', | ||
| { | ||
| defaultMessage: 'A string formatted values combining threshold comparator and threshold', |
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.
| defaultMessage: 'A string formatted values combining threshold comparator and threshold', | |
| defaultMessage: 'A string describing the threshold comparator and threshold', |
| const actionVariableContextWindowLabel = i18n.translate( | ||
| 'xpack.stackAlerts.indexThreshold.actionVariableContextWindowLabel', | ||
| { | ||
| defaultMessage: 'A string formatted values combining time window size and time window unit', |
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.
In looking at this, I just realized we shouldn't need to add window as a separate context variable. There is already a context variable containing the parameters, called alertParams, so these can be referenced in the message string as
{{alertParams.timeWindowSize}}{{alertParams.timeWindowUnit}}
which should yield a string like 5s (5 seconds), which is all we're doing below anyway.
So we shouldn't need the window variable at all.
Note, in theory we might be able to do the function variable in the same way, but it would make the mustache template a lot more complicated, not sure it's worth it, and it feels useful to have a nice version of the "function" available easily anyway.
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.
@pmuellr Got it!
|
@pmuellr No problem. So for now I have to commit the changes to your repo, right? |
|
@pmuellr I have tried resolving merge conflict. Please review once. |
|
@dB2510 the merge looks good! No need to use my copy of the PR/branch if your's is still in good shape. Again, it's not building, so starting one via a message ... |
|
jenkins retest this please |
@pmuellr Should I go for |
Sure! Unless you want to just get this merged. We have some other changes to the defaultActionMessage coming, fairly soon, I'm happy to do that work then. Up to you. Longer we wait, more chances for more conflicts :-) |
|
@pmuellr Okay then its up to you. Can we merge this now? |
Ah, for some reason I thought this was already merged. We should go ahead and make this change, because once we create a new i18n key, then it becomes a little messy to rename it later - we should make it right now, since we know what the name will be. After that, I think will be good to merge! |
|
@pmuellr Done! Can we merge this now? |
|
Let's get the CI to pass, and then should be good to merge! Thanks for all the effort here Dhruv! |
|
jenkins retest this please |
@pmuellr Thank you for giving me the opportunity to contribute to this issue. |
|
We'll need one more merge from upstream to get the |
|
@elasticmachine merge upstream |
|
jenkins retest this please |
💚 Build SucceededMetrics [docs]page load bundle size
History
To update your PR or re-run it, just comment with: |
…ion (elastic#80936) * resolves elastic#78148 Adds a `defaultActionMessage` to the index threshold alert, so that the `message` parameter for actions will be pre-filled with a useful message
|
Whew! Merged! I've started the backport on this, so the feature should be available when Kibana 7.11.0 comes out. Thanks again @dB2510 !! |
* master: Added `defaultActionMessage` to index threshold alert UI type definition (elastic#80936) [ILM] Migrate Delete phase and name field to Form Lib (elastic#82834) skip flaky suite (elastic#57426) [Alerting] adds an Run When field in the alert flyout to assign the action to an Action Group (elastic#82472) [APM] Expose APM event client as part of plugin contract (elastic#82724) [Logs UI] Fix errors during navigation (elastic#78319) Enable send to background in TSVB (elastic#82835) SavedObjects search_dsl: add match_phrase_prefix clauses when using prefix search (elastic#82693) [Ingest Manager] Unify install* under installPackage (elastic#82916)
…ion (#80936) (#82950) * resolves #78148 Adds a `defaultActionMessage` to the index threshold alert, so that the `message` parameter for actions will be pre-filled with a useful message Co-authored-by: Dhruv Bodani <[email protected]>
…e-details-overlay * 'master' of github.com:elastic/kibana: (201 commits) Added `defaultActionMessage` to index threshold alert UI type definition (elastic#80936) [ILM] Migrate Delete phase and name field to Form Lib (elastic#82834) skip flaky suite (elastic#57426) [Alerting] adds an Run When field in the alert flyout to assign the action to an Action Group (elastic#82472) [APM] Expose APM event client as part of plugin contract (elastic#82724) [Logs UI] Fix errors during navigation (elastic#78319) Enable send to background in TSVB (elastic#82835) SavedObjects search_dsl: add match_phrase_prefix clauses when using prefix search (elastic#82693) [Ingest Manager] Unify install* under installPackage (elastic#82916) [Fleet] Make stream id unique in agent policy (elastic#82447) skip flaky suite (elastic#82915) skip flaky suite (elastic#75794) Copy `dateAsStringRt` to observability plugin (elastic#82839) [Maps] rename connected_components/map folder to mb_map (elastic#82897) [Security Solution] Fix EventsViewer DnD cypress tests (elastic#82619) [Security Solution] Adds logging and performance fan out API for threat/Indicator matching (elastic#82546) Implemented Alerting health status pusher by using task manager and status pooler for Kibana status plugins 'kibanahost/api/status' (elastic#79056) [APM] Adds new configuration 'xpack.apm.maxServiceEnvironments' (elastic#82090) Move single use function in line (elastic#82885) [ML] Add unsigned_long support to data frame analytics and anomaly detection (elastic#82636) ...
Fixes #78148

The above screenshot displays the defaultActionMessage in the text box when an action is created for index threshold alert.