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

[ResponseOps] add snoozing MVP implementation to alerting framework #127402

Closed
wants to merge 6 commits into from

Conversation

pmuellr
Copy link
Member

@pmuellr pmuellr commented Mar 9, 2022

Summary

resolves #126512

This PR fills in some of the missing pieces with the new rule
snoozing functionality described in meta issue
#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

Summarize your PR. If it involves visual changes include a screenshot or gif.

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

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`
@pmuellr pmuellr mentioned this pull request Mar 14, 2022
1 task
resolves elastic#126512

Changes the calculation of rule-level muting to take into account
snoozeEndTime.

If muteAll is true, the rule is considered snoozing forever, regardless
of the setting of snoozeEndTime.

If muteAll is false, snoozeEndTime determines whether the rule is
snoozed.  If snoozeEndTime is null, the rule is not snoozed.  Otherwise,
snoozeEndTime is a Date, and if it's >= than Date.now(), the rule
is snoozed.  Otherwise, the rule is not snoozed.
@kibana-ci
Copy link
Collaborator

kibana-ci commented Mar 15, 2022

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] Default CI Group #17 / alerting api integration security and spaces enabled Alerts alerts update superuser at space1 should handle update alert request appropriately
  • [job] [logs] Default CI Group #17 / alerting api integration security and spaces enabled Alerts alerts update superuser at space1 should handle update alert request appropriately
  • [job] [logs] Default CI Group #12 / alerting api integration spaces only Alerting get public should handle get alert request appropriately
  • [job] [logs] Default CI Group #12 / alerting api integration spaces only Alerting get public should handle get alert request appropriately
  • [job] [logs] Jest Integration Tests #2 / migration actions reindex & waitForReindexTask resolves left wait_for_task_completion_timeout when the task does not finish within the timeout
  • [job] [logs] Jest Integration Tests #2 / migration actions waitForPickupUpdatedMappingsTask resolves left wait_for_task_completion_timeout when the task does not complete within the timeout

Metrics [docs]

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
alerting 298 299 +1

Page load bundle

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

id before after diff
alerting 38.0KB 38.1KB +51.0B
Unknown metric groups

API count

id before after diff
alerting 306 307 +1

ESLint disabled in files

id before after diff
apm 15 14 -1
securitySolution 67 66 -1
uptime 7 6 -1
total -3

ESLint disabled line counts

id before after diff
apm 85 82 -3
uptime 48 42 -6
total -9

References to deprecated APIs

id before after diff
fleet 5 4 -1
monitoring 40 28 -12
stackAlerts 183 157 -26
upgradeAssistant 8 3 -5
total -44

Total ESLint disabled count

id before after diff
apm 100 96 -4
securitySolution 514 513 -1
uptime 55 48 -7
total -12

History

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

@pmuellr
Copy link
Member Author

pmuellr commented Mar 15, 2022

closing in favor of #127694

@pmuellr pmuellr closed this Mar 15, 2022
@pmuellr pmuellr added the backport:skip This commit does not require backporting label Mar 23, 2022
@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[E&C] add snoozing MVP in alerting framework
3 participants