newrelic_rpm 7.2.0 → 8.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/CHANGELOG.md +105 -9
  4. data/README.md +2 -0
  5. data/lib/new_relic/agent/adaptive_sampler.rb +2 -2
  6. data/lib/new_relic/agent/agent.rb +6 -6
  7. data/lib/new_relic/agent/commands/thread_profiler_session.rb +7 -3
  8. data/lib/new_relic/agent/configuration/default_source.rb +15 -7
  9. data/lib/new_relic/agent/configuration/event_harvest_config.rb +28 -12
  10. data/lib/new_relic/agent/configuration/manager.rb +0 -1
  11. data/lib/new_relic/agent/configuration/server_source.rb +3 -2
  12. data/lib/new_relic/agent/configuration/yaml_source.rb +22 -1
  13. data/lib/new_relic/agent/custom_event_aggregator.rb +2 -1
  14. data/lib/new_relic/agent/database.rb +5 -2
  15. data/lib/new_relic/agent/datastores/mongo.rb +5 -10
  16. data/lib/new_relic/agent/datastores.rb +7 -7
  17. data/lib/new_relic/agent/distributed_tracing/cross_app_payload.rb +5 -5
  18. data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +10 -6
  19. data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +0 -1
  20. data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +1 -1
  21. data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +1 -1
  22. data/lib/new_relic/agent/event_loop.rb +6 -6
  23. data/lib/new_relic/agent/external.rb +0 -32
  24. data/lib/new_relic/agent/http_clients/abstract.rb +2 -2
  25. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +1 -1
  26. data/lib/new_relic/agent/instrumentation/active_merchant.rb +3 -3
  27. data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +1 -1
  28. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +1 -1
  29. data/lib/new_relic/agent/instrumentation/excon.rb +4 -23
  30. data/lib/new_relic/agent/instrumentation/mongo.rb +3 -141
  31. data/lib/new_relic/agent/instrumentation/queue_time.rb +4 -4
  32. data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +5 -5
  33. data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +1 -1
  34. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +5 -41
  35. data/lib/new_relic/agent/instrumentation/sidekiq.rb +6 -1
  36. data/lib/new_relic/agent/javascript_instrumentor.rb +3 -3
  37. data/lib/new_relic/agent/messaging.rb +10 -24
  38. data/lib/new_relic/agent/method_tracer.rb +132 -138
  39. data/lib/new_relic/agent/monitors/cross_app_monitor.rb +6 -1
  40. data/lib/new_relic/agent/new_relic_service.rb +9 -9
  41. data/lib/new_relic/agent/pipe_channel_manager.rb +10 -6
  42. data/lib/new_relic/agent/pipe_service.rb +1 -1
  43. data/lib/new_relic/agent/samplers/cpu_sampler.rb +1 -1
  44. data/lib/new_relic/agent/span_event_aggregator.rb +2 -2
  45. data/lib/new_relic/agent/sql_sampler.rb +1 -1
  46. data/lib/new_relic/agent/stats_engine/stats_hash.rb +1 -1
  47. data/lib/new_relic/agent/stats_engine.rb +1 -1
  48. data/lib/new_relic/agent/supported_versions.rb +1 -1
  49. data/lib/new_relic/agent/threading/backtrace_service.rb +4 -5
  50. data/lib/new_relic/agent/threading/thread_profile.rb +1 -1
  51. data/lib/new_relic/agent/tracer.rb +15 -37
  52. data/lib/new_relic/agent/transaction/abstract_segment.rb +3 -3
  53. data/lib/new_relic/agent/transaction/message_broker_segment.rb +5 -11
  54. data/lib/new_relic/agent/transaction.rb +7 -28
  55. data/lib/new_relic/agent/transaction_time_aggregator.rb +5 -5
  56. data/lib/new_relic/agent/vm/snapshot.rb +1 -1
  57. data/lib/new_relic/agent/worker_loop.rb +5 -5
  58. data/lib/new_relic/agent.rb +5 -5
  59. data/lib/new_relic/cli/commands/deployments.rb +2 -2
  60. data/lib/new_relic/constants.rb +0 -4
  61. data/lib/new_relic/noticed_error.rb +2 -2
  62. data/lib/new_relic/version.rb +2 -2
  63. data/lib/newrelic_rpm.rb +10 -34
  64. data/lib/tasks/all.rb +1 -1
  65. data/newrelic.yml +593 -3
  66. data/newrelic_rpm.gemspec +1 -1
  67. data/test/agent_helper.rb +27 -2
  68. metadata +3 -8
  69. data/lib/new_relic/agent/datastores/mongo/statement_formatter.rb +0 -53
  70. data/lib/new_relic/agent/instrumentation/excon/connection.rb +0 -49
  71. data/lib/new_relic/agent/instrumentation/merb/controller.rb +0 -44
  72. data/lib/new_relic/agent/instrumentation/merb/errors.rb +0 -33
  73. data/lib/new_relic/control/frameworks/merb.rb +0 -29
@@ -105,7 +105,7 @@ module NewRelic
105
105
  @lock.synchronize do
106
106
  if @profiles[transaction_name]
107
107
  profile = @profiles.delete(transaction_name)
108
- profile.finished_at = Time.now
108
+ profile.finished_at = Process.clock_gettime(Process::CLOCK_REALTIME)
109
109
  @profiles[transaction_name] = ThreadProfile.new(profile.command_arguments)
110
110
  profile
111
111
  end
@@ -163,7 +163,7 @@ module NewRelic
163
163
  end
164
164
 
165
165
  def poll
166
- poll_start = Time.now
166
+ poll_start = Process.clock_gettime(Process::CLOCK_REALTIME)
167
167
 
168
168
  @lock.synchronize do
169
169
  AgentThread.list.each do |thread|
@@ -173,7 +173,7 @@ module NewRelic
173
173
  @buffer.delete_if { |thread, _| !thread.alive? }
174
174
  end
175
175
 
176
- end_time = Time.now
176
+ end_time = Process.clock_gettime(Process::CLOCK_REALTIME)
177
177
  adjust_polling_time(end_time, poll_start)
178
178
  record_supportability_metrics(end_time, poll_start)
179
179
  end
@@ -230,7 +230,7 @@ module NewRelic
230
230
  bucket = AgentThread.bucket_thread(thread, @profile_agent_code)
231
231
 
232
232
  if need_backtrace?(bucket)
233
- timestamp = Time.now.to_f
233
+ timestamp = Process.clock_gettime(Process::CLOCK_REALTIME)
234
234
  backtrace = AgentThread.scrub_backtrace(thread, @profile_agent_code)
235
235
  aggregate_global_backtrace(backtrace, bucket, thread)
236
236
  buffer_backtrace_for_thread(thread, timestamp, backtrace, bucket)
@@ -277,7 +277,6 @@ module NewRelic
277
277
  end
278
278
  @last_poll = poll_start
279
279
  end
280
-
281
280
  end
282
281
  end
283
282
  end
@@ -39,7 +39,7 @@ module NewRelic
39
39
  @failure_count = 0
40
40
  @unique_threads = []
41
41
 
42
- @created_at = Time.now
42
+ @created_at = Process.clock_gettime(Process::CLOCK_REALTIME)
43
43
  end
44
44
 
45
45
  def requested_period
@@ -131,14 +131,10 @@ module NewRelic
131
131
  # @api public
132
132
  def start_transaction_or_segment(name: nil,
133
133
  partial_name: nil,
134
- category: nil,
134
+ category:,
135
135
  options: {})
136
- if name.nil? && partial_name.nil?
137
- raise ArgumentError, 'missing required argument: name or partial_name'
138
- end
139
- if category.nil?
140
- raise ArgumentError, 'missing required argument: category'
141
- end
136
+
137
+ raise ArgumentError, 'missing required argument: name or partial_name' if name.nil? && partial_name.nil?
142
138
 
143
139
  if name
144
140
  options[:transaction_name] = name
@@ -163,16 +159,12 @@ module NewRelic
163
159
 
164
160
  # Takes name or partial_name and a category.
165
161
  # Returns a transaction instance or nil
166
- def start_transaction(name: nil,
162
+ def start_transaction(category:,
163
+ name: nil,
167
164
  partial_name: nil,
168
- category: nil,
169
165
  **options)
170
- if name.nil? && partial_name.nil?
171
- raise ArgumentError, 'missing required argument: name or partial_name'
172
- end
173
- if category.nil?
174
- raise ArgumentError, 'missing required argument: category'
175
- end
166
+
167
+ raise ArgumentError, 'missing required argument: name or partial_name' if name.nil? && partial_name.nil?
176
168
 
177
169
  return current_transaction if current_transaction
178
170
 
@@ -238,14 +230,11 @@ module NewRelic
238
230
  # +finish+ on it at the end of the code you're tracing
239
231
  #
240
232
  # @api public
241
- def start_segment(name:nil,
233
+ def start_segment(name:,
242
234
  unscoped_metrics:nil,
243
235
  start_time: nil,
244
236
  parent: nil)
245
237
 
246
- # ruby 2.0.0 does not support required kwargs
247
- raise ArgumentError, 'missing required argument: name' if name.nil?
248
-
249
238
  segment = Transaction::Segment.new name, unscoped_metrics, start_time
250
239
  start_and_add_segment segment, parent
251
240
 
@@ -341,17 +330,12 @@ module NewRelic
341
330
  # you're tracing
342
331
  #
343
332
  # @api public
344
- def start_external_request_segment(library: nil,
345
- uri: nil,
346
- procedure: nil,
333
+ def start_external_request_segment(library:,
334
+ uri:,
335
+ procedure:,
347
336
  start_time: nil,
348
337
  parent: nil)
349
338
 
350
- # ruby 2.0.0 does not support required kwargs
351
- raise ArgumentError, 'missing required argument: library' if library.nil?
352
- raise ArgumentError, 'missing required argument: uri' if uri.nil?
353
- raise ArgumentError, 'missing required argument: procedure' if procedure.nil?
354
-
355
339
  segment = Transaction::ExternalRequestSegment.new library, uri, procedure, start_time
356
340
  start_and_add_segment segment, parent
357
341
 
@@ -377,21 +361,15 @@ module NewRelic
377
361
  end
378
362
 
379
363
  # For New Relic internal use only.
380
- def start_message_broker_segment(action: nil,
381
- library: nil,
382
- destination_type: nil,
383
- destination_name: nil,
364
+ def start_message_broker_segment(action:,
365
+ library:,
366
+ destination_type:,
367
+ destination_name:,
384
368
  headers: nil,
385
369
  parameters: nil,
386
370
  start_time: nil,
387
371
  parent: nil)
388
372
 
389
- # ruby 2.0.0 does not support required kwargs
390
- raise ArgumentError, 'missing required argument: action' if action.nil?
391
- raise ArgumentError, 'missing required argument: library' if library.nil?
392
- raise ArgumentError, 'missing required argument: destination_type' if destination_type.nil?
393
- raise ArgumentError, 'missing required argument: destination_name' if destination_name.nil?
394
-
395
373
  segment = Transaction::MessageBrokerSegment.new(
396
374
  action: action,
397
375
  library: library,
@@ -48,14 +48,14 @@ module NewRelic
48
48
  end
49
49
 
50
50
  def start
51
- @start_time ||= Time.now
51
+ @start_time ||= Process.clock_gettime(Process::CLOCK_REALTIME)
52
52
  return unless transaction
53
53
  parent.child_start self if parent
54
54
  end
55
55
 
56
56
  def finish
57
- @end_time = Time.now
58
- @duration = end_time.to_f - start_time.to_f
57
+ @end_time = Process.clock_gettime(Process::CLOCK_REALTIME)
58
+ @duration = end_time - start_time
59
59
  return unless transaction
60
60
  run_complete_callbacks
61
61
  finalize if record_on_finish?
@@ -52,19 +52,13 @@ module NewRelic
52
52
  :library,
53
53
  :headers
54
54
 
55
- def initialize action: nil,
56
- library: nil,
57
- destination_type: nil,
58
- destination_name: nil,
55
+ def initialize(action:,
56
+ library:,
57
+ destination_type:,
58
+ destination_name:,
59
59
  headers: nil,
60
60
  parameters: nil,
61
- start_time: nil
62
-
63
- # ruby 2.0.0 does not support required kwargs
64
- raise ArgumentError, 'missing required argument: action' if action.nil?
65
- raise ArgumentError, 'missing required argument: library' if library.nil?
66
- raise ArgumentError, 'missing required argument: destination_type' if destination_type.nil?
67
- raise ArgumentError, 'missing required argument: destination_name' if destination_name.nil?
61
+ start_time: nil)
68
62
 
69
63
  @action = action
70
64
  @library = library
@@ -119,28 +119,6 @@ module NewRelic
119
119
  "#{namer.prefix_for_category(self, category)}#{partial_name}"
120
120
  end
121
121
 
122
- def self.wrap(state, name, category, options = {})
123
- Deprecator.deprecate 'Transaction.wrap',
124
- 'Tracer#in_transaction'
125
-
126
- finishable = Tracer.start_transaction_or_segment(
127
- name: name,
128
- category: category,
129
- options: options
130
- )
131
-
132
- begin
133
- # We shouldn't raise from Transaction.start, but only wrap the yield
134
- # to be absolutely sure we don't report agent problems as app errors
135
- yield
136
- rescue => e
137
- Transaction.notice_error(e)
138
- raise e
139
- ensure
140
- finishable.finish if finishable
141
- end
142
- end
143
-
144
122
  def self.start_new_transaction(state, category, options)
145
123
  txn = Transaction.new(category, options)
146
124
  state.reset(txn)
@@ -246,9 +224,10 @@ module NewRelic
246
224
  @frozen_name = nil
247
225
 
248
226
  @category = category
249
- @start_time = Time.now
227
+ @start_time = Process.clock_gettime(Process::CLOCK_REALTIME)
250
228
  @end_time = nil
251
229
  @duration = nil
230
+
252
231
  @apdex_start = options[:apdex_start_time] || @start_time
253
232
  @jruby_cpu_start = jruby_cpu_time
254
233
  @process_cpu_start = process_cpu
@@ -416,7 +395,7 @@ module NewRelic
416
395
  def start
417
396
  return if !state.is_execution_traced?
418
397
 
419
- sql_sampler.on_start_transaction(state, start_time, request_path)
398
+ sql_sampler.on_start_transaction(state, request_path)
420
399
  NewRelic::Agent.instance.events.notify(:start_transaction)
421
400
  NewRelic::Agent::TransactionTimeAggregator.transaction_start(start_time)
422
401
 
@@ -505,8 +484,8 @@ module NewRelic
505
484
 
506
485
  def finish
507
486
  return unless state.is_execution_traced?
508
- @end_time = Time.now
509
- @duration = @end_time.to_f - @start_time.to_f
487
+ @end_time = Process.clock_gettime(Process::CLOCK_REALTIME)
488
+ @duration = @end_time - @start_time
510
489
  freeze_name_and_execute_if_not_ignored
511
490
 
512
491
  if nesting_max_depth == 1
@@ -623,7 +602,7 @@ module NewRelic
623
602
  def calculate_transport_duration distributed_trace_payload
624
603
  return unless distributed_trace_payload
625
604
 
626
- duration = (start_time.to_f * 1000 - distributed_trace_payload.timestamp) / 1000
605
+ duration = start_time - (distributed_trace_payload.timestamp / 1000.0)
627
606
  duration < 0 ? 0 : duration
628
607
  end
629
608
 
@@ -645,7 +624,7 @@ module NewRelic
645
624
  @payload = {
646
625
  :name => @frozen_name,
647
626
  :bucket => recording_web_transaction? ? :request : :background,
648
- :start_timestamp => start_time.to_f,
627
+ :start_timestamp => start_time,
649
628
  :duration => duration,
650
629
  :metrics => @metrics,
651
630
  :attributes => @attributes,
@@ -15,24 +15,24 @@ module NewRelic
15
15
  TransactionStats = Struct.new :transaction_started_at, :elapsed_transaction_time
16
16
 
17
17
  @lock = Mutex.new
18
- @harvest_cycle_started_at = Time.now
18
+ @harvest_cycle_started_at = Process.clock_gettime(Process::CLOCK_REALTIME)
19
19
 
20
20
  @stats = Hash.new do |h, k|
21
21
  h[k] = TransactionStats.new nil, 0.0
22
22
  end
23
23
 
24
- def reset!(timestamp = Time.now)
24
+ def reset!(timestamp = Process.clock_gettime(Process::CLOCK_REALTIME))
25
25
  @harvest_cycle_started_at = timestamp
26
26
  @stats.clear
27
27
  end
28
28
 
29
- def transaction_start(timestamp = Time.now)
29
+ def transaction_start(timestamp = Process.clock_gettime(Process::CLOCK_REALTIME))
30
30
  @lock.synchronize do
31
31
  set_transaction_start_time timestamp
32
32
  end
33
33
  end
34
34
 
35
- def transaction_stop(timestamp = Time.now, starting_thread_id = current_thread)
35
+ def transaction_stop(timestamp = Process.clock_gettime(Process::CLOCK_REALTIME), starting_thread_id = current_thread)
36
36
  @lock.synchronize do
37
37
  record_elapsed_transaction_time_until timestamp, starting_thread_id
38
38
  set_transaction_start_time nil, starting_thread_id
@@ -41,7 +41,7 @@ module NewRelic
41
41
 
42
42
  INSTANCE_BUSY_METRIC = 'Instance/Busy'.freeze
43
43
 
44
- def harvest!(timestamp = Time.now)
44
+ def harvest!(timestamp = Process.clock_gettime(Process::CLOCK_REALTIME))
45
45
  active_threads = 0
46
46
  result = @lock.synchronize do
47
47
  # Sum up the transaction times spent in each thread
@@ -12,7 +12,7 @@ module NewRelic
12
12
  :thread_count, :taken_at
13
13
 
14
14
  def initialize
15
- @taken_at = Time.now.to_f
15
+ @taken_at = Process.clock_gettime(Process::CLOCK_REALTIME)
16
16
  end
17
17
  end
18
18
  end
@@ -18,7 +18,7 @@ module NewRelic
18
18
  # or :limit (integer) for max number of iterations
19
19
  def initialize(opts={})
20
20
  @should_run = true
21
- @next_invocation_time = Time.now
21
+ @next_invocation_time = Process.clock_gettime(Process::CLOCK_REALTIME)
22
22
  @period = 60.0
23
23
  @duration = opts[:duration]
24
24
  @limit = opts[:limit]
@@ -34,7 +34,7 @@ module NewRelic
34
34
  @should_run = true
35
35
  @iterations = 0
36
36
 
37
- now = Time.now
37
+ now = Process.clock_gettime(Process::CLOCK_REALTIME)
38
38
  @deadline = now + @duration if @duration
39
39
  @next_invocation_time = (now + @period)
40
40
  end
@@ -53,11 +53,11 @@ module NewRelic
53
53
  end
54
54
 
55
55
  def schedule_next_invocation
56
- now = Time.now
56
+ now = Process.clock_gettime(Process::CLOCK_REALTIME)
57
57
  while @next_invocation_time <= now && @period > 0
58
58
  @next_invocation_time += @period
59
59
  end
60
- @next_invocation_time - Time.now
60
+ @next_invocation_time - Process.clock_gettime(Process::CLOCK_REALTIME)
61
61
  end
62
62
 
63
63
  # a simple accessor for @should_run
@@ -66,7 +66,7 @@ module NewRelic
66
66
  end
67
67
 
68
68
  def under_duration?
69
- !@deadline || Time.now < @deadline
69
+ !@deadline || Process.clock_gettime(Process::CLOCK_REALTIME) < @deadline
70
70
  end
71
71
 
72
72
  def under_limit?
@@ -139,20 +139,20 @@ module NewRelic
139
139
  # is initialized; these methods enable us to defer these calls
140
140
  # until we have started up and can process them.
141
141
  #
142
- def add_or_defer_method_tracer(receiver, method_name, metric_name_code, options)
142
+ def add_or_defer_method_tracer(receiver, method_name, metric_name, options)
143
143
  @tracer_lock.synchronize do
144
144
  if @agent
145
- receiver.send(:_add_method_tracer_now, method_name, metric_name_code, options)
145
+ receiver.send(:_nr_add_method_tracer_now, method_name, metric_name, options)
146
146
  else
147
- @tracer_queue << [receiver, method_name, metric_name_code, options]
147
+ @tracer_queue << [receiver, method_name, metric_name, options]
148
148
  end
149
149
  end
150
150
  end
151
151
 
152
152
  def add_deferred_method_tracers_now
153
153
  @tracer_lock.synchronize do
154
- @tracer_queue.each do |receiver, method_name, metric_name_code, options|
155
- receiver.send(:_add_method_tracer_now, method_name, metric_name_code, options)
154
+ @tracer_queue.each do |receiver, method_name, metric_name, options|
155
+ receiver.send(:_nr_add_method_tracer_now, method_name, metric_name, options)
156
156
  end
157
157
 
158
158
  @tracer_queue = []
@@ -10,7 +10,7 @@ require 'net/http'
10
10
  require 'new_relic/agent/hostname'
11
11
 
12
12
  # We need to use the Control object but we don't want to load
13
- # the rails/merb environment. The defined? clause is so that
13
+ # the rails environment. The defined? clause is so that
14
14
  # it won't load it twice, something it does when run inside a test
15
15
  require 'new_relic/control' unless defined? NewRelic::Control
16
16
 
@@ -117,7 +117,7 @@ class NewRelic::Cli::Deployments < NewRelic::Cli::Command
117
117
  "Set the application name.",
118
118
  "Default is app_name setting in newrelic.yml") { | e | @appname = e }
119
119
  o.on("-e", "--environment=name", String,
120
- "Override the (RAILS|MERB|RUBY|RACK)_ENV setting",
120
+ "Override the (RAILS|RUBY|RACK)_ENV setting",
121
121
  "currently: #{control.env}") { | e | @environment = e }
122
122
  o.on("-u", "--user=USER", String,
123
123
  "Specify the user deploying, for information only",
@@ -28,10 +28,6 @@ module NewRelic
28
28
  TRACEPARENT_KEY = "traceparent"
29
29
  TRACESTATE_KEY = "tracestate"
30
30
 
31
- # Right now, old and new Rubies are the same. Intention is to use "(...)" for
32
- # Ruby 2.7+ for argument delegation, but doing so is a breaking API change.
33
- ARGS_FOR_RUBY_VERSION = RUBY_VERSION < "2.7.0" ? "*args, &block" : "*args, &block"
34
-
35
31
  HTTP_TRACEPARENT_KEY = "HTTP_#{TRACEPARENT_KEY.upcase}"
36
32
  HTTP_TRACESTATE_KEY = "HTTP_#{TRACESTATE_KEY.upcase}"
37
33
  HTTP_NEWRELIC_KEY = "HTTP_#{NEWRELIC_KEY.upcase}"
@@ -33,7 +33,7 @@ class NewRelic::NoticedError
33
33
  ERROR_CLASS_KEY = "#{ERROR_PREFIX_KEY}.class"
34
34
  ERROR_EXPECTED_KEY = "#{ERROR_PREFIX_KEY}.expected"
35
35
 
36
- def initialize(path, exception, timestamp = Time.now, expected = false)
36
+ def initialize(path, exception, timestamp = Process.clock_gettime(Process::CLOCK_REALTIME), expected = false)
37
37
  @exception_id = exception.object_id
38
38
  @path = path
39
39
 
@@ -139,7 +139,7 @@ class NewRelic::NoticedError
139
139
  ERROR_MESSAGE_KEY => string(message),
140
140
  ERROR_CLASS_KEY => string(exception_class_name)
141
141
  })
142
-
142
+
143
143
  @attributes_from_notice_error[ERROR_EXPECTED_KEY] = true if expected
144
144
  end
145
145
 
@@ -10,8 +10,8 @@ module NewRelic
10
10
  parts.compact.join('.')
11
11
  end
12
12
 
13
- MAJOR = 7
14
- MINOR = 2
13
+ MAJOR = 8
14
+ MINOR = 0
15
15
  TINY = 0
16
16
 
17
17
  begin
data/lib/newrelic_rpm.rb CHANGED
@@ -6,48 +6,24 @@
6
6
  #
7
7
  # When installed as a gem, you can activate the New Relic agent one of the following ways:
8
8
  #
9
- # For Rails, add:
10
- # config.gem 'newrelic_rpm'
11
- # to your initialization sequence.
9
+ # For applications using Bundler, add this to the Gemfile:
10
+ # gem 'newrelic_rpm'
12
11
  #
13
- # For merb, do
14
- # dependency 'newrelic_rpm'
15
- # in the Merb config/init.rb
12
+ # You will also need to install the newrelic.yml configuration file
16
13
  #
17
- # For Sinatra, do
18
- # require 'newrelic_rpm'
19
- # after requiring 'sinatra'.
20
- #
21
- # For other frameworks, or to manage the agent manually, invoke NewRelic::Agent#manual_start
22
- # directly.
14
+ # For applications not using Bundler, and for other installation information, visit:
15
+ # https://docs.newrelic.com/docs/agents/ruby-agent/installation/install-new-relic-ruby-agent/
23
16
  #
24
17
 
25
18
  require 'new_relic/control'
26
- if defined?(Merb) && defined?(Merb::BootLoader)
27
- module NewRelic
28
- class MerbBootLoader < Merb::BootLoader
29
- after Merb::BootLoader::ChooseAdapter
30
- def self.run
31
- NewRelic::Control.instance.init_plugin
32
- end
33
- end
34
- end
35
- elsif defined?(Rails::VERSION)
36
- if Rails::VERSION::MAJOR.to_i >= 3
37
- module NewRelic
38
- class Railtie < Rails::Railtie
39
19
 
40
- initializer "newrelic_rpm.start_plugin", before: :load_config_initializers do |app|
41
- NewRelic::Control.instance.init_plugin(:config => app.config)
42
- end
20
+ if defined?(Rails::VERSION)
21
+ module NewRelic
22
+ class Railtie < Rails::Railtie
23
+ initializer "newrelic_rpm.start_plugin", before: :load_config_initializers do |app|
24
+ NewRelic::Control.instance.init_plugin(config: app.config)
43
25
  end
44
26
  end
45
- else
46
- # After version 2.0 of Rails we can access the configuration directly.
47
- # We need it to add dev mode routes after initialization finished.
48
- config = nil
49
- config = Rails.configuration if Rails.respond_to?(:configuration)
50
- NewRelic::Control.instance.init_plugin :config => config
51
27
  end
52
28
  else
53
29
  NewRelic::Control.instance.init_plugin
data/lib/tasks/all.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  # This file is distributed under New Relic's license terms.
3
3
  # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
4
4
 
5
- # This is required to load in task definitions from merb
5
+ # This is required to load in task definitions
6
6
  Dir.glob(File.join(File.dirname(__FILE__),'*.rake')) do |file|
7
7
  load file
8
8
  end