Suggestion: Add around iterate callback#445
Conversation
|
Since you mention "metrics collection and logging" you might be interested in #338 which added the You could also bring your own |
Right, thanks for the comment! Yeah those are certainly useful too, we use some of the current notifications for metrics and logging. Apart from the main use case I'm trying to address, which re-defining the canonical logger's unit-of-work for each iteration, the PR allows also some advanced instrumentation mechanisms that, similar to the logger, rely on wrapping the execution block, e.g: Database query count and database time, captured in a given context (which under the hood also use ActiveSupport's notifications, but from active record) |
There has been some circumstances that it would be great to append a callback to job iterations. More noticeably, that adds extensibility to build some generic handlers, such as metrics collection and logging.
At shopify, a particular use case that'll be especially useful is to deal with the canonical logger and long iterating jobs.