Sha256: a305255f7e52fc8a16666ce147a839c76984e45cc796bdc3de1466e621861f37

Contents?: true

Size: 1008 Bytes

Versions: 57

Compression:

Stored size: 1008 Bytes

Contents

# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2021

module Instana
  module Snapshot
    # Describes the current Ruby process
    # @since 1.197.0
    class RubyProcess
      ID = 'com.instana.plugin.ruby'.freeze

      def initialize(pid: Process.pid)
        @pid = pid
      end

      def entity_id
        @pid.to_s
      end

      def data
        metrics_data.merge(Util.take_snapshot)
      end

      def snapshot
        {
          name: ID,
          entityId: entity_id,
          data: data
        }
      end

      private

      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
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
instana-1.217.1 lib/instana/snapshot/ruby_process.rb
instana-1.217.0 lib/instana/snapshot/ruby_process.rb
instana-1.216.0 lib/instana/snapshot/ruby_process.rb
instana-1.215.1 lib/instana/snapshot/ruby_process.rb
instana-1.215.0 lib/instana/snapshot/ruby_process.rb
instana-1.214.4 lib/instana/snapshot/ruby_process.rb
instana-1.214.3 lib/instana/snapshot/ruby_process.rb
instana-1.214.2 lib/instana/snapshot/ruby_process.rb
instana-1.214.1 lib/instana/snapshot/ruby_process.rb
instana-1.214.0 lib/instana/snapshot/ruby_process.rb
instana-1.213.3 lib/instana/snapshot/ruby_process.rb
instana-1.213.2 lib/instana/snapshot/ruby_process.rb
instana-1.213.1 lib/instana/snapshot/ruby_process.rb
instana-1.213.0 lib/instana/snapshot/ruby_process.rb
instana-1.212.0 lib/instana/snapshot/ruby_process.rb
instana-1.211.0 lib/instana/snapshot/ruby_process.rb
instana-1.210.1 lib/instana/snapshot/ruby_process.rb
instana-1.210.0 lib/instana/snapshot/ruby_process.rb
instana-1.209.8 lib/instana/snapshot/ruby_process.rb
instana-1.209.7 lib/instana/snapshot/ruby_process.rb