Sha256: 5760aa3ca09cc8781c6ae3d80e53d348132fe010e04c143115d7c15d9a005983
Contents?: true
Size: 996 Bytes
Versions: 8
Compression:
Stored size: 996 Bytes
Contents
class ScoutRails::TransactionSample BACKTRACE_THRESHOLD = 0.5 # the minimum threshold to record the backtrace for a metric. BACKTRACE_LIMIT = 5 # Max length of callers to display MAX_SIZE = 100 # Limits the size of the metric hash to prevent a metric explosion. attr_reader :metric_name, :total_call_time, :metrics, :meta, :uri # Given a call stack, generates a filtered backtrace that: # * Limits to the app/models, app/controllers, or app/views directories # * Limits to 5 total callers # * Makes the app folder the top-level folder used in trace info def self.backtrace_parser(backtrace) stack = [] backtrace.each do |c| if m=c.match(/(\/app\/(controllers|models|views)\/.+)/) stack << m[1] break if stack.size == BACKTRACE_LIMIT end end stack end def initialize(uri,metric_name,total_call_time,metrics) @uri = uri @metric_name = metric_name @total_call_time = total_call_time @metrics = metrics end end
Version data entries
8 entries across 8 versions & 1 rubygems