Sha256: 0e54cde807bff98a6404b78f1158234cb54fbcd2086387688c50cccb12ebee24

Contents?: true

Size: 766 Bytes

Versions: 7

Compression:

Stored size: 766 Bytes

Contents

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

module Instana
  module Collectors
    class Thread
      attr_accessor :payload_key

      def initialize
        @payload_key = :thread
        @this_count = {}
      end

      ##
      # collect
      #
      # To collect thread count
      #
      def collect
        @this_count[:count] = ::Thread.list.count
        @this_count
      rescue => e
        ::Instana.logger.info "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}"
        ::Instana.logger.debug { e.backtrace.join("\r\n") }
      end
    end
  end
end

# Register the metrics collector if enabled
if ::Instana.config[:metrics][:thread][:enabled]
  ::Instana.collector.register(::Instana::Collectors::Thread)
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
instana-1.195.4 lib/instana/collectors/thread.rb
instana-1.195.3 lib/instana/collectors/thread.rb
instana-1.195.2 lib/instana/collectors/thread.rb
instana-1.195.1 lib/instana/collectors/thread.rb
instana-1.195.0 lib/instana/collectors/thread.rb
instana-1.193.6 lib/instana/collectors/thread.rb
instana-1.193.5 lib/instana/collectors/thread.rb