newrelic_rpm 8.1.0 → 8.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8fab89acaea13ee0c348b26ff7d94118b358e9ac3ea6a48c4c231a1e0821d534
4
- data.tar.gz: b434c14af26d097547b16601384c045a9b7b119261b17c58b2727b36ff05cf52
3
+ metadata.gz: dee9561e93a6cd3e2ae811234dae75cd65310c394031fcf3ad3091b46185cb6a
4
+ data.tar.gz: 7c017fcfeefe7fcce7ce662bed42cc3258028fb42a36e849cbc0d84231e8c4be
5
5
  SHA512:
6
- metadata.gz: 9c568e526ec679b12cc06e3a9ed40b592665774775baf016b9be0374bea32518529c82eef199bc6369ff394c84732b0b6d7e8919f63097eb39343cde30cbca26
7
- data.tar.gz: dde7b7c0d46c2b918d5b97f9e08eadbb1a0f1bccfcd52454600fb7fa17ea4de450c856f99ab87f2d030694ede1779b8224f8ff4c757f4755b9bd3213c181ee97
6
+ metadata.gz: 7b51ea238bcbaadfc37ed5364556dbb994788a0214dcd4c890ecbf4bb20aac744db0c733e32955da60c60f1e28220f44b8529bdab74d3af613985a5ac6076ab2
7
+ data.tar.gz: d3400acd658bffec6058a3a7f7ac7e2df0a36ee95777bfc44768f839ec7b6c29184c8172b43d3f9f43a211add2c108aa68a3358f7b93d1e9581b19eeb8f37bd3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # New Relic Ruby Agent Release Notes #
2
2
 
3
+ ## v8.2.0
4
+
5
+ * **New Instrumentation for Tilt gem**
6
+
7
+ Template rendering using [Tilt](https://github.com/rtomayko/tilt) is now instrumented. See [PR #847](https://github.com/newrelic/newrelic-ruby-agent/pull/847) for details.
8
+
9
+ * **Configuration `error_collector.ignore_errors` is marked as deprecated**
10
+
11
+ This setting has been marked as deprecated in the documentation since version 7.2.0 and is now flagged as deprecated within the code.
12
+
13
+ * **Remove Rails 2 instrumentation**
14
+
15
+ Though any version of Rails 2 has not been supported by the Ruby Agent since v3.18.1.330, instrumentation for ActionController and ActionWebService specific to that version were still part of the agent. This instrumentation has been removed.
16
+
17
+ * **Remove duplicated settings from newrelic.yml**
18
+
19
+ Thank you @jakeonfire for bringing this to our attention and @kuroponzu for making the changes!
20
+
21
+ * **Bugfix: Span Events recorded when using newrelic_ignore**
22
+
23
+ Previously, the agent was incorrectly recording span events only on transactions that should be ignored. This fix will prevent any span events from being created for transactions using newrelic_ignore, or ignored through the `rules.ignore_url_regexes` configuration option.
24
+
25
+ * **Bugfix: Print deprecation warning for Cross-Application Tracing if enabled**
26
+
27
+ Prior to this change, the deprecation warning would log whenever the agent started up, regardless of configuration. Thank you @alpha-san for bringing this to our attention!
28
+
29
+ * **Bugfix: Scrub non-unicode characters from DecoratingLogger**
30
+
31
+ To prevent `JSON::GeneratorErrors`, the DecoratingLogger replaces non-unicode characters with the replacement character: �. Thank you @jdelStrother for bringing this to our attention!
32
+
33
+ * **Bugfix: Distributed tracing headers emitted errors when agent was not connected**
34
+
35
+ Previously, when the agent had not yet connected it would fail to create a trace context payload and emit an error, "TypeError: no implicit conversion of nil into String," to the agent logs. The correct behavior in this situation is to not create these headers due to the lack of required information. Now, the agent will not attempt to create trace context payloads until it has connected. Thank you @Izzette for bringing this to our attention!
36
+
37
+
3
38
  ## v8.1.0
4
39
 
5
40
  * **Instrumentation for Ruby standard library Logger**
@@ -22,6 +57,10 @@
22
57
 
23
58
  Integers not wrapped in quotation marks can be passed to `error_collector.ignore_status_codes` in the `newrelic.yml` file. Our thanks goes to @elaguerta and @brammerl for resolving this issue!
24
59
 
60
+ * **Bugfix: Allow add_method_tracer to be used on BasicObjects**
61
+
62
+ Previously, our `add_method_tracer` changes referenced `self.class` which is not available on `BasicObjects`. This has been fixed. Thanks to @toncid for bringing this issue to our attention.
63
+
25
64
 
26
65
  ## v8.0.0
27
66
 
@@ -1007,6 +1007,14 @@ module NewRelic
1007
1007
  :allowed_from_server => false,
1008
1008
  :description => 'Controls auto-instrumentation of Ruby standard library Logger at start up. May be one of [auto|prepend|chain|disabled].'
1009
1009
  },
1010
+ :'instrumentation.tilt' => {
1011
+ :default => "auto",
1012
+ :public => true,
1013
+ :type => String,
1014
+ :dynamic_name => true,
1015
+ :allowed_from_server => false,
1016
+ :description => 'Controls auto-instrumentation of Tilt at start up. May be one of [auto|prepend|chain|disabled].'
1017
+ },
1010
1018
  :disable_data_mapper => {
1011
1019
  :default => false,
1012
1020
  :public => true,
@@ -1305,6 +1313,7 @@ module NewRelic
1305
1313
  :default => 'ActionController::RoutingError,Sinatra::NotFound',
1306
1314
  :public => true,
1307
1315
  :type => String,
1316
+ :deprecated => true,
1308
1317
  :allowed_from_server => true,
1309
1318
  :dynamic_name => true,
1310
1319
  :description => 'Use `error_collector.ignore_classes` instead. Specify a comma-delimited list of error classes that the agent should ignore.'
@@ -1805,10 +1814,7 @@ module NewRelic
1805
1814
  :type => Array,
1806
1815
  :allowed_from_server => true,
1807
1816
  :transform => DefaultSource.method(:convert_to_regexp_list),
1808
- :description => 'Define transactions you want the agent to ignore, by specifying a list of patterns matching the URI you want to ignore.' \
1809
- '*Note:* This will only ignore transaction events, not spans or traces from the same transation. See documentation on ' \
1810
- '(Ignoring Specific Transactions)[https://docs.newrelic.com/docs/agents/ruby-agent/api-guides/ignoring-specific-transactions/#config-ignoring] ' \
1811
- 'for more details.'
1817
+ :description => 'Define transactions you want the agent to ignore, by specifying a list of patterns matching the URI you want to ignore.'
1812
1818
  },
1813
1819
  :'synthetics.traces_limit' => {
1814
1820
  :default => 20,
@@ -110,15 +110,15 @@ module NewRelic
110
110
  end
111
111
 
112
112
  def to_s
113
- result = version.to_s
114
- result << DELIMITER << parent_type_id.to_s
115
- result << DELIMITER << parent_account_id
116
- result << DELIMITER << parent_app_id
113
+ result = version.to_s # required
114
+ result << DELIMITER << parent_type_id.to_s # required
115
+ result << DELIMITER << parent_account_id # required
116
+ result << DELIMITER << parent_app_id # required
117
117
  result << DELIMITER << (id || NewRelic::EMPTY_STR)
118
118
  result << DELIMITER << (transaction_id || NewRelic::EMPTY_STR)
119
119
  result << DELIMITER << (sampled ? TRUE_CHAR : FALSE_CHAR)
120
120
  result << DELIMITER << sprintf("%.6f", priority)
121
- result << DELIMITER << timestamp.to_s
121
+ result << DELIMITER << timestamp.to_s # required
122
122
  result
123
123
  end
124
124
  end
@@ -51,7 +51,11 @@ module NewRelic
51
51
  end
52
52
 
53
53
  def instrument_send_multiget
54
- ::Dalli::Server.class_eval do
54
+ if supports_binary_protocol?
55
+ ::Dalli::Protocol::Binary
56
+ else
57
+ ::Dalli::Server
58
+ end.class_eval do
55
59
  include NewRelic::Agent::Instrumentation::Memcache::Tracer
56
60
  alias_method :send_multiget_without_newrelic_trace, :send_multiget
57
61
 
@@ -7,11 +7,16 @@ module NewRelic::Agent::Instrumentation
7
7
  module Memcache
8
8
  module Helper
9
9
  DATASTORE_INSTANCES_SUPPORTED_VERSION = Gem::Version.new '2.6.4'
10
+ BINARY_PROTOCOL_SUPPORTED_VERSION = Gem::Version.new '3.0.2'
10
11
 
11
12
  def supports_datastore_instances?
12
13
  DATASTORE_INSTANCES_SUPPORTED_VERSION <= Gem::Version.new(::Dalli::VERSION)
13
14
  end
14
15
 
16
+ def supports_binary_protocol?
17
+ BINARY_PROTOCOL_SUPPORTED_VERSION <= Gem::Version.new(::Dalli::VERSION)
18
+ end
19
+
15
20
  def client_methods
16
21
  [:get, :get_multi, :set, :add, :incr, :decr, :delete, :replace, :append,
17
22
  :prepend, :cas, :single_get, :multi_get, :single_cas, :multi_cas]
@@ -31,7 +31,13 @@ module NewRelic::Agent::Instrumentation
31
31
  if supports_datastore_instances?
32
32
  yield ::Dalli::Client, dalli_client_prepender(dalli_methods)
33
33
  yield ::Dalli::Client, dalli_get_multi_prepender(:get_multi)
34
- yield ::Dalli::Server, dalli_server_prepender
34
+
35
+ if supports_binary_protocol?
36
+ yield ::Dalli::Protocol::Binary, dalli_server_prepender
37
+ else
38
+ yield ::Dalli::Server, dalli_server_prepender
39
+ end
40
+
35
41
  yield ::Dalli::Ring, dalli_ring_prepender
36
42
  else
37
43
  yield ::Dalli::Client, dalli_client_prepender(client_methods)
@@ -85,4 +91,4 @@ module NewRelic::Agent::Instrumentation
85
91
  end
86
92
  end
87
93
  end
88
- end
94
+ end
@@ -0,0 +1,24 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under New Relic's license terms.
3
+ # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
4
+
5
+ module NewRelic::Agent::Instrumentation
6
+ module Tilt
7
+ module Chain
8
+ def self.instrument!
9
+ ::Tilt::Template.module_eval do
10
+ include NewRelic::Agent::Instrumentation::Tilt
11
+
12
+ def render_with_new_relic(*args, &block)
13
+ render_with_tracing(*args) {
14
+ render_without_newrelic(*args, &block)
15
+ }
16
+ end
17
+
18
+ alias render_without_newrelic render
19
+ alias render render_with_new_relic
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,41 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under New Relic's license terms.
3
+ # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
4
+
5
+ module NewRelic
6
+ module Agent
7
+ module Instrumentation
8
+ module Tilt
9
+
10
+ def metric_name(klass, file)
11
+ "View/#{klass}/#{file}/Rendering"
12
+ end
13
+
14
+ # Sinatra uses #caller_locations for the file name in Tilt (unlike Rails/Rack)
15
+ # So here we are only grabbing the file name and name of directory it is in
16
+ def create_filename_for_metric(file)
17
+ return file unless defined?(::Sinatra) && defined?(::Sinatra::Base)
18
+ file.split('/')[-2..-1].join('/')
19
+ rescue NoMethodError
20
+ file
21
+ end
22
+
23
+ def render_with_tracing(*args, &block)
24
+ begin
25
+ finishable = Tracer.start_segment(
26
+ name: metric_name(self.class, create_filename_for_metric(self.file))
27
+ )
28
+ begin
29
+ yield
30
+ rescue => error
31
+ NewRelic::Agent.notice_error(error)
32
+ raise
33
+ end
34
+ ensure
35
+ finishable.finish if finishable
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,13 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under New Relic's license terms.
3
+ # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
4
+
5
+ module NewRelic::Agent::Instrumentation
6
+ module Tilt::Prepend
7
+ include NewRelic::Agent::Instrumentation::Tilt
8
+
9
+ def render(*args, &block)
10
+ render_with_tracing { super }
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,25 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under New Relic's license terms.
3
+ # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
4
+
5
+ require_relative 'tilt/instrumentation'
6
+ require_relative 'tilt/chain'
7
+ require_relative 'tilt/prepend'
8
+
9
+ DependencyDetection.defer do
10
+ named :tilt
11
+
12
+ depends_on { defined?(::Tilt) }
13
+
14
+ executes do
15
+ ::NewRelic::Agent.logger.info('Installing Tilt instrumentation')
16
+ end
17
+
18
+ executes do
19
+ if use_prepend?
20
+ prepend_instrument ::Tilt::Template, NewRelic::Agent::Instrumentation::Tilt::Prepend
21
+ else
22
+ chain_instrument NewRelic::Agent::Instrumentation::Tilt::Chain
23
+ end
24
+ end
25
+ end
@@ -33,6 +33,7 @@ module NewRelic
33
33
  COLON = ':'.freeze
34
34
  COMMA = ','.freeze
35
35
  CLOSING_BRACE = '}'.freeze
36
+ REPLACEMENT_CHAR = '�'
36
37
 
37
38
  def initialize
38
39
  Agent.config.register_callback :app_name do
@@ -86,12 +87,10 @@ module NewRelic
86
87
  message << QUOTE << key << QUOTE << COLON << QUOTE << value << QUOTE
87
88
  end
88
89
 
89
- def escape message
90
- if String === message
91
- message.to_json
92
- else
93
- message.inspect.to_json
94
- end
90
+ def escape(message)
91
+ message = message.to_s unless message.is_a?(String)
92
+ message = message.scrub(REPLACEMENT_CHAR) unless message.valid_encoding?
93
+ message.to_json
95
94
  end
96
95
 
97
96
  def clear_tags!
@@ -22,10 +22,12 @@ module NewRelic
22
22
  CONTENT_LENGTH_HEADER_KEY = 'HTTP_CONTENT_LENGTH'.freeze
23
23
 
24
24
  def on_finished_configuring(events)
25
- Deprecator.deprecate('cross_application_tracer')
26
- ::NewRelic::Agent.logger.warn(
27
- "[DEPRECATED] Cross application tracing is enabled. Distributed tracing is replacing cross application tracing as the default means of tracing between services. To continue using cross application tracing, enable it with `cross_application_tracer.enabled: true` and `distributed_tracing.enabled: false`"
28
- )
25
+ if CrossAppTracing.cross_app_enabled?
26
+ Deprecator.deprecate('cross_application_tracer')
27
+ ::NewRelic::Agent.logger.warn(
28
+ "[DEPRECATED] Cross application tracing is enabled. Distributed tracing is replacing cross application tracing as the default means of tracing between services. To continue using cross application tracing, enable it with `cross_application_tracer.enabled: true` and `distributed_tracing.enabled: false`"
29
+ )
30
+ end
29
31
 
30
32
  register_event_listeners(events)
31
33
  end
@@ -138,6 +138,9 @@ module NewRelic
138
138
  end
139
139
 
140
140
  def record_span_event
141
+ # don't record a span event if the transaction is ignored
142
+ return if transaction.ignore?
143
+
141
144
  aggregator = ::NewRelic::Agent.agent.span_event_aggregator
142
145
  priority = transaction.priority
143
146
 
@@ -73,6 +73,7 @@ module NewRelic
73
73
  end
74
74
 
75
75
  def insert_headers headers
76
+ return unless NewRelic::Agent.agent.connected?
76
77
  insert_trace_context_header headers
77
78
  insert_distributed_trace_header headers
78
79
  insert_cross_app_header headers
@@ -250,6 +250,9 @@ module NewRelic
250
250
  end
251
251
 
252
252
  def record_span_event
253
+ # don't record a span event if the transaction is ignored
254
+ return if transaction.ignore?
255
+
253
256
  aggregator = ::NewRelic::Agent.agent.span_event_aggregator
254
257
  priority = transaction.priority
255
258
  aggregator.record(priority: priority) do
@@ -79,6 +79,9 @@ module NewRelic
79
79
  end
80
80
 
81
81
  def record_span_event
82
+ # don't record a span event if the transaction is ignored
83
+ return if transaction.ignore?
84
+
82
85
  aggregator = ::NewRelic::Agent.agent.span_event_aggregator
83
86
  priority = transaction.priority
84
87
 
@@ -11,7 +11,7 @@ module NewRelic
11
11
  end
12
12
 
13
13
  MAJOR = 8
14
- MINOR = 1
14
+ MINOR = 2
15
15
  TINY = 0
16
16
 
17
17
  begin
data/newrelic.yml CHANGED
@@ -32,18 +32,6 @@ common: &default_settings
32
32
  # Defines the maximum number of request events reported from a single harvest.
33
33
  # analytics_events.max_samples_stored: 1200
34
34
 
35
- # If true, enables analytics event sampling.
36
- # analytics_events.enabled: true
37
-
38
- # If true, enables analytics event sampling.
39
- # analytics_events.enabled: true
40
-
41
- # Defines the maximum number of request events reported from a single harvest.
42
- # analytics_events.max_samples_stored: 1200
43
-
44
- # Defines the maximum number of request events reported from a single harvest.
45
- # analytics_events.max_samples_stored: 1200
46
-
47
35
  # Prefix of attributes to exclude from all destinations. Allows * as wildcard at
48
36
  # end.
49
37
  # attributes_exclude: []
@@ -222,18 +210,12 @@ common: &default_settings
222
210
  # Allows * as wildcard at end.
223
211
  # error_collector.attributes.include: []
224
212
 
225
- # If true, the agent collects TransactionError events.
226
- # error_collector.capture_events: false
227
-
228
213
  # If true, the agent collects TransactionError events.
229
214
  # error_collector.capture_events: true
230
215
 
231
216
  # If true, the agent captures traced errors and error count metrics.
232
217
  # error_collector.enabled: true
233
218
 
234
- # If true, the agent captures traced errors and error count metrics.
235
- # error_collector.enabled: true
236
-
237
219
  # A list of error classes that the agent should treat as expected.
238
220
  # error_collector.expected_classes: []
239
221
 
@@ -389,6 +371,10 @@ common: &default_settings
389
371
  # May be one of [auto|prepend|chain|disabled].
390
372
  # instrumentation.sinatra: auto
391
373
 
374
+ # Controls auto-instrumentation of Tilt at start up.
375
+ # May be one of [auto|prepend|chain|disabled].
376
+ # instrumentation.tilt: auto
377
+
392
378
  # Controls auto-instrumentation of Typhoeus at start up.
393
379
  # May be one of [auto|prepend|chain|disabled].
394
380
  # instrumentation.typhoeus: auto
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_rpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.1.0
4
+ version: 8.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Huntsman
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-10-27 00:00:00.000000000 Z
13
+ date: 2021-11-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -368,8 +368,6 @@ files:
368
368
  - lib/new_relic/agent/instrumentation/rack/helpers.rb
369
369
  - lib/new_relic/agent/instrumentation/rack/instrumentation.rb
370
370
  - lib/new_relic/agent/instrumentation/rack/prepend.rb
371
- - lib/new_relic/agent/instrumentation/rails/action_controller.rb
372
- - lib/new_relic/agent/instrumentation/rails/action_web_service.rb
373
371
  - lib/new_relic/agent/instrumentation/rails3/action_controller.rb
374
372
  - lib/new_relic/agent/instrumentation/rails_middleware.rb
375
373
  - lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb
@@ -399,6 +397,10 @@ files:
399
397
  - lib/new_relic/agent/instrumentation/sinatra/prepend.rb
400
398
  - lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb
401
399
  - lib/new_relic/agent/instrumentation/sunspot.rb
400
+ - lib/new_relic/agent/instrumentation/tilt.rb
401
+ - lib/new_relic/agent/instrumentation/tilt/chain.rb
402
+ - lib/new_relic/agent/instrumentation/tilt/instrumentation.rb
403
+ - lib/new_relic/agent/instrumentation/tilt/prepend.rb
402
404
  - lib/new_relic/agent/instrumentation/typhoeus.rb
403
405
  - lib/new_relic/agent/instrumentation/typhoeus/chain.rb
404
406
  - lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb
@@ -1,125 +0,0 @@
1
- # encoding: utf-8
2
- # This file is distributed under New Relic's license terms.
3
- # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
4
-
5
- require 'new_relic/agent/parameter_filtering'
6
-
7
- DependencyDetection.defer do
8
- @name = :rails21_view
9
-
10
- depends_on do
11
- !NewRelic::Agent.config[:disable_view_instrumentation] &&
12
- defined?(ActionController) && defined?(ActionController::Base) && defined?(ActionView::PartialTemplate) && defined?(ActionView::Template) &&
13
- defined?(Rails::VERSION::STRING) && Rails::VERSION::STRING =~ /^2\.1\./ # Rails 2.1 &&
14
- end
15
-
16
- executes do
17
- ::NewRelic::Agent.logger.info 'Installing Rails 2.1 View instrumentation'
18
- end
19
-
20
- executes do
21
- ActionView::PartialTemplate.class_eval do
22
- include NewRelic::Agent::MethodTracer
23
- add_method_tracer :render, -> (*) { "View/#{path_without_extension[%r{^(/.*/)?(.*)$},2]}.#{@view.template_format}.#{extension}/Partial" }
24
- end
25
-
26
- # this is for template rendering, as opposed to partial rendering.
27
- ActionView::Template.class_eval do
28
- include NewRelic::Agent::MethodTracer
29
- add_method_tracer :render, -> (*) { "View/#{(path_without_extension || @view.controller.newrelic_metric_path)[%r{^(/.*/)?(.*)$},2]}.#{@view.template_format}.#{extension}/Rendering" }
30
- end
31
- end
32
- end
33
-
34
- DependencyDetection.defer do
35
- @name = :old_rails_view
36
-
37
- depends_on do
38
- !NewRelic::Agent.config[:disable_view_instrumentation] &&
39
- defined?(ActionController) && defined?(ActionController::Base) &&
40
- defined?(Rails::VERSION::STRING) && Rails::VERSION::STRING =~ /^(1\.|2\.0)/ # Rails 1.* - 2.0
41
- end
42
-
43
- executes do
44
- ::NewRelic::Agent.logger.info 'Installing Rails 1.* - 2.0 View instrumentation'
45
- end
46
-
47
- executes do
48
- ActionController::Base.class_eval do
49
- include NewRelic::Agent::MethodTracer
50
- add_method_tracer :render, -> (*) { "View/#{newrelic_metric_path}/Rendering" }
51
- end
52
- end
53
- end
54
-
55
- DependencyDetection.defer do
56
- @name = :rails23_view
57
-
58
- depends_on do
59
- !NewRelic::Agent.config[:disable_view_instrumentation] &&
60
- defined?(ActionView) && defined?(ActionView::Template) && defined?(ActionView::RenderablePartial) &&
61
- defined?(Rails::VERSION::STRING) && Rails::VERSION::STRING =~ /^2\.[23]/
62
- end
63
-
64
- executes do
65
- ::NewRelic::Agent.logger.info 'Installing Rails 2.2 - 2.3 View instrumentation'
66
- end
67
-
68
- executes do
69
- ActionView::RenderablePartial.module_eval do
70
- include NewRelic::Agent::MethodTracer
71
- add_method_tracer :render_partial, -> (*) { "View/#{path[%r{^(/.*/)?(.*)$},2]}/Partial" }
72
- end
73
-
74
- ActionView::Template.class_eval do
75
- include NewRelic::Agent::MethodTracer
76
- add_method_tracer :render, -> (*) { "View/#{path[%r{^(/.*/)?(.*)$},2]}/Rendering" }
77
- end
78
- end
79
- end
80
-
81
- DependencyDetection.defer do
82
- @name = :rails2_controller
83
-
84
- depends_on do
85
- defined?(ActionController) && defined?(ActionController::Base)
86
- end
87
-
88
- depends_on do
89
- defined?(Rails::VERSION::MAJOR) && Rails::VERSION::MAJOR.to_i == 2
90
- end
91
-
92
- executes do
93
- ::NewRelic::Agent.logger.info 'Installing Rails 2 Controller instrumentation'
94
- end
95
-
96
- executes do
97
- ActionController::Base.class_eval do
98
- include NewRelic::Agent::Instrumentation::ControllerInstrumentation
99
-
100
- def perform_action_with_newrelic_trace_wrapper
101
- munged_params = (respond_to?(:filter_parameters)) ? filter_parameters(params) : params
102
- munged_params = NewRelic::Agent::ParameterFiltering.filter_rails_request_parameters(munged_params)
103
-
104
- perform_action_with_newrelic_trace(:params => munged_params) do
105
- perform_action_without_newrelic_trace
106
- end
107
- end
108
-
109
- alias_method :perform_action_without_newrelic_trace, :perform_action
110
- alias_method :perform_action, :perform_action_with_newrelic_trace_wrapper
111
- private :perform_action
112
-
113
- # determine the path that is used in the metric name for
114
- # the called controller action
115
- def newrelic_metric_path(action_name_override = nil)
116
- action_part = action_name_override || action_name
117
- if action_name_override || self.class.action_methods.include?(action_part)
118
- "#{self.class.controller_path}/#{action_part}"
119
- else
120
- "#{self.class.controller_path}/(other)"
121
- end
122
- end
123
- end
124
- end
125
- end
@@ -1,46 +0,0 @@
1
- # encoding: utf-8
2
- # This file is distributed under New Relic's license terms.
3
- # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
4
-
5
- DependencyDetection.defer do
6
- @name = :rails_action_web_service
7
-
8
- depends_on do
9
- defined?(ActionWebService)
10
- end
11
-
12
- executes do
13
- ::NewRelic::Agent.logger.info 'Installing Rails ActionWebService instrumentation'
14
- end
15
-
16
- executes do
17
- # NewRelic Agent instrumentation for WebServices
18
-
19
- # Note Action Web Service is removed from default package in rails
20
- # 2.0, this is purely here as a service to our legacy customers.
21
-
22
- # instrumentation for Web Service martialing - XML RPC
23
- ActionWebService::Protocol::XmlRpc::XmlRpcProtocol.class_eval do
24
- add_method_tracer :decode_request, "WebService/Xml Rpc/XML Decode"
25
- add_method_tracer :encode_request, "WebService/Xml Rpc/XML Encode"
26
- add_method_tracer :decode_response, "WebService/Xml Rpc/XML Decode"
27
- add_method_tracer :encode_response, "WebService/Xml Rpc/XML Encode"
28
- end
29
-
30
- # instrumentation for Web Service martialing - Soap
31
- ActionWebService::Protocol::Soap::SoapProtocol.class_eval do
32
- add_method_tracer :decode_request, "WebService/Soap/XML Decode"
33
- add_method_tracer :encode_request, "WebService/Soap/XML Encode"
34
- add_method_tracer :decode_response, "WebService/Soap/XML Decode"
35
- add_method_tracer :encode_response, "WebService/Soap/XML Encode"
36
- end
37
-
38
- if defined?(ActionController) && defined?(ActionController::Base)
39
- ActionController::Base.class_eval do
40
- if method_defined? :perform_invocation
41
- add_method_tracer :perform_invocation, -> (*args) { "WebService/#{controller_name}/#{args.first}" }
42
- end
43
- end
44
- end
45
- end
46
- end