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 +4 -0
- data/lib/scout_rails/store.rb +2 -2
- data/lib/scout_rails/transaction_sample.rb +17 -0
- data/lib/scout_rails/version.rb +1 -1
- metadata +2 -2
data/CHANGELOG.markdown
CHANGED
data/lib/scout_rails/store.rb
CHANGED
@@ -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 >
|
67
|
-
meta.extra = {:backtrace => caller
|
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
|
data/lib/scout_rails/version.rb
CHANGED
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.
|
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-
|
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.
|