Sha256: d948b819ccfe16a8b45a28142f9de80edd6d602a9e5af7c40b724b17bcb6b3f7
Contents?: true
Size: 995 Bytes
Versions: 10
Compression:
Stored size: 995 Bytes
Contents
# This installs some code to manually start the agent when a delayed job worker starts. module NewRelic module DelayedJobInjection extend self attr_accessor :worker_name end end Delayed::Worker.class_eval do def initialize_with_new_relic(*args) initialize_without_new_relic(*args) worker_name = case when self.respond_to?(:name) then self.name when self.class.respond_to?(:default_name) then self.class.default_name end dispatcher_instance_id = worker_name || "host:#{Socket.gethostname} pid:#{Process.pid}" rescue "pid:#{Process.pid}" say "RPM Monitoring DJ worker #{dispatcher_instance_id}" NewRelic::Agent.manual_start :dispatcher => :delayed_job, :dispatcher_instance_id => dispatcher_instance_id NewRelic::DelayedJobInjection.worker_name = worker_name end alias initialize_without_new_relic initialize alias initialize initialize_with_new_relic end if defined?(::Delayed::Worker) and not NewRelic::Control.instance['disable_dj']
Version data entries
10 entries across 10 versions & 1 rubygems