When processes fail, provide a stacktrace to the Resque failure queue #62
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, when
goworker
workers fail due to an uncaught error, tracking down the root cause of the problem is rather difficult. Only the contents of the error message itself is passed to the Resque failure queue, unlike other languages (e.g. Ruby), which pass the entire stack trace.Golang's errors do not support stack traces out of the box. The go-errors package makes it possible to attach stack trace information to the errors either at creation-time, or at wrapping-time.
This pull request takes advantage of the idempotency of
go-errors
'sWrap()
function, allowing a worker to either raise ago-errors
error
object themselves, or automatically wrapping a standard Golang error when the failure is observed bygoworker
. A worker that throws a standard error will see the same information currently provided to the failure queue, with a stack trace pointing them togoworker/worker.go
as the investigation point. A worker that wraps their standard error withgo-errors
will see that same information, plus a full stack trace to the point that the user instantiated/wrapped thego-errors
error object.