class NewRelic::Agent::Tracer::State

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.

Attributes

current_transaction[RW]

Current transaction stack

record_sql[RW]

TT’s and SQL

sql_sampler_transaction_data[RW]

Sql Sampler Transaction Data

untraced[RW]

Execution tracing on current thread

Public Class Methods

new() click to toggle source
# File lib/new_relic/agent/tracer.rb, line 465
def initialize
  @untraced = []
  @current_transaction = nil
  @record_sql = nil
end

Public Instance Methods

is_execution_traced?() click to toggle source
# File lib/new_relic/agent/tracer.rb, line 496
def is_execution_traced?
  @untraced.nil? || @untraced.last != false
end
Also aliased as: tracing_enabled?
is_sql_recorded?() click to toggle source
# File lib/new_relic/agent/tracer.rb, line 505
def is_sql_recorded?
  @record_sql != false
end
pop_traced() click to toggle source
# 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) click to toggle source
# File lib/new_relic/agent/tracer.rb, line 487
def push_traced(should_trace)
  @untraced << should_trace
end
reset(transaction = nil) click to toggle source

This starts the timer for the transaction.

# 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
tracing_enabled?()