Sha256: 352ded845536b4814aa9e3eff72cc33553bb583acc0a893eadd23cc2604b7b8a

Contents?: true

Size: 960 Bytes

Versions: 19

Compression:

Stored size: 960 Bytes

Contents

module NewRelic
  module Agent

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

      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

      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
        profile_agent_code ? bt : bt.select { |t| t !~ /\/newrelic_rpm-\d/ }
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 3 rubygems

Version Path
wd_newrelic_rpm-3.5.8 lib/new_relic/agent/thread.rb
sundawg_newrelic_rpm-3.5.8.2 lib/new_relic/agent/thread.rb
sundawg_newrelic_rpm-3.5.8.1 lib/new_relic/agent/thread.rb
newrelic_rpm-3.5.8.72 lib/new_relic/agent/thread.rb
newrelic_rpm-3.5.8.70 lib/new_relic/agent/thread.rb
newrelic_rpm-3.5.8.64.beta lib/new_relic/agent/thread.rb
newrelic_rpm-3.5.7.59 lib/new_relic/agent/thread.rb
newrelic_rpm-3.5.7.59.beta lib/new_relic/agent/thread.rb
newrelic_rpm-3.5.7.58.beta lib/new_relic/agent/thread.rb
wd_newrelic_rpm-3.5.6 lib/new_relic/agent/thread.rb
newrelic_rpm-3.5.7.57.beta lib/new_relic/agent/thread.rb
newrelic_rpm-3.5.6.55 lib/new_relic/agent/thread.rb
newrelic_rpm-3.5.6.48.beta lib/new_relic/agent/thread.rb
newrelic_rpm-3.5.6.46.beta lib/new_relic/agent/thread.rb
newrelic_rpm-3.5.6.42.beta lib/new_relic/agent/thread.rb
newrelic_rpm-3.5.5.39.beta lib/new_relic/agent/thread.rb
wd_newrelic_rpm-3.5.5 lib/new_relic/agent/thread.rb
newrelic_rpm-3.5.5.38 lib/new_relic/agent/thread.rb
newrelic_rpm-3.5.5.540.dev lib/new_relic/agent/thread.rb