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

Add execution_result to event payload for perform_job.good_job #885

Merged

Conversation

segiddins
Copy link
Contributor

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)

This will enable listeners to log different things depending on the result of execution
@bensheldon
Copy link
Owner

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?

@segiddins
Copy link
Contributor Author

Something like instrument_payload.merge!(execution_result.to_h) ?

@@ -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?)
Copy link
Owner

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

Suggested change
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?
)

@bensheldon bensheldon merged commit 6e19dca into bensheldon:main Mar 14, 2023
segiddins added a commit to rubygems/rubygems.org that referenced this pull request Mar 14, 2023
segiddins added a commit to rubygems/rubygems.org that referenced this pull request Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants