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] Create data model for scheduled and recurring snoozes #130724

Closed
Zacqary opened this issue Apr 20, 2022 · 4 comments · Fixed by #131019
Closed

[RAM] Create data model for scheduled and recurring snoozes #130724

Zacqary opened this issue Apr 20, 2022 · 4 comments · Fixed by #131019
Assignees
Labels
enhancement New value added to drive a business result Feature:Alerting/RulesManagement Issues related to the Rules Management UX Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.3.0

Comments

@Zacqary
Copy link
Contributor

Zacqary commented Apr 20, 2022

Modify SavedObject specification to include more than just a snoozeEndTime but also:

  • Scheduled snooze at a specific future time (this can be multiple scheduled snoozes)
  • Recurring snooze on every day of a week (e.g. Saturday, Sunday)
  • Recurring snooze every interval (e.g. 1M, 2w)

Also create a migration to move from the old data model (Just snoozeEndTime) to this new model

@Zacqary Zacqary added enhancement New value added to drive a business result Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:Alerting/RulesManagement Issues related to the Rules Management UX v8.3.0 labels Apr 20, 2022
@Zacqary Zacqary self-assigned this Apr 20, 2022
@elasticmachine
Copy link
Contributor

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

@Zacqary
Copy link
Contributor Author

Zacqary commented Apr 25, 2022

Turns out this already touches a lot of existing functionality. The data model I'm migrating to is:

      "snoozeIndefinitely": {
        "type": "boolean"
      },
      "snoozeSchedule": {
        "properties": {
          "id": {
            "type": "keyword"
          },
          "startTime": {
            "type": "date",
            "format": "strict_date_time"
          },
          "duration": {
            "type": "long"
          },
          "repeatInterval": {
            "type": "keyword"
          },
          "occurrences": {
            "type": "long"
          },
          "repeatEndTime": {
            "type": "date",
            "format": "strict_date_time"
          }
        }
      }

snoozeSchedule takes the form of an array of these props, of which only startTime and duration are required. Using these two props, we can replicate the functionality of the existing snoozeEndTime. But there's a lot of different functions expecting a single end date string, so I've got a lot to untangle even just for a data migration.

When we add the scheduled snooze UI, we'll also make use of:

  • repeatInterval: Takes the form of a time interval like 1d, 3w, or a day of week string, e.g. DOW:06 to snooze every Saturday and Sunday. (Using Date.prototype.getDay() output of 0-6 for Sunday through Saturday)
  • occurrences: An optional number of occurrences to repeat the snooze for
  • repeatEndTime: An optional date to keep snoozing until
  • id: Each scheduled snooze will be assigned one of these so that we can target it with an unsnooze if the user wants to cancel it

Because this is an array that can store an indefinite number of scheduled snoozes, we may want to create a cleanup task to clear expired snoozes from the snoozeSchedule.

@Zacqary
Copy link
Contributor Author

Zacqary commented Apr 29, 2022

After discussing with @XavierM and @pmuellr, we're simplifying the data model in favor of setting an iCal RRULE for any recurring snoozes.

@pmuellr
Copy link
Member

pmuellr commented Apr 29, 2022

This sounds great. Love aligning on standards, so we can say "we didn't invent this, it's a 'standard'" :-)

Opens the door to us being able to "import/export" some of this calendar-ish data with other apps. I did take a look at some other incident providers, and they don't seem to have great support for this kind of thing, but ... I'll bet some do. Could be an interesting integration angle.

Kinda funny, when I click on the link in the comment ^^^, I get the following:

image

@XavierM XavierM moved this from In Progress to In Review in AppEx: ResponseOps - Rules & Alerts Management May 16, 2022
Repository owner moved this from In Review to Done in AppEx: ResponseOps - Rules & Alerts Management May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Feature:Alerting/RulesManagement Issues related to the Rules Management UX Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.3.0
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants