Class: NewRelic::Agent::Tracer::State
- Inherits:
-
Object
- Object
- NewRelic::Agent::Tracer::State
- Defined in:
- lib/new_relic/agent/tracer.rb
Overview
This is THE location to store thread local information during a transaction Need a new piece of data? Add a method here, NOT a new thread local variable.
Instance Attribute Summary collapse
-
#current_transaction ⇒ Object
Current transaction stack.
-
#record_sql ⇒ Object
TT’s and SQL.
-
#sql_sampler_transaction_data ⇒ Object
Sql Sampler Transaction Data.
-
#untraced ⇒ Object
Execution tracing on current thread.
Instance Method Summary collapse
-
#initialize ⇒ State
constructor
A new instance of State.
- #is_execution_traced? ⇒ Boolean (also: #tracing_enabled?)
- #is_sql_recorded? ⇒ Boolean
- #pop_traced ⇒ Object
- #push_traced(should_trace) ⇒ Object
-
#reset(transaction = nil) ⇒ Object
This starts the timer for the transaction.
Constructor Details
#initialize ⇒ State
Returns a new instance of State.
465 466 467 468 469 |
# File 'lib/new_relic/agent/tracer.rb', line 465 def initialize @untraced = [] @current_transaction = nil @record_sql = nil end |
Instance Attribute Details
#current_transaction ⇒ Object
Current transaction stack
482 483 484 |
# File 'lib/new_relic/agent/tracer.rb', line 482 def current_transaction @current_transaction end |
#record_sql ⇒ Object
TT’s and SQL
503 504 505 |
# File 'lib/new_relic/agent/tracer.rb', line 503 def record_sql @record_sql end |
#sql_sampler_transaction_data ⇒ Object
Sql Sampler Transaction Data
510 511 512 |
# File 'lib/new_relic/agent/tracer.rb', line 510 def sql_sampler_transaction_data @sql_sampler_transaction_data end |
#untraced ⇒ Object
Execution tracing on current thread
485 486 487 |
# File 'lib/new_relic/agent/tracer.rb', line 485 def untraced @untraced end |
Instance Method Details
#is_execution_traced? ⇒ Boolean Also known as: tracing_enabled?
496 497 498 |
# File 'lib/new_relic/agent/tracer.rb', line 496 def is_execution_traced? @untraced.nil? || @untraced.last != false end |
#is_sql_recorded? ⇒ Boolean
505 506 507 |
# File 'lib/new_relic/agent/tracer.rb', line 505 def is_sql_recorded? @record_sql != false end |
#pop_traced ⇒ Object
491 492 493 494 |
# File 'lib/new_relic/agent/tracer.rb', line 491 def pop_traced # needs else branch coverage @untraced.pop if @untraced # rubocop:disable Style/SafeNavigation end |
#push_traced(should_trace) ⇒ Object
487 488 489 |
# File 'lib/new_relic/agent/tracer.rb', line 487 def push_traced(should_trace) @untraced << should_trace end |
#reset(transaction = nil) ⇒ Object
This starts the timer for the transaction.
472 473 474 475 476 477 478 479 |
# File 'lib/new_relic/agent/tracer.rb', line 472 def reset(transaction = nil) # We purposefully don't reset @untraced or @record_sql # since those are managed by NewRelic::Agent.disable_* calls explicitly # and (more importantly) outside the scope of a transaction @current_transaction = transaction @sql_sampler_transaction_data = nil end |