class Instana::Backend::ProcessInfo
Wrapper around {Sys::ProcTable} that adds support for reading the /proc file system for extra information around containers @since 1.197.0
Public Instance Methods
arguments()
click to toggle source
# File lib/instana/backend/process_info.rb, line 15 def arguments _, *arguments = cmdline.split(' ') clean_arguments(arguments) end
cpuset()
click to toggle source
# File lib/instana/backend/process_info.rb, line 32 def cpuset path = "/proc/#{pid}/cpuset" return unless File.exist?(path) File.read(path).strip end
from_parent_namespace()
click to toggle source
# File lib/instana/backend/process_info.rb, line 28 def from_parent_namespace !in_container? || in_container? && sched_pid != pid end
in_container?()
click to toggle source
# File lib/instana/backend/process_info.rb, line 39 def in_container? !cpuset.nil? && cpuset != '/' end
memory_used()
click to toggle source
# File lib/instana/backend/process_info.rb, line 50 def memory_used if RbConfig::CONFIG['host_os'].include?('darwin') rss / 1024 else rss * 4096 end end
name()
click to toggle source
# File lib/instana/backend/process_info.rb, line 10 def name cmdline .split(' ').first end
parent_pid()
click to toggle source
# File lib/instana/backend/process_info.rb, line 20 def parent_pid if in_container? && sched_pid != pid sched_pid else pid end end
sched_pid()
click to toggle source
# File lib/instana/backend/process_info.rb, line 43 def sched_pid path = '/proc/self/sched' return unless File.exist?(path) File.read(path).match(/\d+/).to_s.to_i end
Private Instance Methods
clean_arguments(arguments)
click to toggle source
# File lib/instana/backend/process_info.rb, line 60 def clean_arguments(arguments) return arguments unless RbConfig::CONFIG['host_os'].include?('darwin') arguments.reject do |a| if a.include?('=') k, = a.split('=', 2) ENV[k] end end end