traceview 3.8.0 → 3.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/README.md +3 -3
  4. data/lib/joboe_metal.rb +4 -4
  5. data/lib/oboe_metal.rb +3 -3
  6. data/lib/traceview/api/layerinit.rb +2 -2
  7. data/lib/traceview/api/logging.rb +12 -12
  8. data/lib/traceview/api/profiling.rb +6 -6
  9. data/lib/traceview/api/tracing.rb +1 -1
  10. data/lib/traceview/api/util.rb +1 -1
  11. data/lib/traceview/base.rb +14 -7
  12. data/lib/traceview/config.rb +8 -5
  13. data/lib/traceview/frameworks/padrino/templates.rb +4 -4
  14. data/lib/traceview/frameworks/rails.rb +2 -2
  15. data/lib/traceview/frameworks/rails/inst/action_controller.rb +6 -2
  16. data/lib/traceview/frameworks/rails/inst/action_controller2.rb +4 -2
  17. data/lib/traceview/frameworks/rails/inst/action_controller3.rb +5 -4
  18. data/lib/traceview/frameworks/rails/inst/action_controller4.rb +4 -2
  19. data/lib/traceview/frameworks/rails/inst/action_controller5.rb +22 -11
  20. data/lib/traceview/frameworks/rails/inst/action_controller5_api.rb +23 -12
  21. data/lib/traceview/frameworks/sinatra/templates.rb +4 -4
  22. data/lib/traceview/inst/bunny-client.rb +8 -8
  23. data/lib/traceview/inst/bunny-consumer.rb +1 -1
  24. data/lib/traceview/inst/curb.rb +19 -19
  25. data/lib/traceview/inst/dalli.rb +4 -4
  26. data/lib/traceview/inst/delayed_job.rb +4 -4
  27. data/lib/traceview/inst/em-http-request.rb +6 -6
  28. data/lib/traceview/inst/excon.rb +18 -18
  29. data/lib/traceview/inst/faraday.rb +13 -13
  30. data/lib/traceview/inst/http.rb +12 -12
  31. data/lib/traceview/inst/httpclient.rb +19 -19
  32. data/lib/traceview/inst/memcache.rb +5 -5
  33. data/lib/traceview/inst/memcached.rb +4 -4
  34. data/lib/traceview/inst/mongo.rb +6 -6
  35. data/lib/traceview/inst/moped.rb +28 -28
  36. data/lib/traceview/inst/rack.rb +24 -24
  37. data/lib/traceview/inst/redis.rb +6 -6
  38. data/lib/traceview/inst/resque.rb +6 -6
  39. data/lib/traceview/inst/rest-client.rb +4 -4
  40. data/lib/traceview/inst/sequel.rb +12 -12
  41. data/lib/traceview/inst/sidekiq-client.rb +3 -3
  42. data/lib/traceview/inst/sidekiq-worker.rb +3 -3
  43. data/lib/traceview/inst/twitter-cassandra.rb +17 -17
  44. data/lib/traceview/inst/typhoeus.rb +13 -13
  45. data/lib/traceview/method_profiling.rb +2 -2
  46. data/lib/traceview/ruby.rb +1 -1
  47. data/lib/traceview/util.rb +4 -4
  48. data/lib/traceview/version.rb +1 -1
  49. data/test/frameworks/rails3x_test.rb +105 -0
  50. data/test/frameworks/rails4x_test.rb +97 -0
  51. data/test/frameworks/rails5x_api_test.rb +98 -1
  52. data/test/frameworks/rails5x_test.rb +99 -2
  53. data/test/profiling/legacy_method_profiling_test.rb +1 -1
  54. data/test/support/backcompat_test.rb +2 -2
  55. data/test/support/config_test.rb +1 -1
  56. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1290a31bde98b6d4248897cf8e17f5e515818c16
4
- data.tar.gz: 26e335a7365cfdc38c667520fa5f37f97517cc1c
3
+ metadata.gz: a0891c16459fdf94a5c62c35540312c60a5e42c3
4
+ data.tar.gz: 9e32e05df0fc3b27efb43de2f812666c7b9113c3
5
5
  SHA512:
6
- metadata.gz: fb16839d64fe8562ef5e0e8afe8ff6448d773b38889d5b146b309addda5156503d0d34c03a76a940e226eb7e3ed1d6e01cb8e487d0d7ab6132dcb80369238c65
7
- data.tar.gz: 7be6d76914a3be0e20513956794d9790d185de3eb5c22c21cc2bbcdadcdd6ee531f1ff956e45c7dd18bd78a2ae0a92c400d44b8283f9d34ea7058afc67f1025d
6
+ metadata.gz: 456635e75d7ebb9dbcce019d5f1c2b3c1649adc16e852fef35b78a8e2fb80cb9b4e4324b81ad771df5fbc4af6f600f4d13d9e28d767353ca96901e939c15c717
7
+ data.tar.gz: 707e48cd731becdab72dc1dabfbf54de8b65bab4ea79b0b0f9d569ca5928a061cba8e26ac64b505823f73c24f9776d25d3ba46c0190cefc6243450b28a9e0d4b
data/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@ https://github.com/appneta/oboe-ruby/releases
4
4
 
5
5
  Dates in this file are in the format MM/DD/YYYY.
6
6
 
7
+ # traceview 3.8.1
8
+
9
+ This patch release includes the following fixes:
10
+
11
+ * Use less string literals and more symbols: #168
12
+ * Fix `alias_method_chain` deprecation under Rails 5: #169
13
+
14
+ Pushed to Rubygems:
15
+
16
+ https://rubygems.org/gems/traceview/versions/3.8.1
17
+ https://rubygems.org/gems/traceview/versions/3.8.1-java
18
+
7
19
  # traceview 3.8.0
8
20
 
9
21
  This minor release includes the following new feature:
data/README.md CHANGED
@@ -332,9 +332,9 @@ rake recompile # Rebuild the gem's c extension
332
332
  Note: Make sure you have the development package `liboboe0-dev` installed before attempting to compile the C extension.
333
333
 
334
334
  ```bash
335
- >$ dpkg -l | grep liboboe
336
- ii liboboe-dev 1.1.1-precise1 Tracelytics common library -- development files
337
- ii liboboe0 1.1.1-precise1 Tracelytics common library
335
+ >>$ dpkg -l | grep liboboe
336
+ ii liboboe-dev 1.2.1-trusty1 AppNeta TraceView common library -- development files
337
+ ii liboboe0 1.2.1-trusty1 AppNeta Traceview common library
338
338
  ```
339
339
 
340
340
  See [Installing Base Packages on Debian and Ubuntu](https://docs.appneta.com/installation-overview) in the Knowledge Base for details. Our hacker extraordinaire [Rob Salmond](https://github.com/rsalmond) from the support team has even gotten these packages to [run on Gentoo](http://www.appneta.com/blog/unsupported-doesnt-work/)!
data/lib/joboe_metal.rb CHANGED
@@ -66,11 +66,11 @@ module Oboe_metal
66
66
  cfg = LayerUtil.getLocalSampleRate(nil, nil)
67
67
 
68
68
  if cfg.hasSampleStartFlag
69
- TraceView::Config.tracing_mode = 'always'
69
+ TraceView::Config.tracing_mode = :always
70
70
  elsif cfg.hasSampleThroughFlag
71
- TraceView::Config.tracing_mode = 'through'
71
+ TraceView::Config.tracing_mode = :through
72
72
  else
73
- TraceView::Config.tracing_mode = 'never'
73
+ TraceView::Config.tracing_mode = :never
74
74
  end
75
75
 
76
76
  TraceView.sample_rate = cfg.getSampleRate
@@ -205,7 +205,7 @@ case Java::ComTracelyticsAgent::Agent.getStatus
205
205
  $stderr.puts '=============================================================='
206
206
  $stderr.puts 'TraceView Java Agent not initialized properly.'
207
207
  $stderr.puts 'Possibly misconfigured? Going into no-op mode.'
208
- $stderr.puts 'See: http://bit.ly/1zwS5xj'
208
+ $stderr.puts 'https://docs.appneta.com/installing-jruby-instrumentation'
209
209
  $stderr.puts '=============================================================='
210
210
 
211
211
  when Java::ComTracelyticsAgent::Agent::AgentStatus::UNINITIALIZED
data/lib/oboe_metal.rb CHANGED
@@ -118,9 +118,9 @@ module TraceView
118
118
  return false if TraceView.never? || (TraceView.through? && !opts.key?('X-TV-Meta'))
119
119
 
120
120
  # Assure defaults since SWIG enforces Strings
121
- layer = opts[:layer] ? opts[:layer].to_s.strip : ''
122
- xtrace = opts[:xtrace] ? opts[:xtrace].to_s.strip : ''
123
- tv_meta = opts['X-TV-Meta'] ? opts['X-TV-Meta'].to_s.strip : ''
121
+ layer = opts[:layer] ? opts[:layer].to_s.strip.freeze : TV_STR_BLANK
122
+ xtrace = opts[:xtrace] ? opts[:xtrace].to_s.strip : TV_STR_BLANK
123
+ tv_meta = opts['X-TV-Meta'] ? opts['X-TV-Meta'].to_s.strip : TV_STR_BLANK
124
124
 
125
125
  rv = TraceView::Context.sampleRequest(layer, xtrace, tv_meta)
126
126
 
@@ -10,7 +10,7 @@ module TraceView
10
10
  # installed, as well as the version of instrumentation and version of
11
11
  # layer.
12
12
  #
13
- def report_init(layer = 'rack')
13
+ def report_init(layer = :rack)
14
14
  # Don't send __Init in development, test or if the gem
15
15
  # isn't fully loaded (e.g. missing c-extension)
16
16
  return if %w(development test).include?(ENV['RACK_ENV']) ||
@@ -41,7 +41,7 @@ module TraceView
41
41
  'removed in a subsequent version.'
42
42
 
43
43
  saved_mode = TraceView::Config[:tracing_mode]
44
- TraceView::Config[:tracing_mode] = 'always'
44
+ TraceView::Config[:tracing_mode] = :always
45
45
  yield
46
46
  ensure
47
47
  TraceView::Config[:tracing_mode] = saved_mode
@@ -68,7 +68,7 @@ module TraceView
68
68
  :Backtrace => exn.backtrace.join("\r\n"))
69
69
 
70
70
  exn.instance_variable_set(:@oboe_logged, true)
71
- log(layer, 'error', kvs)
71
+ log(layer, :error, kvs)
72
72
  end
73
73
 
74
74
  ##
@@ -118,7 +118,7 @@ module TraceView
118
118
  elsif opts.key?('Force')
119
119
  # Forced tracing: used by __Init reporting
120
120
  opts[:TraceOrigin] = :forced
121
- log_event(layer, 'entry', TraceView::Context.startTrace, opts)
121
+ log_event(layer, :entry, TraceView::Context.startTrace, opts)
122
122
 
123
123
  elsif TraceView.sample?(opts.merge(:layer => layer, :xtrace => xtrace))
124
124
  # Probablistic tracing of a subset of requests based off of
@@ -132,7 +132,7 @@ module TraceView
132
132
  opts[:TraceOrigin] = :always_sampled
133
133
  end
134
134
 
135
- log_event(layer, 'entry', TraceView::Context.startTrace, opts)
135
+ log_event(layer, :entry, TraceView::Context.startTrace, opts)
136
136
  end
137
137
  end
138
138
 
@@ -152,7 +152,7 @@ module TraceView
152
152
  def log_end(layer, opts = {})
153
153
  return unless TraceView.loaded
154
154
 
155
- log_event(layer, 'exit', TraceView::Context.createEvent, opts)
155
+ log_event(layer, :exit, TraceView::Context.createEvent, opts)
156
156
  xtrace = TraceView::Context.toString
157
157
  TraceView::Context.clear unless TraceView.has_incoming_context?
158
158
  xtrace
@@ -177,8 +177,8 @@ module TraceView
177
177
  def log_entry(layer, kvs = {}, op = nil)
178
178
  return unless TraceView.loaded
179
179
 
180
- TraceView.layer_op = op if op
181
- log_event(layer, 'entry', TraceView::Context.createEvent, kvs)
180
+ TraceView.layer_op = op.to_sym if op
181
+ log_event(layer, :entry, TraceView::Context.createEvent, kvs)
182
182
  end
183
183
 
184
184
  ##
@@ -199,7 +199,7 @@ module TraceView
199
199
  def log_info(layer, kvs = {})
200
200
  return unless TraceView.loaded
201
201
 
202
- log_event(layer, 'info', TraceView::Context.createEvent, kvs)
202
+ log_event(layer, :info, TraceView::Context.createEvent, kvs)
203
203
  end
204
204
 
205
205
  ##
@@ -222,7 +222,7 @@ module TraceView
222
222
  return unless TraceView.loaded
223
223
 
224
224
  TraceView.layer_op = nil if op
225
- log_event(layer, 'exit', TraceView::Context.createEvent, kvs)
225
+ log_event(layer, :exit, TraceView::Context.createEvent, kvs)
226
226
  end
227
227
 
228
228
  ##
@@ -247,11 +247,11 @@ module TraceView
247
247
  def log_event(layer, label, event, opts = {})
248
248
  return unless TraceView.loaded
249
249
 
250
- event.addInfo('Layer', layer.to_s) if layer
251
- event.addInfo('Label', label.to_s)
250
+ event.addInfo(TV_STR_LAYER, layer.to_s.freeze) if layer
251
+ event.addInfo(TV_STR_LABEL, label.to_s.freeze)
252
252
 
253
- TraceView.layer = layer if label == 'entry'
254
- TraceView.layer = nil if label == 'exit'
253
+ TraceView.layer = layer.to_sym if label == :entry
254
+ TraceView.layer = nil if label == :exit
255
255
 
256
256
  opts.each do |k, v|
257
257
  value = nil
@@ -30,7 +30,7 @@ module TraceView
30
30
  report_kvs[:ProfileName] ||= profile_name
31
31
  report_kvs[:Backtrace] = TraceView::API.backtrace if with_backtrace
32
32
 
33
- TraceView::API.log(nil, 'profile_entry', report_kvs)
33
+ TraceView::API.log(nil, :profile_entry, report_kvs)
34
34
 
35
35
  begin
36
36
  yield
@@ -42,7 +42,7 @@ module TraceView
42
42
  exit_kvs[:Language] = :ruby
43
43
  exit_kvs[:ProfileName] = report_kvs[:ProfileName]
44
44
 
45
- TraceView::API.log(nil, 'profile_exit', exit_kvs)
45
+ TraceView::API.log(nil, :profile_exit, exit_kvs)
46
46
  end
47
47
  end
48
48
 
@@ -133,8 +133,8 @@ module TraceView
133
133
  profile_wrapper(without_traceview, report_kvs, opts, *args, &block)
134
134
  end
135
135
 
136
- alias_method without_traceview, "#{method}"
137
- alias_method "#{method}", with_traceview
136
+ alias_method without_traceview, method.to_s
137
+ alias_method method.to_s, with_traceview
138
138
  end
139
139
  elsif class_method
140
140
  klass.define_singleton_method(with_traceview) do |*args, &block|
@@ -142,8 +142,8 @@ module TraceView
142
142
  end
143
143
 
144
144
  klass.singleton_class.class_eval do
145
- alias_method without_traceview, "#{method}"
146
- alias_method "#{method}", with_traceview
145
+ alias_method without_traceview, method.to_s
146
+ alias_method method.to_s, with_traceview
147
147
  end
148
148
  end
149
149
  true
@@ -126,7 +126,7 @@ module TraceView
126
126
  raise
127
127
  ensure
128
128
  exit_evt.addEdge(TraceView::Context.get)
129
- log_event(layer, 'exit', exit_evt)
129
+ log_event(layer, :exit, exit_evt)
130
130
  TraceView::Context.clear
131
131
  end
132
132
  end
@@ -17,7 +17,7 @@ module TraceView
17
17
  #
18
18
  # Return a boolean indicating whether or not key is reserved.
19
19
  def valid_key?(key)
20
- !%w(Label Layer Edge Timestamp Timestamp_u).include? key.to_s
20
+ ![:Label, :Layer, :Edge, :Timestamp, :Timestamp_u].include?(key.to_sym)
21
21
  end
22
22
 
23
23
  # Internal: Get the current backtrace.
@@ -22,6 +22,10 @@ SAMPLE_SOURCE_MASK = 0b1111000000000000000000000000
22
22
  ZERO_SAMPLE_RATE_MASK = 0b1111000000000000000000000000
23
23
  ZERO_SAMPLE_SOURCE_MASK = 0b0000111111111111111111111111
24
24
 
25
+ TV_STR_BLANK = ''.freeze
26
+ TV_STR_LAYER = 'Layer'.freeze
27
+ TV_STR_LABEL = 'Label'.freeze
28
+
25
29
  ##
26
30
  # This module is the base module for the various implementations of TraceView reporting.
27
31
  # Current variations as of 2014-09-10 are a c-extension, JRuby (using TraceView Java
@@ -111,7 +115,7 @@ module TraceViewBase
111
115
  # operation tracing or one instrumented operation calling another.
112
116
  #
113
117
  def tracing_layer?(layer)
114
- TraceView.layer == layer
118
+ TraceView.layer == layer.to_sym
115
119
  end
116
120
 
117
121
  ##
@@ -121,13 +125,16 @@ module TraceViewBase
121
125
  # operation being traced. This is used in cases of recursive
122
126
  # operation tracing or one instrumented operation calling another.
123
127
  #
128
+ # <operation> can be a single symbol or an array of symbols that
129
+ # will be checked against.
130
+ #
124
131
  # In such cases, we only want to trace the outermost operation.
125
132
  #
126
133
  def tracing_layer_op?(operation)
127
134
  if operation.is_a?(Array)
128
135
  return operation.include?(TraceView.layer_op)
129
136
  else
130
- return TraceView.layer_op == operation
137
+ return TraceView.layer_op == operation.to_sym
131
138
  end
132
139
  end
133
140
 
@@ -150,7 +157,7 @@ module TraceViewBase
150
157
  # False otherwise
151
158
  #
152
159
  def always?
153
- TraceView::Config[:tracing_mode].to_s == 'always'
160
+ TraceView::Config[:tracing_mode].to_sym == :always
154
161
  end
155
162
 
156
163
  ##
@@ -158,7 +165,7 @@ module TraceViewBase
158
165
  # False otherwise
159
166
  #
160
167
  def never?
161
- TraceView::Config[:tracing_mode].to_s == 'never'
168
+ TraceView::Config[:tracing_mode].to_sym == :never
162
169
  end
163
170
 
164
171
  ##
@@ -166,7 +173,7 @@ module TraceViewBase
166
173
  # False otherwise
167
174
  #
168
175
  def passthrough?
169
- %w(always through).include?(TraceView::Config[:tracing_mode])
176
+ [:always, :through].include?(TraceView::Config[:tracing_mode])
170
177
  end
171
178
 
172
179
  ##
@@ -174,7 +181,7 @@ module TraceViewBase
174
181
  # False otherwise
175
182
  #
176
183
  def through?
177
- TraceView::Config[:tracing_mode].to_s == 'through'
184
+ TraceView::Config[:tracing_mode].to_sym == :through
178
185
  end
179
186
 
180
187
  ##
@@ -240,7 +247,7 @@ module TraceViewBase
240
247
  # or not
241
248
  #
242
249
  def framework?
243
- defined?(::Rails) && defined?(::Sinatra) && defined?(::Padrino) && defined?(::Grape)
250
+ defined?(::Rails) || defined?(::Sinatra) || defined?(::Padrino) || defined?(::Grape)
244
251
  end
245
252
 
246
253
  ##
@@ -43,8 +43,8 @@ module TraceView
43
43
  TraceView::Config[:em_http_request][:enabled] = false
44
44
 
45
45
  # Set collect_backtraces defaults
46
- TraceView::Config[:action_controller][:collect_backtraces] = true
47
- TraceView::Config[:action_controller_api][:collect_backtraces] = true
46
+ TraceView::Config[:action_controller][:collect_backtraces] = false
47
+ TraceView::Config[:action_controller_api][:collect_backtraces] = false
48
48
  TraceView::Config[:active_record][:collect_backtraces] = true
49
49
  TraceView::Config[:bunnyclient][:collect_backtraces] = false
50
50
  TraceView::Config[:bunnyconsumer][:collect_backtraces] = false
@@ -190,12 +190,12 @@ module TraceView
190
190
  # Environment support for OpenShift.
191
191
  if ENV.key?('OPENSHIFT_TRACEVIEW_TLYZER_IP')
192
192
  # We're running on OpenShift
193
- @@config[:tracing_mode] = 'always'
193
+ @@config[:tracing_mode] = :always
194
194
  @@config[:reporter_host] = ENV['OPENSHIFT_TRACEVIEW_TLYZER_IP']
195
195
  @@config[:reporter_port] = ENV['OPENSHIFT_TRACEVIEW_TLYZER_PORT']
196
196
  else
197
197
  # The default configuration
198
- @@config[:tracing_mode] = 'through'
198
+ @@config[:tracing_mode] = :through
199
199
  @@config[:reporter_host] = '127.0.0.1'
200
200
  @@config[:reporter_port] = '7831'
201
201
  end
@@ -265,7 +265,10 @@ module TraceView
265
265
 
266
266
  # Update liboboe if updating :tracing_mode
267
267
  if key == :tracing_mode
268
- TraceView.set_tracing_mode(value) if TraceView.loaded
268
+ TraceView.set_tracing_mode(value.to_sym) if TraceView.loaded
269
+
270
+ # Make sure that the mode is stored as a symbol
271
+ @@config[key.to_sym] = value.to_sym
269
272
  end
270
273
  end
271
274
 
@@ -19,13 +19,13 @@ module TraceView
19
19
  report_kvs[:template] = engine
20
20
  end
21
21
 
22
- if TraceView.tracing_layer_op?('render')
22
+ if TraceView.tracing_layer_op?(:render)
23
23
  # For recursive calls to :render (for sub-partials and layouts),
24
24
  # use method profiling.
25
25
  begin
26
26
  report_kvs[:FunctionName] = :render
27
27
  report_kvs[:Class] = :Rendering
28
- report_kvs[:Module] = 'Padrino'
28
+ report_kvs[:Module] = :Padrino
29
29
  report_kvs[:File] = __FILE__
30
30
  report_kvs[:LineNumber] = __LINE__
31
31
  rescue StandardError => e
@@ -41,12 +41,12 @@ module TraceView
41
41
  # back on exit (a limitation of the TraceView::API.trace
42
42
  # block method) This removes the need for an info
43
43
  # event to send additonal KVs
44
- ::TraceView::API.log_entry('render', {}, 'render')
44
+ ::TraceView::API.log_entry(:render, {}, :render)
45
45
 
46
46
  begin
47
47
  render_without_traceview(engine, data, options, locals, &block)
48
48
  ensure
49
- ::TraceView::API.log_exit('render', report_kvs)
49
+ ::TraceView::API.log_exit(:render, report_kvs)
50
50
  end
51
51
  end
52
52
  else
@@ -43,9 +43,9 @@ module TraceView
43
43
  # Force load the TraceView Rails initializer if there is one
44
44
  # Prefer traceview.rb but give priority to the legacy tracelytics.rb if it exists
45
45
  if ::Rails::VERSION::MAJOR > 2
46
- rails_root = "#{::Rails.root}"
46
+ rails_root = ::Rails.root.to_s
47
47
  else
48
- rails_root = "#{RAILS_ROOT}"
48
+ rails_root = RAILS_ROOT.to_s
49
49
  end
50
50
 
51
51
  #
@@ -76,14 +76,18 @@ end
76
76
  if defined?(ActionController::Base) && TraceView::Config[:action_controller][:enabled]
77
77
  TraceView.logger.info '[traceview/loading] Instrumenting actioncontroller' if TraceView::Config[:verbose]
78
78
  require "traceview/frameworks/rails/inst/action_controller#{Rails::VERSION::MAJOR}"
79
- ::TraceView::Util.send_include(::ActionController::Base, TraceView::Inst::ActionController)
79
+ if Rails::VERSION::MAJOR >= 5
80
+ ::ActionController::Base.send(:prepend, ::TraceView::Inst::ActionController)
81
+ else
82
+ ::TraceView::Util.send_include(::ActionController::Base, TraceView::Inst::ActionController)
83
+ end
80
84
  end
81
85
 
82
86
  # ActionController::API (Rails 5+)
83
87
  if defined?(ActionController::API) && TraceView::Config[:action_controller_api][:enabled]
84
88
  TraceView.logger.info '[traceview/loading] Instrumenting actioncontroller api' if TraceView::Config[:verbose]
85
89
  require "traceview/frameworks/rails/inst/action_controller#{Rails::VERSION::MAJOR}_api"
86
- ::TraceView::Util.send_include(::ActionController::API, TraceView::Inst::ActionControllerAPI)
90
+ ::ActionController::API.send(:prepend, ::TraceView::Inst::ActionControllerAPI)
87
91
  end
88
92
 
89
93
  # vim:set expandtab:tabstop=2
@@ -31,11 +31,13 @@ module TraceView
31
31
  end
32
32
 
33
33
  def perform_action_with_traceview(*arguments)
34
- report_kvs = {
34
+ kvs = {
35
35
  :Controller => @_request.path_parameters['controller'],
36
36
  :Action => @_request.path_parameters['action']
37
37
  }
38
- TraceView::API.log(nil, 'info', report_kvs)
38
+ kvs[:Backtrace] = TraceView::API.backtrace if TraceView::Config[:action_controller][:collect_backtraces]
39
+
40
+ TraceView::API.log(nil, 'info', kvs)
39
41
  perform_action_without_traceview(*arguments)
40
42
  end
41
43
 
@@ -32,16 +32,17 @@ module TraceView
32
32
  end
33
33
 
34
34
  def process_action_with_traceview(*args)
35
- report_kvs = {
35
+ kvs = {
36
36
  :Controller => self.class.name,
37
37
  :Action => action_name,
38
38
  }
39
- TraceView::API.log(nil, 'info', report_kvs)
39
+ kvs[:Backtrace] = TraceView::API.backtrace if TraceView::Config[:action_controller][:collect_backtraces]
40
+ TraceView::API.log(nil, 'info', kvs)
40
41
 
41
42
  process_action_without_traceview(*args)
42
43
  rescue Exception
43
- report_kvs[:Status] = 500
44
- TraceView::API.log(nil, 'info', report_kvs)
44
+ kvs[:Status] = 500
45
+ TraceView::API.log(nil, 'info', kvs)
45
46
  raise
46
47
  end
47
48
  end