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

Subdue 2.0 #1415

Merged
merged 5 commits into from Aug 22, 2016

Conversation

Projects
None yet
2 participants
@portertech
Copy link
Member

commented Aug 16, 2016

Description

This pull-request implements "Subdue 2.0".

Example time window configuration for check subdue and filter when:

https://gist.github.com/portertech/b219d36d97adbfc80f1c3f08ab3660d2

Related Issue

Closes #1390
Closes #847

Motivation and Context

Makes it clear that "subdue" applies to check execution schedulers, both pubsub (server) and standalone (client), allowing users to specify time windows when check executions should occur.

Add time windows to Sensu filters via "when", allowing users to specify time windows when a filter is applied to events for an event handler.

How Has This Been Tested?

Specs have been updated to test check subdue and filter when.

Time window validation is tested in sensu-settings, e.g. https://github.com/sensu/sensu-settings/blob/master/spec/validator_spec.rb#L260 and https://github.com/sensu/sensu-settings/blob/master/spec/validator_spec.rb#L388.

I have manually tested time window validation:

{"timestamp":"2016-08-19T11:45:15.632208-0700","level":"fatal","message":"filter when days must be a hash","object":{"attributes":{"action":"resolve"},"when":{},"name":"time"}}
{"timestamp":"2016-08-19T11:46:09.934273-0700","level":"fatal","message":"filter when days must be a hash","object":{"attributes":{"action":"resolve"},"when":{"days":[]},"name":"time"}}
{"timestamp":"2016-08-19T11:46:29.459711-0700","level":"fatal","message":"filter when days must include at least one day of the week or 'all'","object":{"attributes":{"action":"resolve"},"when":{"days":{}},"name":"time"}}
{"timestamp":"2016-08-19T11:46:54.405828-0700","level":"fatal","message":"filter when days must be valid days of the week or 'all'","object":{"attributes":{"action":"resolve"},"when":{"days":{"nope":{}}},"name":"time"}}
{"timestamp":"2016-08-19T11:47:14.189901-0700","level":"fatal","message":"filter when days all must be in an array","object":{"attributes":{"action":"resolve"},"when":{"days":{"all":{}}},"name":"time"}}
{"timestamp":"2016-08-19T11:47:29.176118-0700","level":"fatal","message":"filter when days all must include at least one time window","object":{"attributes":{"action":"resolve"},"when":{"days":{"all":[]}},"name":"time"}}
{"timestamp":"2016-08-19T11:47:45.568031-0700","level":"fatal","message":"filter when day time window must be a hash","object":{"attributes":{"action":"resolve"},"when":{"days":{"all":[[]]}},"name":"time"}}
{"timestamp":"2016-08-19T11:47:59.315910-0700","level":"fatal","message":"filter when day time window begin and end times must be valid","object":{"attributes":{"action":"resolve"},"when":{"days":{"all":[{}]}},"name":"time"}}
{"timestamp":"2016-08-19T11:48:33.633027-0700","level":"fatal","message":"filter when day time window begin and end times must be valid","object":{"attributes":{"action":"resolve"},"when":{"days":{"all":[{"begin":"5:00 PM","end":"nope"}]}},"name":"time"}}

Screenshots (if appropriate):

N/A.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
@portertech

This comment has been minimized.

Copy link
Member Author

commented Aug 19, 2016

Example validation messages:

{"timestamp":"2016-08-19T11:45:15.632208-0700","level":"fatal","message":"filter when days must be a hash","object":{"attributes":{"action":"resolve"},"when":{},"name":"time"}}
{"timestamp":"2016-08-19T11:46:09.934273-0700","level":"fatal","message":"filter when days must be a hash","object":{"attributes":{"action":"resolve"},"when":{"days":[]},"name":"time"}}
{"timestamp":"2016-08-19T11:46:29.459711-0700","level":"fatal","message":"filter when days must include at least one day of the week or 'all'","object":{"attributes":{"action":"resolve"},"when":{"days":{}},"name":"time"}}
{"timestamp":"2016-08-19T11:46:54.405828-0700","level":"fatal","message":"filter when days must be valid days of the week or 'all'","object":{"attributes":{"action":"resolve"},"when":{"days":{"nope":{}}},"name":"time"}}
{"timestamp":"2016-08-19T11:47:14.189901-0700","level":"fatal","message":"filter when days all must be in an array","object":{"attributes":{"action":"resolve"},"when":{"days":{"all":{}}},"name":"time"}}
{"timestamp":"2016-08-19T11:47:29.176118-0700","level":"fatal","message":"filter when days all must include at least one time window","object":{"attributes":{"action":"resolve"},"when":{"days":{"all":[]}},"name":"time"}}
{"timestamp":"2016-08-19T11:47:45.568031-0700","level":"fatal","message":"filter when day time window must be a hash","object":{"attributes":{"action":"resolve"},"when":{"days":{"all":[[]]}},"name":"time"}}
{"timestamp":"2016-08-19T11:47:59.315910-0700","level":"fatal","message":"filter when day time window begin and end times must be valid","object":{"attributes":{"action":"resolve"},"when":{"days":{"all":[{}]}},"name":"time"}}
{"timestamp":"2016-08-19T11:48:33.633027-0700","level":"fatal","message":"filter when day time window begin and end times must be valid","object":{"attributes":{"action":"resolve"},"when":{"days":{"all":[{"begin":"5:00 PM","end":"nope"}]}},"name":"time"}}

@portertech portertech changed the title [WIP] Subdue 2.0 Subdue 2.0 Aug 19, 2016

@cwjohnston

This comment has been minimized.

Copy link
Member

commented Aug 22, 2016

Looking good. I think this is ready to go 👍

@cwjohnston cwjohnston added this to the 0.26 milestone Aug 22, 2016

@portertech portertech merged commit 8986141 into release/0.26 Aug 22, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@portertech portertech deleted the feature/subdue branch Aug 22, 2016

@portertech portertech removed the in progress label Aug 22, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.