Class: Instana::Collector::Memory
- Inherits:
-
Object
- Object
- Instana::Collector::Memory
- Defined in:
- lib/instana/collectors/memory.rb
Instance Attribute Summary collapse
-
#payload_key ⇒ Object
Returns the value of attribute payload_key.
Instance Method Summary collapse
-
#collect ⇒ Object
collect.
-
#initialize ⇒ Memory
constructor
A new instance of Memory.
Constructor Details
#initialize ⇒ Memory
Returns a new instance of Memory.
8 9 10 11 12 |
# File 'lib/instana/collectors/memory.rb', line 8 def initialize @payload_key = :memory @last_report = {} @this_mem = {} end |
Instance Attribute Details
#payload_key ⇒ Object
Returns the value of attribute payload_key.
6 7 8 |
# File 'lib/instana/collectors/memory.rb', line 6 def payload_key @payload_key end |
Instance Method Details
#collect ⇒ Object
collect
To collect process memory usage.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/instana/collectors/memory.rb', line 19 def collect @this_mem.clear @this_mem[:rss_size] = ::GetProcessMem.new(Process.pid).kb @this_mem = ::Instana::Util.enforce_deltas(@this_mem, @last_report) unless @this_mem.empty? @last_report.merge!(@this_mem) @this_mem else nil end rescue => e ::Instana.logger.error "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.}" ::Instana.logger.debug e.backtrace.join("\r\n") end |