Sha256: 1e139fb093377e6091b935311008854179f86f85eb2ce23c2216abbb461a1f71

Contents?: true

Size: 911 Bytes

Versions: 5

Compression:

Stored size: 911 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
  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

5 entries across 5 versions & 1 rubygems

Version Path
scout_rails-1.0.9 lib/scout_rails/transaction_sample.rb
scout_rails-1.0.8 lib/scout_rails/transaction_sample.rb
scout_rails-1.0.8.pre.3 lib/scout_rails/transaction_sample.rb
scout_rails-1.0.7 lib/scout_rails/transaction_sample.rb
scout_rails-1.0.6 lib/scout_rails/transaction_sample.rb