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
30
31
32
|
# File 'lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb', line 30
def self.supported_on_this_platform?
defined?(Delayed::Job)
end
|
Instance Method Details
#local_env ⇒ Object
18
19
20
|
# File 'lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb', line 18
def local_env
NewRelic::Control.instance.local_env
end
|
#locked_jobs ⇒ Object
26
27
28
|
# File 'lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb', line 26
def locked_jobs
Delayed::Job.count(:conditions => {:locked_by => NewRelic::DelayedJobInjection.worker_name})
end
|
#poll ⇒ Object
34
35
36
|
# File 'lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb', line 34
def poll
stats.record_data_point locked_jobs
end
|
#stats ⇒ Object
14
15
16
|
# File 'lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb', line 14
def stats
stats_engine.get_stats("Custom/DJ Locked Jobs", false)
end
|
#worker_name ⇒ Object
22
23
24
|
# File 'lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb', line 22
def worker_name
local_env.dispatcher_instance_id
end
|