Closed pawel2105 closed 4 years ago
A good API could be taking a block that can get called when the out of memory condition is hit, but then people would be responsible for the specific code, like notifying airbrake/rollbar/whatever.
@pawel2105 a PR was just merged that might give you that ability.
https://github.com/schneems/puma_worker_killer/blob/master/lib/puma_worker_killer/reaper.rb#L28
The above line will call a pre_term
function defined on the config object right before terminating the worker.
So, you could do the following in an initializer (pseudo-code for Airbrake, not sure what their API is):
PumaWorkerKiller.config do |config|
config.pre_term = -> (worker) { Airbrake.notify("Worker killed due to out of memory", worker) }
end
Hey @schneems
What are your thoughts on adding some kind of hook to the PumaWorkerKiller config block to allow for Airbrake integration on worker pruning? It'd be a good idea to have some kind of audit for how often memory is maxed out, without relying on something like NewRelic.