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 metrics [#{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(',')}."
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" )
@@ -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
@@ -21,6 +21,7 @@ module ScoutRails::Tracer
21
21
  yield
22
22
  Thread::current[:scout_scope_name] = nil
23
23
  end
24
+ Thread::current[:scout_custom_attributes] = nil
24
25
  end
25
26
 
26
27
  # Options:
@@ -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.
@@ -1,3 +1,3 @@
1
1
  module ScoutRails
2
- VERSION = "1.1.5.pre5"
2
+ VERSION = "1.1.5.pre6"
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.1.5.pre5
4
+ version: 1.1.5.pre6
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors: