scout_rails 1.0.9 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,7 @@
1
+ # 1.1.0
2
+
3
+ * Limiting the size of the transaction hash to 100 metrics to prevent large transaction samples.
4
+
1
5
  # 1.0.9
2
6
 
3
7
  * Rainbows! app server support.
@@ -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:
@@ -1,3 +1,3 @@
1
1
  module ScoutRails
2
- VERSION = "1.0.9"
2
+ VERSION = "1.1.0"
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.9
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-11 00:00:00.000000000 Z
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.