Class: NewRelic::Agent::Samplers::DelayedJobLockSampler
Instance Attribute Summary
#id, #stats_engine
Class Method Summary
collapse
Instance Method Summary
collapse
inherited, sampler_classes, use_harvest_sampler?
Constructor Details
Returns a new instance of DelayedJobLockSampler.
Class Method Details
27
28
29
|
# File 'lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb', line 27
def self.supported_on_this_platform?
defined?(Delayed::Job)
end
|
Instance Method Details
#local_env ⇒ Object
15
16
17
|
# File 'lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb', line 15
def local_env
NewRelic::Control.instance.local_env
end
|
#locked_jobs ⇒ Object
23
24
25
|
# File 'lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb', line 23
def locked_jobs
Delayed::Job.count(:conditions => {:locked_by => NewRelic::DelayedJobInjection.worker_name})
end
|
#poll ⇒ Object
31
32
33
|
# File 'lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb', line 31
def poll
stats.record_data_point locked_jobs
end
|
#stats ⇒ Object
11
12
13
|
# File 'lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb', line 11
def stats
stats_engine.get_stats("Custom/DJ Locked Jobs", false)
end
|
#worker_name ⇒ Object
19
20
21
|
# File 'lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb', line 19
def worker_name
local_env.dispatcher_instance_id
end
|