class NewRelic::Agent::Samplers::MemorySampler::Base
Public Class Methods
Source
# File lib/new_relic/agent/samplers/memory_sampler.rb, line 72 def initialize @broken = false end
Public Instance Methods
Source
# File lib/new_relic/agent/samplers/memory_sampler.rb, line 76 def can_run? return false if @broken m = get_memory rescue nil m && m > 0 end
Source
# File lib/new_relic/agent/samplers/memory_sampler.rb, line 83 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