Skip to content

Conversation

@cjcenizal
Copy link
Contributor

@cjcenizal cjcenizal commented Aug 10, 2022

Fixes:

Follow-up to #138026

Release note

Watches will no longer get stuck in a "Firing" state in Watcher.

Summary

I simplified the possible action and watch states, updated the UI accordingly, added more info to the UI in the form of tooltips to help users make sense of what they're seeing, and updated the tests. By removing the concept of a "firing" state from the UI, watches can now longer get "stuck" in that state and cause confusion among users. By adding more information about watch and action state, users will be able to form a clearer understanding of their behavior.

Data changes

ACTION_STATES and WATCH_STATES have been simplified.

WATCH_STATES:

  • FIRING OK -> ACTIVE
  • DISABLED -> INACTIVE
  • ERROR
  • CONFIG_ERROR

ACTION_STATES

  • FIRING
  • OK
  • ACKNOWLEDGED
  • THROTTLED
  • ERROR
  • CONFIG_ERROR
  • UNKNOWN

Regarding config error: I understand that we don't expect ES to permit invalid watch configurations, but I decided to retain CONFIG_ERROR for now since it seems outside of the scope of the specific problem this PR fixes. See #23887 for more background on this state.

Regarding isAckable: isAckable is now a direct translation of the action model's underlying ES value, instead of derived from its state. I believe this is a truer reflection of how ES treats ackability (docs).

UI changes

Watch list

I added columns for "Condition last met" and "Last checked", and added tooltips to most of the columns.

image

Execution history panel

I retained the "State" column because it could contain useful information, for example if it was in an error state. I added a "Condition met" column and added tooltips to most of the columns.

image

image

Action statuses panel

I added a "Last executed" column and added tooltips to most of the columns.

image

Simulate watch results flyout

I didn't make any changes to this flyout beyond surfacing the new action states, because it seems beyond the scope of the problem this PR addresses.

Steps to test

Create a watch locally with this request and explore the UI.

PUT _watcher/watch/test
{
  "trigger": {
    "schedule": {
      "interval": "1m"
    }
  },
  "actions" : {
    "log" : { 
      "logging" : {
        "text" : "executed at {{ctx.execution_time}}" 
      }
    }
  }
}

@cjcenizal cjcenizal added release_note:fix Feature:Watcher Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t// labels Aug 10, 2022
@cjcenizal cjcenizal force-pushed the bug/watcher-stuck-firing-state branch 2 times, most recently from 71e7b85 to 87d2208 Compare August 11, 2022 18:27
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just renamed this file to align with the exported function name and reduced the function's params.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed this name to remove all references to "firing".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed these properties because it didn't look like they were being used anywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fixed a React error that surfaced when executing the Jest tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change means that we no longer needed the tests about the relationship between isAckable and state, above, because there is no longer any relationship.

CJ Cenizal added 5 commits August 11, 2022 12:20
… with ACTIVE. Update ACTION_STATES by replacing FIRING with OK.

- Refactor isAckable logic to directly translate value provided by ES.
- Replace WatchStatus component with ActionStateBadge and WatchStateBadge components.
…'Last triggered' column to 'Last checked'.

- Add tooltips to both.
- Add tooltips to State and Comment headers.
…y. Remove unused properties from client WatchStatus model.
…cuted header to Action Statuses Panel and tooltips. Update tests.
@cjcenizal cjcenizal force-pushed the bug/watcher-stuck-firing-state branch from 87d2208 to 72e7bc6 Compare August 11, 2022 19:20
@cjcenizal cjcenizal marked this pull request as ready for review August 11, 2022 19:20
@cjcenizal cjcenizal requested a review from a team as a code owner August 11, 2022 19:20
@elasticmachine
Copy link
Contributor

Pinging @elastic/platform-deployment-management (Team:Deployment Management)

Copy link
Contributor

@alisonelizabeth alisonelizabeth left a comment

Choose a reason for hiding this comment

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

Nice work @cjcenizal! So awesome to see this addressed 🎉

Everything worked as expected. I think I tested all the different states, except error (I wasn't sure the best way to trigger an error).

Two questions -

  1. Do you think it would be helpful to surface whether there is an action that is "ackable" in the "Comments" column of the watch list table? It seems like it could be and is supplemental to the existing throttled/acknowledged comments.
  2. Were you planning on updating the Watcher docs? Let me know if you need help here.


interface Props {
state: string;
size?: 'xs' | 's' | 'm';
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use EuiTextProps['size']?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice! Will do.

}

const stateToIconMap = {
[WATCH_STATES.ACTIVE]: <EuiIcon type="check" color="success" />,
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about changing the Active icon to a green dot? Maybe not a big deal, but we're also using the check icon for the Condition met column on the history page, so sometimes it's displayed for both columns.

Screen Shot 2022-08-15 at 3 17 30 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great idea, will do.

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.

Tooltip text should end with a period.

content={i18n.translate(
'xpack.watcher.sections.watchList.watchTable.lastFiredHeader.tooltipText',
{
defaultMessage: `The most recent time this watch's condition was met and its actions were executed`,
Copy link
Contributor

Choose a reason for hiding this comment

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

I know its repetitive, but IMO "last time" is easier to understand than "most recent time"

The last time the condition was met and action taken.

'xpack.watcher.sections.watchList.watchTable.commentHeader.tooltipText',
{
defaultMessage:
'Information about whether the watch is throttled, acknowledged, or has failed to execute',
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it the watch that is throttled, or is it the action?

Whether the watch was acknowledged, throttled, or failed to execute.

or something like:

The state of the watch--throttled, acknowledged, or failed to execute.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question -- it's whether any of the watch's actions have been acknowledged, throttled, or failed to execute. So how about:

Whether any actions have been acknowledged, throttled, or failed to execute.

Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest removing "any". On second look, can this be:

Whether actions are acknowledged, throttled, or failed.

content={i18n.translate(
'xpack.watcher.sections.watchDetail.watchTable.stateHeader.tooltipText',
{
defaultMessage: 'OK, acked, throttled, or error state',
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
defaultMessage: 'OK, acked, throttled, or error state',
defaultMessage: 'OK, acknowledged, throttled, or error',

content={i18n.translate(
'xpack.watcher.sections.watchHistory.watchActionStatusTable.lastExecuted.tooltipText',
{
defaultMessage: `When this action was last executed`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
defaultMessage: `When this action was last executed`,
defaultMessage: `The last time this action was executed`,

*executed could also be "taken"

content={i18n.translate(
'xpack.watcher.sections.watchHistory.watchTable.metConditionHeader.tooltipText',
{
defaultMessage: `Whether the watch's condition was met and its actions were executed`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Whether the condition was met and action taken.

content={i18n.translate(
'xpack.watcher.sections.watchList.watchTable.stateHeader.tooltipText',
{
defaultMessage: 'Active, inactive, or error state',
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the title of the column in state, can you remove "state" from the tooltip?

Active, inactive, or error

content={i18n.translate(
'xpack.watcher.sections.watchList.watchTable.lastTriggeredHeader.tooltipText',
{
defaultMessage: `The most recent time this watch's condition was checked`,
Copy link
Contributor

Choose a reason for hiding this comment

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

The last time the condition was checked.

content={i18n.translate(
'xpack.watcher.sections.watchHistory.watchTable.stateHeader.tooltipText',
{
defaultMessage: 'Active or error state',
Copy link
Contributor

Choose a reason for hiding this comment

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

Active or error

Should this also include "inactive"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't believe so, because this part of the UI shows a history of attempted executed actions, and if it's inactive then it won't execute.

'xpack.watcher.sections.watchHistory.watchTable.commentHeader.tooltipText',
{
defaultMessage:
'Information about whether the watch was throttled, acknowledged, or failed to execute',
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
'Information about whether the watch was throttled, acknowledged, or failed to execute',
'Whether the action was throttled, acknowledged, or failed to execute',

content={i18n.translate(
'xpack.watcher.sections.watchHistory.watchActionStatusTable.state.tooltipText',
{
defaultMessage: 'OK, acked, throttled, or error state',
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
defaultMessage: 'OK, acked, throttled, or error state',
defaultMessage: 'OK, acknowledged, throttled, or error',

@cjcenizal
Copy link
Contributor Author

@alisonelizabeth @gchaps Thank you for your feedback! I've implemented all of your suggestions, except the docs update. I'd like to do that in a separate PR after this one has been approved and merged. Could you please take another look at these changes?

'xpack.watcher.sections.watchList.watchTable.commentHeader.tooltipText',
{
defaultMessage:
'Whether any actions are acknowledgeable or have been acknowledged, throttled, or failed to execute.',
Copy link
Contributor

@gchaps gchaps Aug 15, 2022

Choose a reason for hiding this comment

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

Can this be the same as the one below?

Whether actions are acknowledged, acknowledgeable, throttled, or failed.

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 questions, but otherwise LGTM

'xpack.watcher.sections.watchHistory.watchTable.commentHeader.tooltipText',
{
defaultMessage:
'Whether the action was throttled, acknowledged, acknowledgeable, or failed to execute.',
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the right order, or should it go from positive to negative: acknowledged, acknowledgeable, throttled, or failed? Should actions be singular or plural as the comment above?

Whether the action was throttled, acknowledged, acknowledgeable, or failed.',

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we come up with another word for acknowledgeable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For context, some actions can be "Acknowledged". I made up the term "Acknowledgeable" to describe this. Another term known to our users is "Ackable".

I have no preference about the order, and I don't have a feeling that the order will affect the meaning extracted by the reader.

What do you mean by "Should actions be singular or plural as the comment above"? I can't find the referenced comment.

content={i18n.translate(
'xpack.watcher.sections.watchHistory.watchActionStatusTable.state.tooltipText',
{
defaultMessage: 'OK, acknowledged, throttled, or error.',
Copy link
Contributor

Choose a reason for hiding this comment

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

How does this related to acknowledge, acknowledgeable, throttled, and failed. Should these two messages be using the same words?

@cjcenizal
Copy link
Contributor Author

@gchaps @alisonelizabeth I reverted the addition of the "Acknowledgeable" state, since AFAIK this hasn't been requested by users and it's raising additional questions in my mind about its value to the user. We can always add it back in a separate PR.

Copy link
Contributor

@alisonelizabeth alisonelizabeth left a comment

Choose a reason for hiding this comment

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

Latest LGTM

@kibana-ci
Copy link

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
watcher 181 182 +1

Async chunks

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

id before after diff
watcher 269.9KB 273.4KB +3.6KB

Page load bundle

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

id before after diff
watcher 13.5KB 13.3KB -178.0B

History

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

@cjcenizal cjcenizal merged commit f77afae into elastic:main Aug 16, 2022
@cjcenizal cjcenizal deleted the bug/watcher-stuck-firing-state branch August 16, 2022 01:25
@kibanamachine kibanamachine added v8.5.0 backport:skip This PR does not require backporting labels Aug 16, 2022
Mpdreamz pushed a commit to Mpdreamz/kibana that referenced this pull request Sep 6, 2022
* Update WATCH_STATES by replacing DISABLED with INACTIVE and OK/FIRING with ACTIVE. Update ACTION_STATES by replacing FIRING with OK.
- Refactor isAckable logic to directly translate value provided by ES.
- Replace WatchStatus component with ActionStateBadge and WatchStateBadge components.

* Change WatchListPage 'Last fired' column to 'Condition last met' and 'Last triggered' column to 'Last checked'.
- Add tooltips to both.
- Add tooltips to State and Comment headers.

* Rename Watch Status Model's lastFired -> lastExecution for consistency. Remove unused properties from client WatchStatus model.

* Add Condition Met column and tooltips to State and Comment headers on Execution History Panel.

* Add tooltip to State header in Execution History flyout. Add Last executed header to Action Statuses Panel and tooltips. Update tests.

* Use EUI types instead of hand-rolling them.

* Remove unused ACTION_STATES.FIRING and references to WATCH_STATES.FIRING.

* Use dots to denote states, similar to Index Management.

* Refactor deriveComment to use early exits.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:Watcher release_note:fix Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t// v8.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants