newrelic_rpm 8.6.0 → 8.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +83 -3
  3. data/README.md +1 -1
  4. data/Rakefile +1 -1
  5. data/docker-compose.yml +1 -1
  6. data/lib/new_relic/agent/agent.rb +5 -2
  7. data/lib/new_relic/agent/autostart.rb +13 -10
  8. data/lib/new_relic/agent/configuration/default_source.rb +144 -42
  9. data/lib/new_relic/agent/configuration/environment_source.rb +2 -0
  10. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +2 -2
  11. data/lib/new_relic/agent/instrumentation/active_merchant.rb +14 -0
  12. data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +10 -0
  13. data/lib/new_relic/agent/instrumentation/authlogic.rb +10 -0
  14. data/lib/new_relic/agent/instrumentation/data_mapper.rb +12 -0
  15. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +19 -0
  16. data/lib/new_relic/agent/instrumentation/rack/helpers.rb +2 -0
  17. data/lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb +11 -0
  18. data/lib/new_relic/agent/instrumentation/sidekiq.rb +15 -0
  19. data/lib/new_relic/agent/instrumentation/sinatra.rb +21 -11
  20. data/lib/new_relic/agent/instrumentation/sunspot.rb +10 -0
  21. data/lib/new_relic/agent/instrumentation/thread/chain.rb +24 -0
  22. data/lib/new_relic/agent/instrumentation/thread/instrumentation.rb +27 -0
  23. data/lib/new_relic/agent/instrumentation/thread/prepend.rb +22 -0
  24. data/lib/new_relic/agent/instrumentation/thread.rb +20 -0
  25. data/lib/new_relic/agent/pipe_service.rb +1 -2
  26. data/lib/new_relic/agent/stats.rb +48 -23
  27. data/lib/new_relic/agent/tracer.rb +14 -1
  28. data/lib/new_relic/agent/transaction/abstract_segment.rb +2 -1
  29. data/lib/new_relic/agent/transaction/tracing.rb +8 -3
  30. data/lib/new_relic/agent/transaction.rb +24 -4
  31. data/lib/new_relic/agent/transaction_error_primitive.rb +2 -0
  32. data/lib/new_relic/agent/transaction_metrics.rb +5 -4
  33. data/lib/new_relic/agent/vm/mri_vm.rb +13 -1
  34. data/lib/new_relic/control/instrumentation.rb +31 -0
  35. data/lib/new_relic/dependency_detection.rb +1 -1
  36. data/lib/new_relic/language_support.rb +17 -0
  37. data/lib/new_relic/local_environment.rb +2 -0
  38. data/lib/new_relic/supportability_helper.rb +1 -0
  39. data/lib/new_relic/traced_thread.rb +36 -0
  40. data/lib/new_relic/version.rb +1 -1
  41. data/lib/tasks/config.rake +11 -3
  42. data/newrelic.yml +12 -1
  43. data/newrelic_rpm.gemspec +5 -2
  44. metadata +12 -3
@@ -76,6 +76,7 @@ module NewRelic
76
76
  rainbows
77
77
  unicorn
78
78
  ]
79
+ # TODO: MAJOR VERSION - remove rainbows
79
80
  while dispatchers.any? && @discovered_dispatcher.nil?
80
81
  send 'check_for_' + (dispatchers.shift)
81
82
  end
@@ -127,6 +128,7 @@ module NewRelic
127
128
  end
128
129
  end
129
130
 
131
+ # TODO: MAJOR VERSION - remove this method
130
132
  def check_for_rainbows
131
133
  if (defined?(::Rainbows) && defined?(::Rainbows::HttpServer)) && NewRelic::LanguageSupport.object_space_usable?
132
134
  v = find_class_in_object_space(::Rainbows::HttpServer)
@@ -50,6 +50,7 @@ module NewRelic
50
50
  :shutdown,
51
51
  :start_segment,
52
52
  :trace,
53
+ :traced_thread,
53
54
  :trace_execution_scoped,
54
55
  :trace_execution_unscoped,
55
56
  :wrap
@@ -0,0 +1,36 @@
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
+ # frozen_string_literal: true
5
+
6
+ module NewRelic
7
+ #
8
+ # This class allows the current transaction to be passed to a Thread so that nested segments can be created from the operations performed within the Thread's block.
9
+ # To have the New Relic Ruby agent automatically trace all of your applications threads,
10
+ # enable the `instrumentation.thread.tracing` configuration option in your newrelic.yml.
11
+ #
12
+ # Note: disabling the configuration option `instrumentation.thread` while using this class can cause incorrectly nested spans.
13
+ #
14
+ # @api public
15
+ class TracedThread < Thread
16
+ #
17
+ # Creates a new Thread whose work will be traced by New Relic.
18
+ # Use this class as a replacement for the native Thread class.
19
+ # Example: Instead of using `Thread.new`, use:
20
+ # ```ruby
21
+ # NewRelic::TracedThread.new { execute_some_code }
22
+ # ```
23
+ #
24
+ # @api public
25
+ def initialize(*args, &block)
26
+ NewRelic::Agent.record_api_supportability_metric(:traced_thread)
27
+ traced_block = create_traced_block(*args, &block)
28
+ super(*args, &traced_block)
29
+ end
30
+
31
+ def create_traced_block(*args, &block)
32
+ return block if NewRelic::Agent.config[:'instrumentation.thread.tracing'] # if this is on, don't double trace
33
+ NewRelic::Agent::Tracer.thread_block_with_current_transaction(*args, &block)
34
+ end
35
+ end
36
+ end
@@ -6,7 +6,7 @@
6
6
  module NewRelic
7
7
  module VERSION # :nodoc:
8
8
  MAJOR = 8
9
- MINOR = 6
9
+ MINOR = 7
10
10
  TINY = 0
11
11
 
12
12
  STRING = "#{MAJOR}.#{MINOR}.#{TINY}"
@@ -6,18 +6,22 @@ namespace :newrelic do
6
6
  DISABLING = "disabling"
7
7
  ATTRIBUTES = "attributes"
8
8
 
9
+ # these configuration options are not able to be set using environment variables
10
+ NON_ENV_CONFIGS = ['error_collector.ignore_classes', 'error_collector.ignore_messages', 'error_collector.expected_classes', 'error_collector.expected_messages']
11
+
9
12
  SECTION_DESCRIPTIONS = {
10
13
  GENERAL => 'These settings are available for agent configuration. Some settings depend on your New Relic subscription level.',
11
14
  DISABLING => 'Use these settings to toggle instrumentation types during agent startup.',
12
15
  ATTRIBUTES => '[Attributes](/docs/features/agent-attributes) are key-value pairs containing information that determines the properties of an event or transaction. These key-value pairs can be viewed within transaction traces in APM, traced errors in APM, transaction events in dashboards, and page views in dashboards. You can customize exactly which attributes will be sent to each of these destinations',
13
16
  "transaction_tracer" => 'The [transaction traces](/docs/apm/traces/transaction-traces/transaction-traces) feature collects detailed information from a selection of transactions, including a summary of the calling sequence, a breakdown of time spent, and a list of SQL queries and their query plans (on mysql and postgresql). Available features depend on your New Relic subscription level.',
14
- "error_collector" => 'The agent collects and reports all uncaught exceptions by default. These configuration options allow you to customize the error collection.\nFor information on ignored and expected errors, [see this page on Error Analytics in APM](/docs/agents/manage-apm-agents/agent-data/manage-errors-apm-collect-ignore-or-mark-expected/). To set expected errors via the `NewRelic::Agent.notice_error` Ruby method, [consult the Ruby Agent API](/docs/agents/ruby-agent/api-guides/sending-handled-errors-new-relic/).',
17
+ "error_collector" => "The agent collects and reports all uncaught exceptions by default. These configuration options allow you to customize the error collection.\n\nFor information on ignored and expected errors, [see this page on Error Analytics in APM](/docs/agents/manage-apm-agents/agent-data/manage-errors-apm-collect-ignore-or-mark-expected/). To set expected errors via the `NewRelic::Agent.notice_error` Ruby method, [consult the Ruby Agent API](/docs/agents/ruby-agent/api-guides/sending-handled-errors-new-relic/).",
15
18
  "browser_monitoring" => "The browser monitoring [page load timing](/docs/browser/new-relic-browser/page-load-timing/page-load-timing-process) feature (sometimes referred to as real user monitoring or RUM) gives you insight into the performance real users are experiencing with your website. This is accomplished by measuring the time it takes for your users' browsers to download and render your web pages by injecting a small amount of JavaScript code into the header and footer of each page.",
16
19
  "analytics_events" => '[New Relic dashboards](/docs/query-your-data/explore-query-data/dashboards/introduction-new-relic-one-dashboards) is a resource to gather and visualize data about your software and what it says about your business. With it you can quickly and easily create real-time dashboards to get immediate answers about end-user experiences, clickstreams, mobile activities, and server transactions.'
17
20
  }
18
21
 
19
22
  NAME_OVERRIDES = {
20
- "slow_sql" => "Slow SQL"
23
+ "slow_sql" => "Slow SQL",
24
+ "custom_insights_events" => "Custom Events"
21
25
  }
22
26
 
23
27
  def output(format)
@@ -39,7 +43,7 @@ namespace :newrelic do
39
43
 
40
44
  if key.match(/^disable_/) # "disable_httpclient"
41
45
  section_key = DISABLING
42
- elsif components.length == 2 # "analytics_events.enabled"
46
+ elsif components.length >= 2 && !(components[1] == "attributes") # "analytics_events.enabled"
43
47
  section_key = components.first
44
48
  elsif components[1] == "attributes" # "transaction_tracer.attributes.enabled"
45
49
  section_key = ATTRIBUTES
@@ -63,6 +67,8 @@ namespace :newrelic do
63
67
  sections << pluck("error_collector", config_hash)
64
68
  sections << pluck("browser_monitoring", config_hash)
65
69
  sections << pluck("analytics_events", config_hash)
70
+ sections << pluck("transaction_events", config_hash)
71
+ sections << pluck("application_logging", config_hash)
66
72
  sections.concat(config_hash.to_a.sort_by { |a| a.first })
67
73
 
68
74
  add_data_to_sections(sections)
@@ -103,6 +109,7 @@ namespace :newrelic do
103
109
  end
104
110
 
105
111
  def format_default_value(spec)
112
+ return spec[:documentation_default] if !spec[:documentation_default].nil?
106
113
  if spec[:default].is_a?(Proc)
107
114
  '(Dynamic)'
108
115
  else
@@ -111,6 +118,7 @@ namespace :newrelic do
111
118
  end
112
119
 
113
120
  def format_env_var(key)
121
+ return "None" if NON_ENV_CONFIGS.include? key
114
122
  "NEW_RELIC_#{key.gsub(".", "_").upcase}"
115
123
  end
116
124
 
data/newrelic.yml CHANGED
@@ -31,7 +31,7 @@ common: &default_settings
31
31
  # application_logging.enabled: true
32
32
 
33
33
  # If `true`, the agent captures log records emitted by this application.
34
- # application_logging.forwarding.enabled: false
34
+ # application_logging.forwarding.enabled: true
35
35
 
36
36
  # Defines the maximum number of log records to buffer in memory at a time.
37
37
  # application_logging.forwarding.max_samples_stored: 10000
@@ -395,6 +395,13 @@ common: &default_settings
395
395
  # May be one of [auto|prepend|chain|disabled].
396
396
  # instrumentation.typhoeus: auto
397
397
 
398
+ # Controls auto-instrumentation of the Thread class at start up to allow the agent to correctly nest spans inside of an asyncronous transaction.
399
+ # May be one of [auto|prepend|chain|disabled].
400
+ # instrumentation.thread: auto
401
+
402
+ # Controls auto-instrumentation of the Thread class at start up to automatically add tracing to all Threads created in the application.
403
+ # instrumentation.thread.tracing: false
404
+
398
405
  # A dictionary of label names and values that will be applied to the data sent
399
406
  # from this agent. May also be expressed asa semicolon-delimited ; string of
400
407
  # colon-separated : pairs.
@@ -452,6 +459,10 @@ common: &default_settings
452
459
  # rake.connect_timeout: 10
453
460
 
454
461
  # Specify an array of Rake tasks to automatically instrument.
462
+ # This configuration option converts the Array to a RegEx list.
463
+ # If you'd like to allow all tasks by default, use `rake.tasks: [.+]`.
464
+ # Rake tasks will not be instrumented unless they're added to this list.
465
+ # For more information, visit the (New Relic Rake Instrumentation docs)[/docs/apm/agents/ruby-agent/background-jobs/rake-instrumentation].
455
466
  # rake.tasks: []
456
467
 
457
468
  # Define transactions you want the agent to ignore, by specifying a list of
data/newrelic_rpm.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.version = NewRelic::VERSION::STRING
11
11
  s.required_ruby_version = '>= 2.2.0'
12
12
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
13
- s.authors = ["Tanna McClure", "Kayla Reopelle", "James Bunch"]
13
+ s.authors = ["Tanna McClure", "Kayla Reopelle", "James Bunch", "Hannah Ramadan"]
14
14
  s.licenses = ['Apache-2.0']
15
15
  s.description = <<-EOS
16
16
  New Relic is a performance management system, developed by New Relic,
@@ -47,7 +47,10 @@ https://github.com/newrelic/newrelic-ruby-agent/
47
47
  s.require_paths = ["lib"]
48
48
  s.rubygems_version = Gem::VERSION
49
49
  s.summary = "New Relic Ruby Agent"
50
-
50
+ s.post_install_message = 'Thanks for installing the latest version of newrelic_rpm. '\
51
+ 'This version turns on application log forwarding by default. If you want to turn ' \
52
+ 'off this feature, set `application_logging.forwarding.enabled: false`. ' \
53
+ 'For more information, visit: https://docs.newrelic.com/docs/logs/logs-context/configure-logs-context-ruby'
51
54
  s.add_development_dependency 'rake', '12.3.3'
52
55
  s.add_development_dependency 'rb-inotify', '0.9.10' # locked to support < Ruby 2.3 (and listen 3.0.8)
53
56
  s.add_development_dependency 'listen', '3.0.8' # locked to support < Ruby 2.3
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: 8.6.0
4
+ version: 8.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tanna McClure
8
8
  - Kayla Reopelle
9
9
  - James Bunch
10
+ - Hannah Ramadan
10
11
  autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
- date: 2022-04-04 00:00:00.000000000 Z
14
+ date: 2022-05-03 00:00:00.000000000 Z
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: rake
@@ -448,6 +449,10 @@ files:
448
449
  - lib/new_relic/agent/instrumentation/sinatra/prepend.rb
449
450
  - lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb
450
451
  - lib/new_relic/agent/instrumentation/sunspot.rb
452
+ - lib/new_relic/agent/instrumentation/thread.rb
453
+ - lib/new_relic/agent/instrumentation/thread/chain.rb
454
+ - lib/new_relic/agent/instrumentation/thread/instrumentation.rb
455
+ - lib/new_relic/agent/instrumentation/thread/prepend.rb
451
456
  - lib/new_relic/agent/instrumentation/tilt.rb
452
457
  - lib/new_relic/agent/instrumentation/tilt/chain.rb
453
458
  - lib/new_relic/agent/instrumentation/tilt/instrumentation.rb
@@ -586,6 +591,7 @@ files:
586
591
  - lib/new_relic/recipes/capistrano3.rb
587
592
  - lib/new_relic/recipes/capistrano_legacy.rb
588
593
  - lib/new_relic/supportability_helper.rb
594
+ - lib/new_relic/traced_thread.rb
589
595
  - lib/new_relic/version.rb
590
596
  - lib/newrelic_rpm.rb
591
597
  - lib/sequel/extensions/newrelic_instrumentation.rb
@@ -612,7 +618,10 @@ metadata:
612
618
  documentation_uri: https://docs.newrelic.com/docs/agents/ruby-agent
613
619
  source_code_uri: https://github.com/newrelic/newrelic-ruby-agent
614
620
  homepage_uri: https://newrelic.com/ruby
615
- post_install_message:
621
+ post_install_message: 'Thanks for installing the latest version of newrelic_rpm. This
622
+ version turns on application log forwarding by default. If you want to turn off
623
+ this feature, set `application_logging.forwarding.enabled: false`. For more information,
624
+ visit: https://docs.newrelic.com/docs/logs/logs-context/configure-logs-context-ruby'
616
625
  rdoc_options: []
617
626
  require_paths:
618
627
  - lib