Class: ElasticAPM::Metrics::CpuMemSet::Linux Private

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

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.



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/elastic_apm/metrics/cpu_mem_set.rb', line 130

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