Sha256: 9e40f48c4a45c64ec22beb3bf4bb38b2db69a656e6a5811dad11ff93a9de6258
Contents?: true
Size: 1014 Bytes
Versions: 2
Compression:
Stored size: 1014 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}" self.class.logger.info "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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
newrelic_rpm-2.10.4 | lib/new_relic/delayed_job_injection.rb |
newrelic_rpm-2.10.3 | lib/new_relic/delayed_job_injection.rb |