Class: NewRelic::Agent::Samplers::MemorySampler::Base
- Inherits:
-
Object
- Object
- NewRelic::Agent::Samplers::MemorySampler::Base
show all
- Defined in:
- lib/new_relic/agent/samplers/memory_sampler.rb
Instance Method Summary
collapse
Instance Method Details
#can_run? ⇒ Boolean
61
62
63
64
65
|
# File 'lib/new_relic/agent/samplers/memory_sampler.rb', line 61
def can_run?
return false if @broken
m = get_memory rescue nil
m && m > 0
end
|
#get_sample ⇒ Object
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/new_relic/agent/samplers/memory_sampler.rb', line 66
def get_sample
return nil if @broken
begin
m = get_memory
if m.nil?
::NewRelic::Agent.logger.warn "Unable to get the resident memory for process #{$$}. Disabling memory sampler."
@broken = true
end
return m
rescue => e
::NewRelic::Agent.logger.warn "Unable to get the resident memory for process #{$$}. Disabling memory sampler.", e
@broken = true
return nil
end
end
|