Sha256: 30f23d69cfd21808b123a793fc1fe7128a42961721df02b04a3ba3fc6b9970c0
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
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 # Used to remove metrics when the payload will be too large. def clear_metrics! @metrics = nil self end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
scout_rails-1.1.5.pre5 | lib/scout_rails/transaction_sample.rb |
scout_rails-1.1.5.pre4 | lib/scout_rails/transaction_sample.rb |