scout_rails 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,7 @@
1
+ # 1.0.6
2
+
3
+ * More filtering on transaction sample backtraces
4
+
1
5
  # 1.0.5
2
6
 
3
7
  * Removing duplicate Enviornment#unicorn? method
@@ -63,8 +63,8 @@ class ScoutRails::Store
63
63
  meta.scope = nil if stack_empty
64
64
 
65
65
  # add backtrace for slow calls ... how is exclusive time handled?
66
- if duration > 0.5 and !stack_empty
67
- meta.extra = {:backtrace => caller.find_all { |c| c =~ /\/app\//}}
66
+ if duration > ScoutRails::TransactionSample::BACKTRACE_THRESHOLD and !stack_empty
67
+ meta.extra = {:backtrace => ScoutRails::TransactionSample.backtrace_parser(caller)}
68
68
  end
69
69
  stat = transaction_hash[meta] || ScoutRails::MetricStats.new(!stack_empty)
70
70
 
@@ -1,6 +1,23 @@
1
1
  class ScoutRails::TransactionSample
2
+ BACKTRACE_THRESHOLD = 0.5 # the minimum threshold to record the backtrace for a metric.
3
+ BACKTRACE_LIMIT = 5 # Max length of callers to display
2
4
  attr_reader :metric_name, :total_call_time, :metrics, :meta, :uri
3
5
 
6
+ # Given a call stack, generates a filtered backtrace that:
7
+ # * Limits to the app/models, app/controllers, or app/views directories
8
+ # * Limits to 5 total callers
9
+ # * Makes the app folder the top-level folder used in trace info
10
+ def self.backtrace_parser(backtrace)
11
+ stack = []
12
+ backtrace.each do |c|
13
+ if m=c.match(/(\/app\/(controllers|models|views)\/.+)/)
14
+ stack << m[1]
15
+ break if stack.size == BACKTRACE_LIMIT
16
+ end
17
+ end
18
+ stack
19
+ end
20
+
4
21
  def initialize(uri,metric_name,total_call_time,metrics)
5
22
  @uri = uri
6
23
  @metric_name = metric_name
@@ -1,3 +1,3 @@
1
1
  module ScoutRails
2
- VERSION = "1.0.5"
2
+ VERSION = "1.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-10-25 00:00:00.000000000 Z
13
+ date: 2012-10-29 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Monitors a Ruby on Rails application and reports detailed metrics on
16
16
  performance to Scout, a hosted monitoring service.