class Instana::Snapshot::RubyProcess

Describes the current Ruby process @since 1.197.0

Constants

ID

Public Class Methods

new(pid: Process.pid) click to toggle source
# File lib/instana/snapshot/ruby_process.rb, line 11
def initialize(pid: Process.pid)
  @pid = pid
end

Public Instance Methods

data() click to toggle source
# File lib/instana/snapshot/ruby_process.rb, line 19
def data
  metrics_data.merge(Util.take_snapshot)
end
entity_id() click to toggle source
# File lib/instana/snapshot/ruby_process.rb, line 15
def entity_id
  @pid.to_s
end
snapshot() click to toggle source
# File lib/instana/snapshot/ruby_process.rb, line 23
def snapshot
  {
    name: ID,
    entityId: entity_id,
    data: data
  }
end

Private Instance Methods

metrics_data() click to toggle source
# File lib/instana/snapshot/ruby_process.rb, line 33
def metrics_data
  proc_table = Sys::ProcTable.ps(pid: Process.pid)
  process = Backend::ProcessInfo.new(proc_table)

  {
    pid: @pid,
    name: Util.get_app_name,
    exec_args: process.arguments,
    gc: Backend::GCSnapshot.instance.report,
    thread: {count: ::Thread.list.count},
    memory: {rss_size: proc_table.rss / 1024} # Bytes to Kilobytes
  }
end