Class: ScoutRails::TransactionSample
- Inherits:
-
Object
- Object
- ScoutRails::TransactionSample
- Defined in:
- lib/scout_rails/transaction_sample.rb
Constant Summary collapse
- BACKTRACE_THRESHOLD =
the minimum threshold to record the backtrace for a metric.
0.5
- BACKTRACE_LIMIT =
Max length of callers to display
5
- MAX_SIZE =
Limits the size of the metric hash to prevent a metric explosion.
100
Instance Attribute Summary collapse
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#metric_name ⇒ Object
readonly
Returns the value of attribute metric_name.
-
#metrics ⇒ Object
readonly
Returns the value of attribute metrics.
-
#total_call_time ⇒ Object
readonly
Returns the value of attribute total_call_time.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Class Method Summary collapse
-
.backtrace_parser(backtrace) ⇒ Object
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.
Instance Method Summary collapse
-
#initialize(uri, metric_name, total_call_time, metrics) ⇒ TransactionSample
constructor
A new instance of TransactionSample.
Constructor Details
#initialize(uri, metric_name, total_call_time, metrics) ⇒ TransactionSample
Returns a new instance of TransactionSample.
22 23 24 25 26 27 |
# File 'lib/scout_rails/transaction_sample.rb', line 22 def initialize(uri,metric_name,total_call_time,metrics) @uri = uri @metric_name = metric_name @total_call_time = total_call_time @metrics = metrics end |
Instance Attribute Details
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
5 6 7 |
# File 'lib/scout_rails/transaction_sample.rb', line 5 def @meta end |
#metric_name ⇒ Object (readonly)
Returns the value of attribute metric_name.
5 6 7 |
# File 'lib/scout_rails/transaction_sample.rb', line 5 def metric_name @metric_name end |
#metrics ⇒ Object (readonly)
Returns the value of attribute metrics.
5 6 7 |
# File 'lib/scout_rails/transaction_sample.rb', line 5 def metrics @metrics end |
#total_call_time ⇒ Object (readonly)
Returns the value of attribute total_call_time.
5 6 7 |
# File 'lib/scout_rails/transaction_sample.rb', line 5 def total_call_time @total_call_time end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
5 6 7 |
# File 'lib/scout_rails/transaction_sample.rb', line 5 def uri @uri end |
Class Method Details
.backtrace_parser(backtrace) ⇒ Object
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
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/scout_rails/transaction_sample.rb', line 11 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 |