Class: NewRelic::Agent::Thread

Inherits:
Thread
  • Object
show all
Defined in:
lib/new_relic/agent/thread.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label) ⇒ Thread

Returns a new instance of Thread.



5
6
7
8
9
# File 'lib/new_relic/agent/thread.rb', line 5

def initialize(label)
  NewRelic::Agent.logger.debug("Creating New Relic thread: #{label}")
  self[:newrelic_label] = label
  super
end

Class Method Details

.bucket_thread(thread, profile_agent_code) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/new_relic/agent/thread.rb', line 11

def self.bucket_thread(thread, profile_agent_code)
  if thread.key?(:newrelic_label)
    return profile_agent_code ? :agent : :ignore
  elsif !thread[:newrelic_metric_frame].nil?
    thread[:newrelic_metric_frame].request.nil? ? :background : :request
  else
    :other
  end
end

.scrub_backtrace(thread, profile_agent_code) ⇒ Object



21
22
23
24
# File 'lib/new_relic/agent/thread.rb', line 21

def self.scrub_backtrace(thread, profile_agent_code)
  return thread.backtrace if profile_agent_code
  thread.backtrace.select {|t| t !~ /\/newrelic_rpm-\d/ }
end