Sha256: 507b647e020db45aa85e343f3ad9c2df0f142b4fde90fae703bd4ca499f9b13b

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

module NewRelic
  module Agent
    class TransactionInfo
      
      attr_accessor :token, :capture_deep_tt, :transaction_name
      attr_reader :start_time
      
      def initialize
        @guid = ""
        @transaction_name = "(unknown)"
        @start_time = Time.now
      end
      
      def force_persist_sample?(sample)
        token && sample.duration > NewRelic::Control.instance.apdex_t
      end
      
      def include_guid?
        token && duration > NewRelic::Control.instance.apdex_t
      end
      
      def guid
        @guid
      end
      
      def guid=(value)
        @guid = value
      end
      
      def duration
        Time.now - start_time
      end
      
      def self.get()
        Thread.current[:newrelic_transaction_info] ||= TransactionInfo.new
      end
      
      def self.set(instance)
        Thread.current[:newrelic_transaction_info] = instance
      end
      
      def self.clear
        Thread.current[:newrelic_transaction_info] = nil
      end
      
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
newrelic_rpm-3.3.1.beta1 lib/new_relic/agent/transaction_info.rb
newrelic_rpm-3.3.0 lib/new_relic/agent/transaction_info.rb
newrelic_rpm-3.3.0.beta1 lib/new_relic/agent/transaction_info.rb