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

[RAM] META MVP Snoozing API #125804

Closed
7 tasks done
XavierM opened this issue Feb 16, 2022 · 12 comments
Closed
7 tasks done

[RAM] META MVP Snoozing API #125804

XavierM opened this issue Feb 16, 2022 · 12 comments
Labels
Feature:Alerting/RulesFramework Issues related to the Alerting Rules Framework Meta Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.2.0

Comments

@XavierM
Copy link
Contributor

XavierM commented Feb 16, 2022

This Meta issue will describe what needs to be done on the API side to allow a MVP snoozing to be able to build the snoozing UI #124888.

{
  "mappings": {
    "properties": {
      "snooze_end_time": {
        "type":   "date",
        "format": "strict_date_time_no_millis"
      }
    }
  }
}
@XavierM XavierM added Meta Feature:Alerting/RulesFramework Issues related to the Alerting Rules Framework v8.2.0 labels Feb 16, 2022
@botelastic botelastic bot added the needs-team Issues missing a team label label Feb 16, 2022
@gmmorris gmmorris added the Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) label Feb 16, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@botelastic botelastic bot removed the needs-team Issues missing a team label label Feb 16, 2022
@Zacqary Zacqary self-assigned this Feb 16, 2022
@Zacqary
Copy link
Contributor

Zacqary commented Feb 16, 2022

Create an internal _snooze API, maybe we can have a query params end_time: -1|ISO 8601. If end_time is set to -1, we know that our snooze is forever (set the mute_all to true), if not that’s when your snooze needs to end. ->

Not sure this is compatible with the snooze_end_time SavedObject type. Does strict_date_time_no_millis allow for the value to be -1?

@Zacqary
Copy link
Contributor

Zacqary commented Feb 16, 2022

Noticing there's a difference between muteAll and muteInstance in the Rules Client. Do we want to differentiate between snoozeAll versus snoozeInstance?

@XavierM
Copy link
Contributor Author

XavierM commented Feb 17, 2022

"format": "strict_date_time_no_millis"

the muteInstance is all about the alert instance like we want to mute this alert if it show up again. For MVP, we can ignore it .

@XavierM
Copy link
Contributor Author

XavierM commented Feb 17, 2022

Create an internal _snooze API, maybe we can have a query params end_time: -1|ISO 8601. If end_time is set to -1, we know that our snooze is forever (set the mute_all to true), if not that’s when your snooze needs to end. ->

Not sure this is compatible with the snooze_end_time SavedObject type. Does strict_date_time_no_millis allow for the value to be -1?

This was just a suggestion on the API level but not for the SO. I was thinking that if we see snooze_end_time: -1 then we will set true to the mute_all attribute and snooze_end_time will be null.

@gmmorris
Copy link
Contributor

Create an internal _snooze API, maybe we can have a query params end_time: -1|ISO 8601. If end_time is set to -1, we know that our snooze is forever (set the mute_all to true), if not that’s when your snooze needs to end. ->

Not sure this is compatible with the snooze_end_time SavedObject type. Does strict_date_time_no_millis allow for the value to be -1?

This was just a suggestion on the API level but not for the SO. I was thinking that if we see snooze_end_time: -1 then we will set true to the mute_all attribute and snooze_end_time will be null.

Is there a reason to use -1 on the API rather than just omit the value in the API as well?
IMHO it will make maintenance easier if both the HTTP API and RulesClient API use the same semantics.

@XavierM
Copy link
Contributor Author

XavierM commented Mar 8, 2022

Create an internal _snooze API, maybe we can have a query params end_time: -1|ISO 8601. If end_time is set to -1, we know that our snooze is forever (set the mute_all to true), if not that’s when your snooze needs to end. ->

Not sure this is compatible with the snooze_end_time SavedObject type. Does strict_date_time_no_millis allow for the value to be -1?

This was just a suggestion on the API level but not for the SO. I was thinking that if we see snooze_end_time: -1 then we will set true to the mute_all attribute and snooze_end_time will be null.

Is there a reason to use -1 on the API rather than just omit the value in the API as well? IMHO it will make maintenance easier if both the HTTP API and RulesClient API use the same semantics.

I will disagree, I think it is better that the user is setting snooze_end_time attribute to -1 than just omitting it and getting a side effect of the API. I feel that can just be a mistake from our user it allow us a better validation on the snooze_end_time.

@chrisronline
Copy link
Contributor

Is it possible for the user to set mute_all from the API too? Why do we need to add complexity around what the attributes will change in the SO?

@gmmorris
Copy link
Contributor

gmmorris commented Mar 9, 2022

I will disagree, I think it is better that the user is setting snooze_end_time attribute to -1 than just omitting it and getting a side effect of the API.

Yeah, that's fair, and If the rest of the team feels comfortable with -1 I can live with it.
That said, it feels like -1 is also a sort of side effect as "negative time means forever" is not exactly intuitive to me.

I see where @chrisronline is coming from here... if the user wants to "snooze forever", why not just mute the rule? 🤔

@chrisronline
Copy link
Contributor

After talking to @XavierM, my understanding is that we intend to deprecate the the mute functionality (or maybe at least the mute_all) and replace it with snoozing. Is that still the plan?

pmuellr added a commit to pmuellr/kibana that referenced this issue Mar 9, 2022
resolves elastic#126512

This PR fills in some of the missing pieces with the new rule
snoozing functionality described in meta issue
elastic#125804

The main bit is the calculation of whether a rule is "snoozed".  Prior
to this, we only had the `mute_all` boolean property, but now we also
have a `snooze_end_time` Date | null property.  Here's how they work:

|                     | snooze_end_time: null   | snooze_end_time: date      |
| ------------------- | ----------------------- | -------------------------- |
| **mute_all: true**  | rule is snoozed forever | invalid                    |
| **mute_all: false** | rule is not snoozed     | rule is snoozed till date  |

This is handled in the function `isRuleSnoozed()` in
`x-pack/plugins/alerting/server/task_runner/task_runner.ts`
@XavierM
Copy link
Contributor Author

XavierM commented Mar 10, 2022

After talking to @XavierM, my understanding is that we intend to deprecate the the mute functionality (or maybe at least the mute_all) and replace it with snoozing. Is that still the plan?

That's my assumption to avoid weird side effect between our _snooze and mute_all but first we need to get our _snooze API public and then we will be bale to deprecate mute_all.

@XavierM XavierM changed the title [RAM] MVP Snoozing API [RAM] META MVP Snoozing API Mar 21, 2022
@gmmorris
Copy link
Contributor

Added an issue to add docs for Snooze UX (thanks @Zacqary !) as we forgot 😬

@XavierM XavierM moved this from In Progress to In Review in AppEx: ResponseOps - Rules & Alerts Management Jun 13, 2022
@XavierM XavierM closed this as completed Jun 27, 2022
Repository owner moved this from In Review to Done in AppEx: ResponseOps - Rules & Alerts Management Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Alerting/RulesFramework Issues related to the Alerting Rules Framework Meta Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.2.0
Projects
No open projects
Development

No branches or pull requests

5 participants