Yelp / sensu_handlers

Custom Sensu Handlers to support a multi-tenant environment, allowing checks themselves to emit the type of handler behavior they need in the event json
Apache License 2.0
75 stars 31 forks source link

add num_occurrences_filter as sensu extension #79

Closed somic closed 8 years ago

somic commented 8 years ago

This moves some filtering logic from handlers to a sensu extension filter that will run inside sensu-server process.

sensu extension was tested internally with a noop handler.

By default this is off and can be enabled in hiera per host or per region, etc.

solarkennedy commented 8 years ago

Whoa! If this works this would be a massive cpu saving filter!

I say ship, I don't really know enough about sensu extensions to really review thoroughly.

My only other reservation is that we have tested the crap out of this logic in the base handler, and I would like to see that carried over if possible. It "feels" pretty easy to mess up this logic, and we have hit quite a few bugs with it and the tests really helped. I'm ok with them being duplicated in the short term.

somic commented 8 years ago

Code is copy-paste of filter_repeated from base.rb, with small modifications that should not impact logic.

I will try to port all rspec tests from https://github.com/Yelp/sensu_handlers/blob/master/spec/functions/base_spec.rb#L161 (context "check filter_repeated") in addition to tests I already have and then will merge.