Class: ElasticAPM::Metrics::VMSet Private
- Includes:
- Logging
- Defined in:
- lib/elastic_apm/metrics/vm_set.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary
Constants included from Logging
Logging::LEVELS, Logging::PREFIX
Constants inherited from Set
Instance Attribute Summary
Attributes inherited from Set
Instance Method Summary collapse
- #collect ⇒ Object private
- #read! ⇒ Object private
Methods included from Logging
#debug, #error, #fatal, #info, #warn
Methods inherited from Set
#counter, #disable!, #disabled?, #gauge, #initialize, #metric, #timer
Constructor Details
This class inherits a constructor from ElasticAPM::Metrics::Set
Instance Method Details
#collect ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 29 |
# File 'lib/elastic_apm/metrics/vm_set.rb', line 26 def collect read! super end |
#read! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/elastic_apm/metrics/vm_set.rb', line 31 def read! return if disabled? stat = GC.stat gauge(:'ruby.gc.count').value = stat[:count] gauge(:'ruby.threads').value = Thread.list.count gauge(:'ruby.heap.slots.live').value = stat[:heap_live_slots] gauge(:'ruby.heap.slots.free').value = stat[:heap_free_slots] gauge(:'ruby.heap.allocations.total').value = stat[:total_allocated_objects] return unless GC::Profiler.enabled? @total_time ||= 0 @total_time += GC::Profiler.total_time GC::Profiler.clear gauge(:'ruby.gc.time').value = @total_time rescue TypeError => e error 'VM metrics encountered error: %s', e debug('Backtrace:') { e.backtrace.join("\n") } disable! end |