-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
Add execution_result to event payload for perform_job.good_job #885
Add execution_result to event payload for perform_job.good_job #885
Conversation
This will enable listeners to log different things depending on the result of execution
Adding to the payload is good, but I'm reluctant to expose the ExecutionResult as part of the public interface. Would it be ok to add the discrete params to the payload instead? |
Something like |
app/models/good_job/execution.rb
Outdated
@@ -345,9 +345,9 @@ def perform | |||
end | |||
handled_error ||= current_thread.error_on_retry || current_thread.error_on_discard | |||
|
|||
ExecutionResult.new(value: value, handled_error: handled_error, retried: current_thread.error_on_retry.present?) | |||
instrument_payload[:execution_result] = ExecutionResult.new(value: value, handled_error: handled_error, retried: current_thread.error_on_retry.present?) |
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.
As part of the public interface, I want to be explicit
instrument_payload[:execution_result] = ExecutionResult.new(value: value, handled_error: handled_error, retried: current_thread.error_on_retry.present?) | |
instrument_payload.merge!( | |
value: value, | |
handled_error: handled_error, | |
retried: current_thread.error_on_retry.present? | |
) |
This will enable listeners to log different things depending on the result of execution (in particular, I will use it to log the result as a statsd tag)