Class: ElasticAPM::Metrics::CpuMem::Linux Private

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic_apm/metrics/cpu_mem.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.

Defined Under Namespace

Classes: Meminfo, ProcSelfStat, ProcStat

Constant Summary collapse

UTIME_POS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

13
STIME_POS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

14
VSIZE_POS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

22
RSS_POS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

23

Instance Method Summary collapse

Instance Method Details

#sampleObject

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.

rubocop:disable Metrics/MethodLength, Metrics/AbcSize



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/elastic_apm/metrics/cpu_mem.rb', line 105

def sample
  proc_stat = ProcStat.new.read!
  proc_self_stat = ProcSelfStat.new.read!
  meminfo = Meminfo.new.read!

  Sample.new(
    system_cpu_total: proc_stat.total,
    system_cpu_usage: proc_stat.usage,
    system_memory_total: meminfo.total,
    system_memory_free: meminfo.available,
    process_cpu_usage: proc_self_stat.total,
    process_memory_size: proc_self_stat.vsize,
    process_memory_rss: proc_self_stat.rss,
    page_size: meminfo.page_size
  )
end