scout_rails 1.1.5.pre3 → 1.1.5.pre4
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.
- data/lib/scout_rails/store.rb +13 -0
- data/lib/scout_rails/transaction_sample.rb +6 -0
- data/lib/scout_rails/version.rb +1 -1
- metadata +1 -1
data/lib/scout_rails/store.rb
CHANGED
@@ -4,6 +4,9 @@ class ScoutRails::Store
|
|
4
4
|
|
5
5
|
# Limits the size of the metric hash to prevent a metric explosion.
|
6
6
|
MAX_SIZE = 1000
|
7
|
+
|
8
|
+
# Limit the number of samples that we store metrics with to prevent writing too much data to the layaway file if there are are many processes and many slow samples.
|
9
|
+
MAX_SAMPLES_TO_STORE_METRICS = 10
|
7
10
|
|
8
11
|
attr_accessor :metric_hash
|
9
12
|
attr_accessor :transaction_hash
|
@@ -193,7 +196,17 @@ class ScoutRails::Store
|
|
193
196
|
metric_hash
|
194
197
|
end
|
195
198
|
|
199
|
+
# Merges samples together, removing transaction sample metrics from samples if the > MAX_SAMPLES_TO_STORE_METRICS
|
196
200
|
def merge_samples(old_samples)
|
201
|
+
# need transaction lock here?
|
197
202
|
self.samples += old_samples
|
203
|
+
if trim_samples = self.samples[MAX_SAMPLES_TO_STORE_METRICS..-1]
|
204
|
+
ScoutRails::Agent.instance.logger.debug "Trimming metrics from #{trim_samples.size} samples."
|
205
|
+
i = MAX_SAMPLES_TO_STORE_METRICS
|
206
|
+
trim_samples.each do |sample|
|
207
|
+
self.samples[i] = sample.clear_metrics!
|
208
|
+
end
|
209
|
+
end
|
210
|
+
self.samples
|
198
211
|
end
|
199
212
|
end # class Store
|
data/lib/scout_rails/version.rb
CHANGED