newrelic_rpm 5.0.0.342 → 5.1.0.344

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: 10c4b8fa117aaa061a4e13071bfa6a568e03dc27b4d9a75040cbf9c5b0772749
4
- data.tar.gz: 1536ab0db32670d6f604cd9c662d1b7633366e77957051e8ace104df942ed97d
3
+ metadata.gz: 542ac1ce1a083c278c83f047f78ab8b3c8810a0916c87f83894a1f923d0a3fd2
4
+ data.tar.gz: 4e1eb213e1a4dac5877552f15e971bdf1b5005d2fb208a5364a8e1e59b9d25a0
5
5
  SHA512:
6
- metadata.gz: aff7fb607ba79d6f8707a8c4f99bee62dc32c87df71a8809517ed1e29ba57760f0991c241d56816dfc50af99aad98bd918f82d97365cc36882962973efe12551
7
- data.tar.gz: 8f2c281d13b955a25d9b7717ed248d5dc3a230e1e42ebf4fd25ad010253cfe42ba7692b288e2d093b9cd64a84d56d7a3edc1d274207ad01402c1ea36cc62af1a
6
+ metadata.gz: eaf4583a69257f2e22aaae8a6148a5b38d130f83e9585fd69b70ddaf6696e18d7da0a814e7d0046fa6fc6d1afd23f591f961194b56c3da4d86c97cc9d975da4e
7
+ data.tar.gz: 49de5e3b35b731ef61835a2f3fed0a82fcf7ff9af97db695c829cd3936b19bd7ecf1087ff69c5a755a743f203a1efec8c070d4587737e0419e364116bd827121
@@ -1,5 +1,59 @@
1
1
  # New Relic Ruby Agent Release Notes #
2
2
 
3
+ ## v5.1.0 ##
4
+
5
+ * Rails 5.2 support
6
+
7
+ The Ruby agent has been validated against the latest release of
8
+ Ruby on Rails!
9
+
10
+ * Support for newer libraries and frameworks
11
+
12
+ We have updated the multiverse suite to test the agent against
13
+ current versions of several frameworks.
14
+
15
+ * Add `custom_attributes.enabled` configuration option
16
+
17
+ This option is enabled by default. When it's disabled, custom
18
+ attributes will not be transmitted on transaction events or error
19
+ events.
20
+
21
+ * Fix Grape load order dependency
22
+
23
+ The agent will now choose the correct name for Grape transactions
24
+ even if the customer's app loads the agent before Grape. Thanks
25
+ to Daniel Doubrovkine for the contribution!
26
+
27
+ * Add `webpacker:compile` to blacklisted tasks
28
+
29
+ `webpacker:compile` is commonly used for compiling assets. It has
30
+ been added to `AUTOSTART_BLACKLISTED_RAKE_TASKS` in the default
31
+ configuration. Thanks to Claudio B. for the contribution!
32
+
33
+ * Make browser instrumentation W3C-compliant
34
+
35
+ `type="text/javascript"` is optional for the `<script>` tag under
36
+ W3C. The `type` attribute has now been removed from browser
37
+ instrumentation. Thanks to Spharian for the contribution!
38
+
39
+ * Deferred `add_method_tracer` calls
40
+
41
+ If a third-party library calls `add_method_tracer` before the
42
+ agent has finished starting, we now queue these calls and run them
43
+ when it's safe to do so (rather than skipping them and logging a
44
+ warning).
45
+
46
+ * Bugfix for Resque `around` / `before` hooks
47
+
48
+ In rare cases, the agent was not instrumenting Resque `around` and
49
+ `before` hooks. This version fixes the error.
50
+
51
+ * Truncation of long stack traces
52
+
53
+ Occasionally, long stack traces would cause complications sending
54
+ data to New Relic. This version truncates long traces to 50 frames
55
+ (split evenly between the top and bottom of the trace).
56
+
3
57
  ## v5.0.0 ##
4
58
 
5
59
  * SSL connections to New Relic are now mandatory
data/README.md CHANGED
@@ -130,9 +130,6 @@ If you can't find what you're looking for there, reach out to us on our [support
130
130
  site](http://support.newrelic.com/) or our [community forum](http://forum.newrelic.com)
131
131
  and we'll be happy to help you.
132
132
 
133
- Also available is community support on IRC: we generally use #newrelic
134
- on irc.freenode.net
135
-
136
133
  Find a bug? Contact us via [support.newrelic.com](http://support.newrelic.com/),
137
134
  or email support@newrelic.com.
138
135
 
@@ -99,6 +99,8 @@ module NewRelic
99
99
 
100
100
  @agent = nil
101
101
  @logger = nil
102
+ @tracer_lock = Mutex.new
103
+ @tracer_queue = []
102
104
 
103
105
  # The singleton Agent instance. Used internally.
104
106
  def agent #:nodoc:
@@ -110,6 +112,7 @@ module NewRelic
110
112
 
111
113
  def agent=(new_instance)#:nodoc:
112
114
  @agent = new_instance
115
+ add_deferred_method_tracers_now
113
116
  end
114
117
 
115
118
  alias instance agent #:nodoc:
@@ -124,6 +127,30 @@ module NewRelic
124
127
  @logger = log
125
128
  end
126
129
 
130
+ # A third-party class may call add_method_tracer before the agent
131
+ # is initialized; these methods enable us to defer these calls
132
+ # until we have started up and can process them.
133
+ #
134
+ def add_or_defer_method_tracer(receiver, method_name, metric_name_code, options)
135
+ @tracer_lock.synchronize do
136
+ if @agent
137
+ receiver.send(:_add_method_tracer_now, method_name, metric_name_code, options)
138
+ else
139
+ @tracer_queue << [receiver, method_name, metric_name_code, options]
140
+ end
141
+ end
142
+ end
143
+
144
+ def add_deferred_method_tracers_now
145
+ @tracer_lock.synchronize do
146
+ @tracer_queue.each do |receiver, method_name, metric_name_code, options|
147
+ receiver.send(:_add_method_tracer_now, method_name, metric_name_code, options)
148
+ end
149
+
150
+ @tracer_queue = []
151
+ end
152
+ end
153
+
127
154
  def config
128
155
  @config ||= Configuration::Manager.new
129
156
  end
@@ -251,7 +251,8 @@ module NewRelic
251
251
  'test:uncommitted',
252
252
  'time:zones:all',
253
253
  'tmp:clear',
254
- 'tmp:create'
254
+ 'tmp:create',
255
+ 'webpacker:compile'
255
256
  ].join(',').freeze
256
257
 
257
258
  DEFAULTS = {
@@ -804,7 +805,16 @@ module NewRelic
804
805
  :public => true,
805
806
  :type => String,
806
807
  :allowed_from_server => true,
807
- :description => 'Obfuscation level for SQL queries reported in transaction trace nodes. Valid options are <code>obfuscated</code>, <code>raw</code>, or <code>none</code>.'
808
+ :description => 'Obfuscation level for SQL queries reported in transaction trace nodes.</p>
809
+
810
+ <p>By default, this is set to <code>obfuscated</code>, which strips out the numeric and string literals.</p>
811
+
812
+ <ul>
813
+ <li>If you do not want the agent to capture query information, set this to <code>none</code>.</li>
814
+ <li>If you want the agent to capture all query information in its original form, set this to <code>raw</code>.</li>
815
+ <li>When you enable <a href="/docs/agents/manage-apm-agents/configuration/high-security-mode">high security mode</a>, this is automatically set to <code>obfuscated</code>.</li>
816
+ </ul>
817
+ <p>' # Doc generator will wrap this in <p>...</p>
808
818
  },
809
819
  :'transaction_tracer.record_redis_arguments' => {
810
820
  :default => false,
@@ -1568,6 +1578,13 @@ module NewRelic
1568
1578
  :transform => DefaultSource.method(:convert_to_list),
1569
1579
  :description => 'Prefix of attributes to include in browser monitoring. Allows <code>*</code> as wildcard at end.'
1570
1580
  },
1581
+ :'custom_attributes.enabled' => {
1582
+ :default => true,
1583
+ :public => true,
1584
+ :type => Boolean,
1585
+ :allowed_from_server => false,
1586
+ :description => 'If <code>false</code>, custom attributes will not be sent on Insights events.'
1587
+ },
1571
1588
  :'utilization.detect_aws' => {
1572
1589
  :default => true,
1573
1590
  :public => true,
@@ -78,7 +78,6 @@ module NewRelic
78
78
  payload.sampled = transaction.sampled?
79
79
  payload.priority = transaction.priority
80
80
  payload.parent_id = transaction.parent_id
81
- payload.grandparent_id = transaction.grandparent_id
82
81
 
83
82
  payload
84
83
  end
@@ -97,8 +96,7 @@ module NewRelic
97
96
  payload.trace_id = payload_data[TRACE_ID_KEY]
98
97
  payload.sampled = payload_data[SAMPLED_KEY]
99
98
  payload.priority = payload_data[PRIORITY_KEY]
100
- payload.parent_id = payload_data[ID_KEY] # Our parent ID is the caller's GUID
101
- payload.grandparent_id = payload_data[PARENT_ID_KEY] # Our grandparent ID is the caller's parent ID
99
+ payload.parent_id = payload_data[PARENT_ID_KEY]
102
100
 
103
101
  payload
104
102
  end
@@ -138,7 +136,6 @@ module NewRelic
138
136
  :sampled,
139
137
  :priority,
140
138
  :parent_id,
141
- :grandparent_id,
142
139
  :timestamp
143
140
 
144
141
  alias_method :sampled?, :sampled
@@ -184,8 +181,8 @@ module NewRelic
184
181
  transaction_payload[GUID_INTRINSIC_KEY] = transaction.guid
185
182
  transaction_payload[TRACE_ID_INTRINSIC_KEY] = trace_id
186
183
  transaction_payload[TRIP_ID_INTRINSIC_KEY] = trace_id
187
- transaction_payload[PARENT_ID_INTRINSIC_KEY] = parent_id if parent_id
188
- transaction_payload[GRANDPARENT_ID_INTRINSIC_KEY] = grandparent_id if grandparent_id
184
+ transaction_payload[PARENT_ID_INTRINSIC_KEY] = transaction.parent_id if transaction.parent_id
185
+ transaction_payload[GRANDPARENT_ID_INTRINSIC_KEY] = transaction.grandparent_id if transaction.grandparent_id
189
186
  end
190
187
  end
191
188
  end
@@ -13,6 +13,9 @@ module NewRelic
13
13
  # made configurable in the future. This is a tradeoff between
14
14
  # memory and data retention
15
15
  MAX_ERROR_QUEUE_LENGTH = 20
16
+ # Maximum number of frames in backtraces. May be made configurable
17
+ # in the future.
18
+ MAX_BACKTRACE_FRAMES = 50
16
19
  EXCEPTION_TAG_IVAR = :'@__nr_seen_exception'
17
20
 
18
21
  attr_reader :error_trace_aggregator, :error_event_aggregator
@@ -213,6 +216,19 @@ module NewRelic
213
216
  nil
214
217
  end
215
218
 
219
+ def truncate_trace(trace, keep_frames=MAX_BACKTRACE_FRAMES)
220
+ return trace if trace.length < keep_frames || trace.length == 0
221
+
222
+ # If keep_frames is odd, we will split things up favoring the top of the trace
223
+ keep_top = (keep_frames / 2.0).ceil
224
+ keep_bottom = (keep_frames / 2.0).floor
225
+
226
+ truncate_frames = trace.length - keep_frames
227
+
228
+ truncated_trace = trace[0...keep_top].concat(["<truncated #{truncate_frames.to_s} additional frames>"]).concat(trace[-keep_bottom..-1])
229
+ truncated_trace
230
+ end
231
+
216
232
  EMPTY_STRING = ''.freeze
217
233
 
218
234
  def create_noticed_error(exception, options)
@@ -225,7 +241,7 @@ module NewRelic
225
241
 
226
242
  noticed_error.file_name = sense_method(exception, :file_name)
227
243
  noticed_error.line_number = sense_method(exception, :line_number)
228
- noticed_error.stack_trace = extract_stack_trace(exception)
244
+ noticed_error.stack_trace = truncate_trace(extract_stack_trace(exception))
229
245
 
230
246
  noticed_error.expected = !! options.delete(:expected)
231
247
 
@@ -31,6 +31,11 @@ DependencyDetection.defer do
31
31
  ::NewRelic::Agent::PrependSupportability.record_metrics_for(::ActiveRecord::Base, ::ActiveRecord::Relation)
32
32
  ::ActiveRecord::Base.prepend ::NewRelic::Agent::Instrumentation::ActiveRecordPrepend::BaseExtensions
33
33
  ::ActiveRecord::Relation.prepend ::NewRelic::Agent::Instrumentation::ActiveRecordPrepend::RelationExtensions
34
+
35
+ if ::ActiveRecord::VERSION::MINOR.to_i == 1 &&
36
+ ::ActiveRecord::VERSION::TINY.to_i >= 6
37
+ ::ActiveRecord::Base.prepend ::NewRelic::Agent::Instrumentation::ActiveRecordPrepend::BaseExtensions516
38
+ end
34
39
  end
35
40
  end
36
41
  end
@@ -24,6 +24,19 @@ module NewRelic
24
24
  end
25
25
  end
26
26
 
27
+ module BaseExtensions516
28
+ # In ActiveRecord v5.0.0 through v5.1.5, touch() will call
29
+ # update_all() and cause us to record a transaction.
30
+ # Starting in v5.1.6, this call no longer happens. We'll
31
+ # have to set the database metrics explicitly now.
32
+ #
33
+ def touch(*args, &blk)
34
+ ::NewRelic::Agent.with_database_metric_name(self.class.name, nil, ACTIVE_RECORD) do
35
+ super
36
+ end
37
+ end
38
+ end
39
+
27
40
  module RelationExtensions
28
41
  def update_all(*args, &blk)
29
42
  ::NewRelic::Agent.with_database_metric_name(self.name, nil, ACTIVE_RECORD) do
@@ -58,4 +71,4 @@ module NewRelic
58
71
  end
59
72
  end
60
73
  end
61
- end
74
+ end
@@ -30,35 +30,33 @@ module NewRelic
30
30
  Transaction.set_default_transaction_name(txn_name, :grape, node_name)
31
31
  end
32
32
 
33
- if defined?(Grape::VERSION) && Gem::Version.new(::Grape::VERSION) >= Gem::Version.new("0.16.0")
34
- def name_for_transaction(route, class_name, version)
35
- action_name = route.path.sub(FORMAT_REGEX, EMPTY_STRING)
36
- method_name = route.request_method
37
- version ||= route.version
38
-
39
- # defaulting does not set rack.env['api.version'] and route.version may return Array
40
- #
41
- version = version.join(PIPE_STRING) if Array === version
42
-
43
- if version
44
- action_name = action_name.sub(VERSION_REGEX, EMPTY_STRING)
45
- "#{class_name}-#{version}#{action_name} (#{method_name})"
46
- else
47
- "#{class_name}#{action_name} (#{method_name})"
48
- end
33
+ def name_for_transaction(route, class_name, version)
34
+ action_name = route.path.sub(FORMAT_REGEX, EMPTY_STRING)
35
+ method_name = route.request_method
36
+ version ||= route.version
37
+
38
+ # defaulting does not set rack.env['api.version'] and route.version may return Array
39
+ #
40
+ version = version.join(PIPE_STRING) if Array === version
41
+
42
+ if version
43
+ action_name = action_name.sub(VERSION_REGEX, EMPTY_STRING)
44
+ "#{class_name}-#{version}#{action_name} (#{method_name})"
45
+ else
46
+ "#{class_name}#{action_name} (#{method_name})"
49
47
  end
50
- else
51
- def name_for_transaction(route, class_name, version)
52
- action_name = route.route_path.sub(FORMAT_REGEX, EMPTY_STRING)
53
- method_name = route.route_method
54
- version ||= route.route_version
55
-
56
- if version
57
- action_name = action_name.sub(VERSION_REGEX, EMPTY_STRING)
58
- "#{class_name}-#{version}#{action_name} (#{method_name})"
59
- else
60
- "#{class_name}#{action_name} (#{method_name})"
61
- end
48
+ end
49
+
50
+ def name_for_transaction_deprecated(route, class_name, version)
51
+ action_name = route.route_path.sub(FORMAT_REGEX, EMPTY_STRING)
52
+ method_name = route.route_method
53
+ version ||= route.route_version
54
+
55
+ if version
56
+ action_name = action_name.sub(VERSION_REGEX, EMPTY_STRING)
57
+ "#{class_name}-#{version}#{action_name} (#{method_name})"
58
+ else
59
+ "#{class_name}#{action_name} (#{method_name})"
62
60
  end
63
61
  end
64
62
 
@@ -109,6 +107,13 @@ DependencyDetection.defer do
109
107
  end
110
108
 
111
109
  def instrument_call
110
+ if defined?(Grape::VERSION) && Gem::Version.new(::Grape::VERSION) >= Gem::Version.new("0.16.0")
111
+ ::NewRelic::Agent::Instrumentation::GrapeInstrumentation.send :remove_method, :name_for_transaction_deprecated
112
+ else
113
+ ::NewRelic::Agent::Instrumentation::GrapeInstrumentation.send :remove_method, :name_for_transaction
114
+ ::NewRelic::Agent::Instrumentation::GrapeInstrumentation.send :alias_method, :name_for_transaction, :name_for_transaction_deprecated
115
+ end
116
+
112
117
  ::Grape::API.class_eval do
113
118
  def call_with_new_relic(env)
114
119
  begin
@@ -130,5 +135,4 @@ DependencyDetection.defer do
130
135
  alias_method :call, :call_with_new_relic
131
136
  end
132
137
  end
133
-
134
138
  end
@@ -22,52 +22,33 @@ DependencyDetection.defer do
22
22
  end
23
23
 
24
24
  executes do
25
- module Resque
26
- module Plugins
27
- module NewRelicInstrumentation
28
- include NewRelic::Agent::Instrumentation::ControllerInstrumentation
25
+ module ::Resque
26
+ class Job
27
+ include NewRelic::Agent::Instrumentation::ControllerInstrumentation
29
28
 
30
- def around_perform_with_monitoring(*args)
31
- begin
32
- perform_action_with_newrelic_trace(
33
- :name => 'perform',
34
- :class_name => self.name,
35
- :category => 'OtherTransaction/ResqueJob') do
29
+ alias_method :perform_without_instrumentation, :perform
36
30
 
37
- NewRelic::Agent::Transaction.merge_untrusted_agent_attributes(args, :'job.resque.args',
38
- NewRelic::Agent::AttributeFilter::DST_NONE)
31
+ def perform
32
+ begin
33
+ perform_action_with_newrelic_trace(
34
+ :name => 'perform',
35
+ :class_name => self.payload_class,
36
+ :category => 'OtherTransaction/ResqueJob') do
39
37
 
40
- yield(*args)
41
- end
42
- ensure
43
- NewRelic::Agent.agent.flush_pipe_data
44
- end
45
- end
46
- end
47
- end
48
- end
38
+ NewRelic::Agent::Transaction.merge_untrusted_agent_attributes(
39
+ args,
40
+ :'job.resque.args',
41
+ NewRelic::Agent::AttributeFilter::DST_NONE)
49
42
 
50
- module NewRelic
51
- module Agent
52
- module Instrumentation
53
- module ResqueInstrumentationInstaller
54
- def payload_class
55
- klass = super
56
- klass.instance_eval do
57
- extend ::Resque::Plugins::NewRelicInstrumentation
58
- end
43
+ perform_without_instrumentation
59
44
  end
45
+ ensure
46
+ NewRelic::Agent.agent.flush_pipe_data
60
47
  end
61
48
  end
62
49
  end
63
50
  end
64
51
 
65
- ::Resque::Job.class_eval do
66
- def self.new(*args)
67
- super(*args).extend NewRelic::Agent::Instrumentation::ResqueInstrumentationInstaller
68
- end
69
- end
70
-
71
52
  if NewRelic::LanguageSupport.can_fork?
72
53
  ::Resque.before_first_fork do
73
54
  NewRelic::Agent.manual_start(:dispatcher => :resque,
@@ -39,7 +39,6 @@ DependencyDetection.defer do
39
39
  end
40
40
 
41
41
  Sequel::Model.plugin :newrelic_instrumentation
42
-
43
42
  else
44
43
 
45
44
  NewRelic::Agent.logger.info "Sequel instrumentation requires at least version 3.37.0."
@@ -104,7 +104,7 @@ module NewRelic
104
104
  end
105
105
 
106
106
  def browser_timing_loader
107
- html_safe_if_needed("\n<script type=\"text/javascript\">#{Agent.config[:js_agent_loader]}</script>")
107
+ html_safe_if_needed("\n<script>#{Agent.config[:js_agent_loader]}</script>")
108
108
  end
109
109
 
110
110
  def browser_timing_config(state)
@@ -114,7 +114,7 @@ module NewRelic
114
114
  txn.freeze_name_and_execute_if_not_ignored do
115
115
  data = data_for_js_agent(state)
116
116
  json = ::JSON.dump(data)
117
- return html_safe_if_needed("\n<script type=\"text/javascript\">window.NREUM||(NREUM={});NREUM.info=#{json}</script>")
117
+ return html_safe_if_needed("\n<script>window.NREUM||(NREUM={});NREUM.info=#{json}</script>")
118
118
  end
119
119
 
120
120
  ''
@@ -291,7 +291,27 @@ module NewRelic
291
291
  #
292
292
  # @api public
293
293
  #
294
- def add_method_tracer(method_name, metric_name_code=nil, options = {})
294
+ def add_method_tracer(method_name, metric_name_code = nil, options = {})
295
+ ::NewRelic::Agent.add_or_defer_method_tracer(self, method_name, metric_name_code, options)
296
+ end
297
+
298
+ # For tests only because tracers must be removed in reverse-order
299
+ # from when they were added, or else other tracers that were added to the same method
300
+ # may get removed as well.
301
+ def remove_method_tracer(method_name, metric_name_code) # :nodoc:
302
+ return unless Agent.config[:agent_enabled]
303
+ if method_defined? "#{_traced_method_name(method_name, metric_name_code)}"
304
+ alias_method method_name, "#{_untraced_method_name(method_name, metric_name_code)}"
305
+ undef_method "#{_traced_method_name(method_name, metric_name_code)}"
306
+ ::NewRelic::Agent.logger.debug("removed method tracer #{method_name} #{metric_name_code}\n")
307
+ else
308
+ raise "No tracer for '#{metric_name_code}' on method '#{method_name}'"
309
+ end
310
+ end
311
+
312
+ private
313
+
314
+ def _add_method_tracer_now(method_name, metric_name_code, options)
295
315
  NewRelic::Agent.record_api_supportability_metric(:add_method_tracer)
296
316
 
297
317
  return unless newrelic_method_exists?(method_name)
@@ -308,24 +328,9 @@ module NewRelic
308
328
  send visibility, method_name
309
329
  send visibility, _traced_method_name(method_name, metric_name_code)
310
330
  ::NewRelic::Agent.logger.debug("Traced method: class = #{derived_class_name},"+
311
- "method = #{method_name}, "+
312
- "metric = '#{metric_name_code}'")
313
- end
314
-
315
- # For tests only because tracers must be removed in reverse-order
316
- # from when they were added, or else other tracers that were added to the same method
317
- # may get removed as well.
318
- def remove_method_tracer(method_name, metric_name_code) # :nodoc:
319
- return unless Agent.config[:agent_enabled]
320
- if method_defined? "#{_traced_method_name(method_name, metric_name_code)}"
321
- alias_method method_name, "#{_untraced_method_name(method_name, metric_name_code)}"
322
- undef_method "#{_traced_method_name(method_name, metric_name_code)}"
323
- ::NewRelic::Agent.logger.debug("removed method tracer #{method_name} #{metric_name_code}\n")
324
- else
325
- raise "No tracer for '#{metric_name_code}' on method '#{method_name}'"
326
- end
331
+ "method = #{method_name}, "+
332
+ "metric = '#{metric_name_code}'")
327
333
  end
328
- private
329
334
 
330
335
  # given a method and a metric, this method returns the
331
336
  # untraced alias of the method name
@@ -566,6 +566,7 @@ module NewRelic
566
566
  record_apdex(state, end_time) unless ignore_apdex?
567
567
  record_queue_time
568
568
  record_client_application_metric state
569
+ record_distributed_tracing_metrics
569
570
 
570
571
  record_exceptions
571
572
  record_transaction_event
@@ -57,6 +57,7 @@ module NewRelic
57
57
  end
58
58
 
59
59
  def merge_custom_attributes(other)
60
+ return unless Agent.config[:'custom_attributes.enabled']
60
61
  return if other.empty?
61
62
  AttributeProcessing.flatten_and_coerce(other) do |k, v|
62
63
  add_custom_attribute(k, v)
@@ -172,6 +172,66 @@ module NewRelic
172
172
  self.priority = payload.priority if payload.priority
173
173
  end
174
174
  end
175
+
176
+ ALL_SUFFIX = "all".freeze
177
+ ALL_WEB_SUFFIX = "allWeb".freeze
178
+ ALL_OTHER_SUFFIX = "allOther".freeze
179
+
180
+ def transaction_type_suffix
181
+ if Transaction.recording_web_transaction?
182
+ ALL_WEB_SUFFIX
183
+ else
184
+ ALL_OTHER_SUFFIX
185
+ end
186
+ end
187
+
188
+ def record_distributed_tracing_metrics
189
+ return unless Agent.config[:'distributed_tracing.enabled']
190
+
191
+ record_caller_by_duration_metrics
192
+ record_transport_duration_metrics
193
+ record_errors_by_caller_metrics
194
+ end
195
+
196
+ DURATION_BY_CALLER_UNKOWN_PREFIX = "DurationByCaller/Unknown/Unknown/Unknown/Unknown".freeze
197
+
198
+ def record_caller_by_duration_metrics
199
+ prefix = if distributed_trace?
200
+ payload = distributed_trace_payload
201
+ "DurationByCaller/#{payload.parent_type}/#{payload.parent_account_id}/#{payload.parent_app_id}/#{payload.caller_transport_type}"
202
+ else
203
+ DURATION_BY_CALLER_UNKOWN_PREFIX
204
+ end
205
+
206
+ metrics.record_unscoped "#{prefix}/#{ALL_SUFFIX}", duration
207
+ metrics.record_unscoped "#{prefix}/#{transaction_type_suffix}", duration
208
+ end
209
+
210
+ def record_transport_duration_metrics
211
+ return unless distributed_trace?
212
+
213
+ payload = distributed_trace_payload
214
+ prefix = "TransportDuration/#{payload.parent_type}/#{payload.parent_account_id}/#{payload.parent_app_id}/#{payload.caller_transport_type}"
215
+
216
+ metrics.record_unscoped "#{prefix}/#{ALL_SUFFIX}", transport_duration
217
+ metrics.record_unscoped "#{prefix}/#{transaction_type_suffix}", transport_duration
218
+ end
219
+
220
+ ERRORS_BY_CALLER_UNKOWN_PREFIX = "ErrorsByCaller/Unknown/Unknown/Unknown/Unknown".freeze
221
+
222
+ def record_errors_by_caller_metrics
223
+ return unless exceptions.size > 0
224
+
225
+ prefix = if distributed_trace?
226
+ payload = distributed_trace_payload
227
+ "ErrorsByCaller/#{payload.parent_type}/#{payload.parent_account_id}/#{payload.parent_app_id}/#{payload.caller_transport_type}"
228
+ else
229
+ ERRORS_BY_CALLER_UNKOWN_PREFIX
230
+ end
231
+
232
+ metrics.record_unscoped "#{prefix}/#{ALL_SUFFIX}", 1
233
+ metrics.record_unscoped "#{prefix}/#{transaction_type_suffix}", 1
234
+ end
175
235
  end
176
236
  end
177
237
  end
@@ -176,7 +176,6 @@ module NewRelic
176
176
 
177
177
  def record_metrics
178
178
  add_unscoped_metrics
179
- record_distributed_tracing_metrics if Agent.config[:'distributed_tracing.enabled']
180
179
  super
181
180
  end
182
181
 
@@ -244,61 +243,6 @@ module NewRelic
244
243
  end
245
244
  end
246
245
 
247
- ALL_SUFFIX = "all".freeze
248
- ALL_WEB_SUFFIX = "allWeb".freeze
249
- ALL_OTHER_SUFFIX = "allOther".freeze
250
-
251
- def transaction_type_suffix
252
- if Transaction.recording_web_transaction?
253
- ALL_WEB_SUFFIX
254
- else
255
- ALL_OTHER_SUFFIX
256
- end
257
- end
258
-
259
- def record_distributed_tracing_metrics
260
- add_caller_by_duration_metrics
261
- record_transport_duration_metrics
262
- record_errors_by_caller_metrics
263
- end
264
-
265
- DURATION_BY_CALLER_UNKOWN_PREFIX = "DurationByCaller/Unknown/Unknown/Unknown/Unknown".freeze
266
-
267
- def add_caller_by_duration_metrics
268
- prefix = if transaction.distributed_trace?
269
- payload = transaction.distributed_trace_payload
270
- "DurationByCaller/#{payload.parent_type}/#{payload.parent_account_id}/#{payload.parent_app_id}/transport"
271
- else
272
- DURATION_BY_CALLER_UNKOWN_PREFIX
273
- end
274
-
275
- @unscoped_metrics << "#{prefix}/#{ALL_SUFFIX}"
276
- @unscoped_metrics << "#{prefix}/#{transaction_type_suffix}"
277
- end
278
-
279
- def record_transport_duration_metrics
280
- return unless transaction.distributed_trace?
281
- payload = transaction.distributed_trace_payload
282
- prefix = "TransportDuration/#{payload.parent_type}/#{payload.parent_account_id}/#{payload.parent_app_id}/transport"
283
- metric_cache.record_unscoped "#{prefix}/#{ALL_SUFFIX}", transaction.transport_duration
284
- metric_cache.record_unscoped "#{prefix}/#{transaction_type_suffix}", transaction.transport_duration
285
- end
286
-
287
- ERRORS_BY_CALLER_UNKOWN_PREFIX = "ErrorsByCaller/Unknown/Unknown/Unknown/Unknown".freeze
288
-
289
- def record_errors_by_caller_metrics
290
- return unless transaction.exceptions.size > 0
291
- prefix = if transaction.distributed_trace?
292
- payload = transaction.distributed_trace_payload
293
- "ErrorsByCaller/#{payload.parent_type}/#{payload.parent_account_id}/#{payload.parent_app_id}/transport"
294
- else
295
- ERRORS_BY_CALLER_UNKOWN_PREFIX
296
- end
297
-
298
- NewRelic::Agent.increment_metric "#{prefix}/#{ALL_SUFFIX}"
299
- NewRelic::Agent.increment_metric "#{prefix}/#{transaction_type_suffix}"
300
- end
301
-
302
246
  def update_segment_name
303
247
  if @app_data
304
248
  @name = "ExternalTransaction/#{host}/#{cross_process_id}/#{cross_process_transaction_name}"
@@ -11,7 +11,7 @@ module NewRelic
11
11
  end
12
12
 
13
13
  MAJOR = 5
14
- MINOR = 0
14
+ MINOR = 1
15
15
  TINY = 0
16
16
 
17
17
  begin
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.version = NewRelic::VERSION::STRING
11
11
  s.required_ruby_version = '>= 2.0.0'
12
12
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
13
- s.authors = [ "Matthew Wear", "Chris Pine", "Erin Dees" ]
13
+ s.authors = [ "Matthew Wear", "Chris Pine", "Erin Dees", "Rachel Klein" ]
14
14
  s.date = Time.now.strftime('%Y-%m-%d')
15
15
  s.licenses = ['New Relic']
16
16
  s.description = <<-EOS
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_rpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.342
4
+ version: 5.1.0.344
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Wear
8
8
  - Chris Pine
9
9
  - Erin Dees
10
+ - Rachel Klein
10
11
  autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
- date: 2018-03-20 00:00:00.000000000 Z
14
+ date: 2018-04-25 00:00:00.000000000 Z
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: rake
@@ -483,7 +484,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
483
484
  version: 1.3.1
484
485
  requirements: []
485
486
  rubyforge_project:
486
- rubygems_version: 2.7.3
487
+ rubygems_version: 2.7.6
487
488
  signing_key:
488
489
  specification_version: 4
489
490
  summary: New Relic Ruby Agent