Class: Instana::Collector::Thread
- Inherits:
-
Object
- Object
- Instana::Collector::Thread
- Defined in:
- lib/instana/collectors/thread.rb
Instance Attribute Summary collapse
-
#payload_key ⇒ Object
Returns the value of attribute payload_key.
Instance Method Summary collapse
-
#collect ⇒ Object
collect.
-
#initialize ⇒ Thread
constructor
A new instance of Thread.
Constructor Details
#initialize ⇒ Thread
Returns a new instance of Thread.
6 7 8 9 10 |
# File 'lib/instana/collectors/thread.rb', line 6 def initialize @payload_key = :thread @last_report = {} @this_count = {} end |
Instance Attribute Details
#payload_key ⇒ Object
Returns the value of attribute payload_key.
4 5 6 |
# File 'lib/instana/collectors/thread.rb', line 4 def payload_key @payload_key end |
Instance Method Details
#collect ⇒ Object
collect
To collect thread count
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/instana/collectors/thread.rb', line 17 def collect @this_count[:count] = ::Thread.list.count @this_count = ::Instana::Util.enforce_deltas(@this_count, @last_report) unless @this_count.empty? @last_report.merge!(@this_count) @this_count else nil end rescue => e ::Instana.logger.error "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.}" ::Instana.logger.debug e.backtrace.join("\r\n") end |