-
Notifications
You must be signed in to change notification settings - Fork 283
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
Failover handlers when async_handler fails #135
Conversation
5332536
to
216ee56
Compare
The users can now configure the async_handler in this way: Rollbar.configure do |config| config.async_handler = Rollbar::Delay::Thread end Also allowed for config.failover_handlers.
configuration.async_handler ||= default_async_handler | ||
configuration.async_handler.call(payload) | ||
rescue | ||
raise unless configuration.failover_handlers.any? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this exception going to go?
Asking because I want to make sure that:
- it won't bubble up to the end-user
- it still gets logged somewhere (i.e. to the rails log)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I'm only reraising the exception in case that the handler failed to process the payload. Really this is the actual behaviour. If you don't have any failover handler, then it just crashes, isn't it?
Well, it will not crash cause it's rescued in https://github.com/jondeandres/rollbar-gem/blob/failover/lib/rollbar.rb#L111.
This will be logged in https://github.com/jondeandres/rollbar-gem/blob/failover/lib/rollbar.rb#L566 finally
OK one last concern: In the case where all failovers fail, we are eventually going to call The system is probably under stress when this happens so I think we should probably just short-circuit all of that and log, but not re-raise, the error when the failovers are exhausted. What do you think? |
Mmmm. it's true @brianr... What if we finally send it inline calling Something we should do it's perhaps recommend the customers to use at least the The easiest solution is just log an error here, of course. |
I think recommending |
One question @brianr, actually the behaviour you've explained it's really the actual behaviour, isn't it? I mean, if the only async_handler fails Just to understand this. |
Yeah, right now, in master, it's going to go around again (and probably fail again). |
…ndlers fail too. Log errors instead.
This method will set Rollbar::Delay::Thread as the async handler. It just use a Thread in order to process the payload.
Now users can set Resque in this way: config.use_resque queue: 'errors' # queue is optional.
Failover handlers when async_handler fails
This PR allow the users to define an array of failover handlers when the async_handler fails, for example in a Redis push, connection etc...
The users can use it in this way:
It's also possible to use the default async handler:
An interesting refactor could be replace the
Rollbar.default_async_handler
in order to use classes likeRollbar::Delay::Thread
orRollbar::Delay::GirlFriday
. I think thatRollbar::Delay::Thread
could be the most used failover handler.