class NewRelic::Agent::Transaction::DeveloperModeSampleBuffer

Constants

CAPACITY

Public Instance Methods

capacity() click to toggle source
# File lib/new_relic/agent/transaction/developer_mode_sample_buffer.rb, line 13
def capacity
  max_capacity
end
enabled?() click to toggle source
# File lib/new_relic/agent/transaction/developer_mode_sample_buffer.rb, line 27
def enabled?
  Agent.config[:developer_mode]
end
harvest_samples() click to toggle source
# File lib/new_relic/agent/transaction/developer_mode_sample_buffer.rb, line 23
def harvest_samples
  NO_SAMPLES
end
max_capacity() click to toggle source

Dev mode is allowed more than the typical upper limit. Sidestep normal cap by overriding max_capacity.

# File lib/new_relic/agent/transaction/developer_mode_sample_buffer.rb, line 19
def max_capacity
  CAPACITY
end
store_previous(*) click to toggle source

We don't hold onto previously trapped transactions on harvest We've already got all the traces we want, thank you!

# File lib/new_relic/agent/transaction/developer_mode_sample_buffer.rb, line 38
def store_previous(*)
end
strip_newrelic_frames(trace) click to toggle source
# File lib/new_relic/agent/transaction/developer_mode_sample_buffer.rb, line 51
def strip_newrelic_frames(trace)
  while trace.first =~/\/lib\/new_relic\/agent\//
    trace.shift
  end
  trace
end
truncate_samples() click to toggle source

Truncate to the last capacity samples we've received

# File lib/new_relic/agent/transaction/developer_mode_sample_buffer.rb, line 32
def truncate_samples
  @samples = @samples.last(capacity)
end
visit_node(node) click to toggle source

Captures the stack trace for a node This is expensive and not for production mode

# File lib/new_relic/agent/transaction/developer_mode_sample_buffer.rb, line 43
def visit_node(node)
  return unless enabled? && node

  trace = strip_newrelic_frames(caller)
  trace = trace.first(40) if trace.length > 40
  node[:backtrace] = trace
end