scout_rails 1.1.5.pre5 → 1.1.5.pre6
Sign up to get free protection for your applications and to get access to all the features.
@@ -26,7 +26,7 @@ module ScoutRails
|
|
26
26
|
STATSD_SCOUT_RAILS.timing('scout_rails.samples',samples.size)
|
27
27
|
samples_kb = Marshal.dump(samples).size/1024 # just for performance debugging
|
28
28
|
STATSD_SCOUT_RAILS.timing('scout_rails.samples_kb',samples_kb)
|
29
|
-
logger.debug "#{config.settings['name']} Delivering
|
29
|
+
logger.debug "#{config.settings['name']} Delivering total payload [#{payload.size/1024} KB] for #{controller_count} requests and slow transaction samples [#{samples_kb} KB] for #{samples.size} samples of durations: #{samples.map(&:total_call_time).join(',')}."
|
30
30
|
response = post( checkin_uri,
|
31
31
|
payload,
|
32
32
|
"Content-Type" => "application/json" )
|
data/lib/scout_rails/store.rb
CHANGED
@@ -135,12 +135,12 @@ class ScoutRails::Store
|
|
135
135
|
def store_sample(uri,transaction_hash,parent_meta,parent_stat,options = {})
|
136
136
|
@transaction_sample_lock.synchronize do
|
137
137
|
if parent_stat.total_call_time >= 2 and (@sample.nil? or (@sample and parent_stat.total_call_time > @sample.total_call_time))
|
138
|
-
@sample = ScoutRails::TransactionSample.new(uri,parent_meta.metric_name,parent_stat.total_call_time,transaction_hash.dup)
|
138
|
+
@sample = ScoutRails::TransactionSample.new(uri,parent_meta.metric_name,parent_stat.total_call_time,transaction_hash.dup,Thread::current[:scout_custom_attributes])
|
139
139
|
end
|
140
140
|
# tree map of all slow transactions
|
141
141
|
if parent_stat.total_call_time >= 2
|
142
|
-
@samples.push(ScoutRails::TransactionSample.new(uri,parent_meta.metric_name,parent_stat.total_call_time,transaction_hash.dup))
|
143
|
-
ScoutRails::Agent.instance.logger.debug "Slow transaction sample added. Array Size: #{@samples.size}"
|
142
|
+
@samples.push(ScoutRails::TransactionSample.new(uri,parent_meta.metric_name,parent_stat.total_call_time,transaction_hash.dup,Thread::current[:scout_custom_attributes]))
|
143
|
+
ScoutRails::Agent.instance.logger.debug "Slow transaction sample added. [URI: #{uri}] [Attrs: #{Thread::current[:scout_custom_attributes].inspect}] Array Size: #{@samples.size}"
|
144
144
|
end
|
145
145
|
end
|
146
146
|
end
|
data/lib/scout_rails/tracer.rb
CHANGED
@@ -2,7 +2,7 @@ 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
4
|
MAX_SIZE = 100 # Limits the size of the metric hash to prevent a metric explosion.
|
5
|
-
attr_reader :metric_name, :total_call_time, :metrics, :meta, :uri
|
5
|
+
attr_reader :metric_name, :total_call_time, :metrics, :meta, :uri, :custom_attributes
|
6
6
|
|
7
7
|
# Given a call stack, generates a filtered backtrace that:
|
8
8
|
# * Limits to the app/models, app/controllers, or app/views directories
|
@@ -19,11 +19,14 @@ class ScoutRails::TransactionSample
|
|
19
19
|
stack
|
20
20
|
end
|
21
21
|
|
22
|
-
def initialize(uri,metric_name,total_call_time,metrics)
|
22
|
+
def initialize(uri,metric_name,total_call_time,metrics,custom_attributes)
|
23
23
|
@uri = uri
|
24
24
|
@metric_name = metric_name
|
25
25
|
@total_call_time = total_call_time
|
26
26
|
@metrics = metrics
|
27
|
+
if custom_attributes.is_a?(Hash) and custom_attributes.any?
|
28
|
+
@custom_attributes = custom_attributes
|
29
|
+
end
|
27
30
|
end
|
28
31
|
|
29
32
|
# Used to remove metrics when the payload will be too large.
|
data/lib/scout_rails/version.rb
CHANGED