Class: NewRelic::Agent::Threading::AgentThread
- Inherits:
-
Thread
- Object
- Thread
- NewRelic::Agent::Threading::AgentThread
- Defined in:
- lib/new_relic/agent/threading/agent_thread.rb
Class Method Summary collapse
- .bucket_thread(thread, profile_agent_code) ⇒ Object
- .scrub_backtrace(thread, profile_agent_code) ⇒ Object
Instance Method Summary collapse
-
#initialize(label) ⇒ AgentThread
constructor
A new instance of AgentThread.
Constructor Details
#initialize(label) ⇒ AgentThread
Returns a new instance of AgentThread.
10 11 12 13 14 |
# File 'lib/new_relic/agent/threading/agent_thread.rb', line 10 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
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/new_relic/agent/threading/agent_thread.rb', line 16 def self.bucket_thread(thread, profile_agent_code) if thread.key?(:newrelic_label) profile_agent_code ? :agent : :ignore elsif TransactionState.in_background_transaction?(thread) :background elsif TransactionState.in_request_transaction?(thread) :request else :other end end |
.scrub_backtrace(thread, profile_agent_code) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/new_relic/agent/threading/agent_thread.rb', line 28 def self.scrub_backtrace(thread, profile_agent_code) begin bt = thread.backtrace rescue Exception => e ::NewRelic::Agent.logger.debug("Failed to backtrace #{thread.inspect}: #{e.class.name}: #{e.to_s}") end return nil unless bt bt.reject! { |t| t.include?('/newrelic_rpm-') } unless profile_agent_code bt end |