Class: NewRelic::Agent::TransactionInfo
- Inherits:
-
Object
- Object
- NewRelic::Agent::TransactionInfo
- Defined in:
- lib/new_relic/agent/transaction_info.rb
Instance Attribute Summary collapse
-
#capture_deep_tt ⇒ Object
Returns the value of attribute capture_deep_tt.
-
#start_time ⇒ Object
readonly
Returns the value of attribute start_time.
-
#token ⇒ Object
Returns the value of attribute token.
-
#transaction_name ⇒ Object
Returns the value of attribute transaction_name.
Class Method Summary collapse
- .clear ⇒ Object
- .get ⇒ Object
- .get_token(request) ⇒ Object
-
.reset(request = nil) ⇒ Object
clears any existing transaction info object and initializes a new one.
- .set(instance) ⇒ Object
Instance Method Summary collapse
- #duration ⇒ Object
- #force_persist_sample?(sample) ⇒ Boolean
- #guid ⇒ Object
- #guid=(value) ⇒ Object
- #include_guid? ⇒ Boolean
-
#initialize ⇒ TransactionInfo
constructor
A new instance of TransactionInfo.
Constructor Details
#initialize ⇒ TransactionInfo
Returns a new instance of TransactionInfo.
10 11 12 13 14 |
# File 'lib/new_relic/agent/transaction_info.rb', line 10 def initialize @guid = "" @transaction_name = "(unknown)" @start_time = Time.now end |
Instance Attribute Details
#capture_deep_tt ⇒ Object
Returns the value of attribute capture_deep_tt.
7 8 9 |
# File 'lib/new_relic/agent/transaction_info.rb', line 7 def capture_deep_tt @capture_deep_tt end |
#start_time ⇒ Object (readonly)
Returns the value of attribute start_time.
8 9 10 |
# File 'lib/new_relic/agent/transaction_info.rb', line 8 def start_time @start_time end |
#token ⇒ Object
Returns the value of attribute token.
7 8 9 |
# File 'lib/new_relic/agent/transaction_info.rb', line 7 def token @token end |
#transaction_name ⇒ Object
Returns the value of attribute transaction_name.
7 8 9 |
# File 'lib/new_relic/agent/transaction_info.rb', line 7 def transaction_name @transaction_name end |
Class Method Details
.clear ⇒ Object
44 45 46 |
# File 'lib/new_relic/agent/transaction_info.rb', line 44 def self.clear Thread.current[:newrelic_transaction_info] = nil end |
.get ⇒ Object
36 37 38 |
# File 'lib/new_relic/agent/transaction_info.rb', line 36 def self.get() Thread.current[:newrelic_transaction_info] ||= TransactionInfo.new end |
.get_token(request) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/new_relic/agent/transaction_info.rb', line 56 def self.get_token(request) return nil unless request agent_flag = request.['NRAGENT'] if agent_flag s = agent_flag.split("=") if s.length == 2 if s[0] == "tk" && s[1] ERB::Util.h(s[1]) end end else nil end end |
.reset(request = nil) ⇒ Object
clears any existing transaction info object and initializes a new one. This starts the timer for the transaction.
50 51 52 53 54 |
# File 'lib/new_relic/agent/transaction_info.rb', line 50 def self.reset(request=nil) clear instance = get instance.token = get_token(request) end |
.set(instance) ⇒ Object
40 41 42 |
# File 'lib/new_relic/agent/transaction_info.rb', line 40 def self.set(instance) Thread.current[:newrelic_transaction_info] = instance end |
Instance Method Details
#duration ⇒ Object
32 33 34 |
# File 'lib/new_relic/agent/transaction_info.rb', line 32 def duration Time.now - start_time end |
#force_persist_sample?(sample) ⇒ Boolean
16 17 18 |
# File 'lib/new_relic/agent/transaction_info.rb', line 16 def force_persist_sample?(sample) token && sample.duration > NewRelic::Control.instance.apdex_t end |
#guid ⇒ Object
24 25 26 |
# File 'lib/new_relic/agent/transaction_info.rb', line 24 def guid @guid end |
#guid=(value) ⇒ Object
28 29 30 |
# File 'lib/new_relic/agent/transaction_info.rb', line 28 def guid=(value) @guid = value end |