scout_rails 1.0.9 → 1.1.0
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 +9 -2
- data/lib/scout_rails/transaction_sample.rb +1 -0
- data/lib/scout_rails/version.rb +1 -1
- metadata +2 -2
data/CHANGELOG.markdown
CHANGED
data/lib/scout_rails/store.rb
CHANGED
@@ -71,9 +71,8 @@ class ScoutRails::Store
|
|
71
71
|
meta.extra = {:backtrace => ScoutRails::TransactionSample.backtrace_parser(caller)}
|
72
72
|
end
|
73
73
|
stat = transaction_hash[meta] || ScoutRails::MetricStats.new(!stack_empty)
|
74
|
-
|
75
74
|
stat.update!(duration,duration-item.children_time)
|
76
|
-
transaction_hash[meta] = stat
|
75
|
+
transaction_hash[meta] = stat if store_metric?(stack_empty)
|
77
76
|
|
78
77
|
# Uses controllers as the entry point for a transaction. Otherwise, stats are ignored.
|
79
78
|
if stack_empty and meta.metric_name.match(/\AController\//)
|
@@ -88,6 +87,14 @@ class ScoutRails::Store
|
|
88
87
|
end
|
89
88
|
end
|
90
89
|
|
90
|
+
# TODO - Move more logic to TransactionSample
|
91
|
+
#
|
92
|
+
# Limits the size of the transaction hash to prevent a large transactions. The final item on the stack
|
93
|
+
# is allowed to be stored regardless of hash size to wrapup the transaction sample w/the parent metric.
|
94
|
+
def store_metric?(stack_empty)
|
95
|
+
transaction_hash.size < ScoutRails::TransactionSample::MAX_SIZE or stack_empty
|
96
|
+
end
|
97
|
+
|
91
98
|
# Returns the top-level category names used in the +metrics+ hash.
|
92
99
|
def categories(metrics)
|
93
100
|
cats = Set.new
|
@@ -1,6 +1,7 @@
|
|
1
1
|
class ScoutRails::TransactionSample
|
2
2
|
BACKTRACE_THRESHOLD = 0.5 # the minimum threshold to record the backtrace for a metric.
|
3
3
|
BACKTRACE_LIMIT = 5 # Max length of callers to display
|
4
|
+
MAX_SIZE = 100 # Limits the size of the metric hash to prevent a metric explosion.
|
4
5
|
attr_reader :metric_name, :total_call_time, :metrics, :meta, :uri
|
5
6
|
|
6
7
|
# Given a call stack, generates a filtered backtrace that:
|
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.1.0
|
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-12-
|
13
|
+
date: 2012-12-14 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.
|