newrelic_rpm 9.5.0 → 9.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +154 -7
  3. data/CONTRIBUTING.md +0 -7
  4. data/README.md +1 -1
  5. data/Rakefile +1 -1
  6. data/bin/newrelic +2 -9
  7. data/bin/newrelic_rpm +15 -0
  8. data/init.rb +2 -2
  9. data/lib/new_relic/agent/agent.rb +1 -1
  10. data/lib/new_relic/agent/agent_helpers/shutdown.rb +1 -1
  11. data/lib/new_relic/agent/agent_helpers/special_startup.rb +1 -1
  12. data/lib/new_relic/agent/agent_helpers/start_worker_thread.rb +2 -2
  13. data/lib/new_relic/agent/agent_helpers/startup.rb +2 -2
  14. data/lib/new_relic/agent/attribute_filter.rb +3 -3
  15. data/lib/new_relic/agent/configuration/default_source.rb +131 -36
  16. data/lib/new_relic/agent/configuration/high_security_source.rb +1 -0
  17. data/lib/new_relic/agent/configuration/manager.rb +13 -9
  18. data/lib/new_relic/agent/configuration/security_policy_source.rb +11 -0
  19. data/lib/new_relic/agent/custom_event_aggregator.rb +27 -1
  20. data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +1 -1
  21. data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +3 -3
  22. data/lib/new_relic/agent/error_collector.rb +2 -0
  23. data/lib/new_relic/agent/event_loop.rb +1 -1
  24. data/lib/new_relic/agent/http_clients/abstract.rb +4 -0
  25. data/lib/new_relic/agent/http_clients/async_http_wrappers.rb +80 -0
  26. data/lib/new_relic/agent/http_clients/curb_wrappers.rb +1 -3
  27. data/lib/new_relic/agent/http_clients/ethon_wrappers.rb +109 -0
  28. data/lib/new_relic/agent/http_clients/excon_wrappers.rb +0 -3
  29. data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +1 -3
  30. data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +0 -3
  31. data/lib/new_relic/agent/http_clients/httpx_wrappers.rb +91 -0
  32. data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +1 -4
  33. data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +0 -3
  34. data/lib/new_relic/agent/instrumentation/active_merchant.rb +1 -1
  35. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +1 -2
  36. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger/chain.rb +69 -0
  37. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger/instrumentation.rb +17 -0
  38. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger/prepend.rb +37 -0
  39. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger.rb +23 -0
  40. data/lib/new_relic/agent/instrumentation/active_support_logger.rb +3 -1
  41. data/lib/new_relic/agent/instrumentation/async_http/chain.rb +23 -0
  42. data/lib/new_relic/agent/instrumentation/async_http/instrumentation.rb +37 -0
  43. data/lib/new_relic/agent/instrumentation/async_http/prepend.rb +15 -0
  44. data/lib/new_relic/agent/instrumentation/async_http.rb +28 -0
  45. data/lib/new_relic/agent/instrumentation/concurrent_ruby.rb +1 -0
  46. data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +1 -1
  47. data/lib/new_relic/agent/instrumentation/ethon/chain.rb +39 -0
  48. data/lib/new_relic/agent/instrumentation/ethon/instrumentation.rb +105 -0
  49. data/lib/new_relic/agent/instrumentation/ethon/prepend.rb +35 -0
  50. data/lib/new_relic/agent/instrumentation/ethon.rb +39 -0
  51. data/lib/new_relic/agent/instrumentation/fiber/instrumentation.rb +1 -4
  52. data/lib/new_relic/agent/instrumentation/grpc_server.rb +1 -1
  53. data/lib/new_relic/agent/instrumentation/httpx/chain.rb +20 -0
  54. data/lib/new_relic/agent/instrumentation/httpx/instrumentation.rb +51 -0
  55. data/lib/new_relic/agent/instrumentation/httpx/prepend.rb +15 -0
  56. data/lib/new_relic/agent/instrumentation/httpx.rb +27 -0
  57. data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +1 -3
  58. data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +7 -1
  59. data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +1 -0
  60. data/lib/new_relic/agent/instrumentation/roda/ignorer.rb +45 -0
  61. data/lib/new_relic/agent/instrumentation/roda/instrumentation.rb +12 -0
  62. data/lib/new_relic/agent/instrumentation/roda/roda_transaction_namer.rb +1 -2
  63. data/lib/new_relic/agent/instrumentation/roda.rb +2 -0
  64. data/lib/new_relic/agent/instrumentation/ruby_openai/chain.rb +36 -0
  65. data/lib/new_relic/agent/instrumentation/ruby_openai/instrumentation.rb +197 -0
  66. data/lib/new_relic/agent/instrumentation/ruby_openai/prepend.rb +20 -0
  67. data/lib/new_relic/agent/instrumentation/ruby_openai.rb +35 -0
  68. data/lib/new_relic/agent/instrumentation/sidekiq.rb +3 -1
  69. data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +1 -1
  70. data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +1 -3
  71. data/lib/new_relic/agent/instrumentation/sinatra.rb +1 -1
  72. data/lib/new_relic/agent/instrumentation/thread/instrumentation.rb +1 -4
  73. data/lib/new_relic/agent/instrumentation/view_component/chain.rb +21 -0
  74. data/lib/new_relic/agent/instrumentation/view_component/instrumentation.rb +39 -0
  75. data/lib/new_relic/agent/instrumentation/view_component/prepend.rb +13 -0
  76. data/lib/new_relic/agent/instrumentation/view_component.rb +26 -0
  77. data/lib/new_relic/agent/javascript_instrumentor.rb +0 -1
  78. data/lib/new_relic/agent/llm/chat_completion_message.rb +25 -0
  79. data/lib/new_relic/agent/llm/chat_completion_summary.rb +66 -0
  80. data/lib/new_relic/agent/llm/embedding.rb +60 -0
  81. data/lib/new_relic/agent/llm/llm_event.rb +95 -0
  82. data/lib/new_relic/agent/llm/response_headers.rb +80 -0
  83. data/lib/new_relic/agent/llm.rb +49 -0
  84. data/lib/new_relic/agent/messaging.rb +2 -2
  85. data/lib/new_relic/agent/monitors/synthetics_monitor.rb +12 -1
  86. data/lib/new_relic/agent/new_relic_service/encoders.rb +2 -2
  87. data/lib/new_relic/agent/new_relic_service.rb +8 -6
  88. data/lib/new_relic/agent/obfuscator.rb +0 -2
  89. data/lib/new_relic/agent/pipe_channel_manager.rb +2 -2
  90. data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +1 -2
  91. data/lib/new_relic/agent/rules_engine.rb +1 -1
  92. data/lib/new_relic/agent/span_event_primitive.rb +16 -4
  93. data/lib/new_relic/agent/sql_sampler.rb +0 -1
  94. data/lib/new_relic/agent/system_info.rb +26 -0
  95. data/lib/new_relic/agent/threading/agent_thread.rb +1 -2
  96. data/lib/new_relic/agent/tracer.rb +9 -10
  97. data/lib/new_relic/agent/transaction/abstract_segment.rb +4 -1
  98. data/lib/new_relic/agent/transaction/external_request_segment.rb +5 -2
  99. data/lib/new_relic/agent/transaction/message_broker_segment.rb +1 -2
  100. data/lib/new_relic/agent/transaction/request_attributes.rb +1 -3
  101. data/lib/new_relic/agent/transaction/tracing.rb +11 -1
  102. data/lib/new_relic/agent/transaction.rb +25 -2
  103. data/lib/new_relic/agent/transaction_error_primitive.rb +16 -0
  104. data/lib/new_relic/agent/transaction_event_primitive.rb +19 -0
  105. data/lib/new_relic/agent/utilization/gcp.rb +1 -3
  106. data/lib/new_relic/agent/vm/{mri_vm.rb → c_ruby_vm.rb} +7 -15
  107. data/lib/new_relic/agent/vm.rb +2 -2
  108. data/lib/new_relic/agent/worker_loop.rb +1 -1
  109. data/lib/new_relic/agent.rb +102 -7
  110. data/lib/new_relic/base64.rb +25 -0
  111. data/lib/new_relic/cli/command.rb +6 -4
  112. data/lib/new_relic/constants.rb +5 -0
  113. data/lib/new_relic/control/frameworks/rails.rb +17 -5
  114. data/lib/new_relic/control/instrumentation.rb +1 -1
  115. data/lib/new_relic/language_support.rb +4 -0
  116. data/lib/new_relic/local_environment.rb +22 -13
  117. data/lib/new_relic/rack/browser_monitoring.rb +8 -4
  118. data/lib/new_relic/supportability_helper.rb +3 -1
  119. data/lib/new_relic/thread_local_storage.rb +31 -0
  120. data/lib/new_relic/version.rb +1 -1
  121. data/lib/tasks/config.rake +1 -1
  122. data/lib/tasks/helpers/config.html.erb +6 -6
  123. data/lib/tasks/helpers/newrelicyml.rb +1 -1
  124. data/lib/tasks/instrumentation_generator/instrumentation.thor +3 -3
  125. data/lib/tasks/instrumentation_generator/templates/chain.tt +0 -1
  126. data/lib/tasks/instrumentation_generator/templates/chain_method.tt +0 -1
  127. data/lib/tasks/tests.rake +71 -0
  128. data/newrelic.yml +76 -36
  129. data/newrelic_rpm.gemspec +5 -4
  130. data/test/agent_helper.rb +14 -2
  131. metadata +43 -7
  132. data/bin/newrelic_cmd +0 -7
@@ -14,7 +14,7 @@ redirects:
14
14
 
15
15
  <CONTRIBUTOR_NOTE>
16
16
  This file is automatically generated from values defined in `lib/new_relic/agent/configuration/default_source.rb`.
17
- All changes should be made directly to `default_source.rb.`
17
+ Make all changes directly to `default_source.rb.`
18
18
  Submit PRs or raise issues at: https://github.com/newrelic/newrelic-ruby-agent
19
19
  </CONTRIBUTOR_NOTE>
20
20
 
@@ -42,9 +42,9 @@ In other words, environment variables override all other configuration settings
42
42
 
43
43
  ## View and edit config file options [#Edit]
44
44
 
45
- The Ruby agent's `newrelic.yml` is a standard YAML configuration file. It typically includes a `Defaults` section at the top, plus sections below for each application environment; for example, `Development`, `Testing`, and `Production`.
45
+ The Ruby agent's `newrelic.yml` is a standard YAML configuration file. It typically includes a `Defaults` section at the top, plus sections below for each application environment (`Development`, `Test`, `Staging`, and `Production`).
46
46
 
47
- The Ruby agent determines which section of the `newrelic.yml` config file to read from by looking at certain environment variables to derive the application's environment. This can be useful, for example, when you want to use `info` for the `log_level` config setting in your production environment, and you want more verbose `log_level` config settings (such as `debug` in your development environment.
47
+ The Ruby agent determines which section of the `newrelic.yml` config file to read from by looking at certain environment variables to derive the application's environment. This can be useful when you want to use `info` for the `log_level` config setting in your production environment, and you want more verbose `log_level` config settings (such as `debug`) in your development environment.
48
48
 
49
49
  Here is an example `newrelic.yml` config file:
50
50
 
@@ -60,7 +60,7 @@ development:
60
60
  log_level: debug
61
61
  ```
62
62
 
63
- For non-Rails apps, the Ruby agent looks for the following environment variables, in this order, to determine the application environment:
63
+ The Ruby agent looks for the following environment variables, in this order, to find the application environment:
64
64
 
65
65
  1. `NEW_RELIC_ENV`
66
66
  2. `RUBY_ENV`
@@ -68,9 +68,9 @@ For non-Rails apps, the Ruby agent looks for the following environment variables
68
68
  4. `APP_ENV`
69
69
  5. `RACK_ENV`
70
70
 
71
- If the Ruby agent does not detect values for any of those environment variables, it will default the application environment to `development` and read from the `development` section of the `newrelic.yml` config file.
71
+ If the Ruby agent doesn't detect values for any of those environment variables, it will default the application environment to `development` and read from the `development` section of the `newrelic.yml` config file.
72
72
 
73
- When running the Ruby agent in a Rails app, the agent first looks for the `NEW_RELIC_ENV` environment variable to determine the application environment and which section of the `newrelic.yml` to use. If `NEW_RELIC_ENV` is not present, the agent uses the Rails environment (`RAILS_ENV` or `RAILS.env`, depending on the version of Rails) .
73
+ When running the Ruby agent in a Rails app, the agent first looks for the `NEW_RELIC_ENV` environment variable to determine the application environment and which section of the `newrelic.yml` to use. If `NEW_RELIC_ENV` is not present, the agent uses the Rails environment (`RAILS_ENV`).
74
74
 
75
75
  When you edit the config file, be sure to:
76
76
 
@@ -16,7 +16,7 @@ module NewRelicYML
16
16
 
17
17
  HEADER = <<~HEADER
18
18
  #
19
- # This file configures the New Relic Agent. New Relic monitors Ruby, Java,
19
+ # This file configures the New Relic agent. New Relic monitors Ruby, Java,
20
20
  # .NET, PHP, Python, Node, and Go applications with deep visibility and low
21
21
  # overhead. For more information, visit www.newrelic.com.
22
22
 
@@ -82,7 +82,7 @@ class Instrumentation < Thor
82
82
  insert_into_file(
83
83
  DEFAULT_SOURCE_LOCATION,
84
84
  config_block(name.downcase),
85
- after: ":description => 'Controls auto-instrumentation of bunny at start up. May be one of [auto|prepend|chain|disabled].'
85
+ after: ":description => 'Controls auto-instrumentation of bunny at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
86
86
  },\n"
87
87
  )
88
88
  end
@@ -103,7 +103,7 @@ class Instrumentation < Thor
103
103
  :type => String,
104
104
  :dynamic_name => true,
105
105
  :allowed_from_server => false,
106
- :description => 'Controls auto-instrumentation of the #{name} library at start up. May be one of [auto|prepend|chain|disabled].'
106
+ :description => 'Controls auto-instrumentation of the #{name} library at start-up. May be one of [auto|prepend|chain|disabled].'
107
107
  },
108
108
  CONFIG
109
109
  end
@@ -111,7 +111,7 @@ class Instrumentation < Thor
111
111
  def yaml_block(name)
112
112
  <<~HEREDOC
113
113
 
114
- # Controls auto-instrumentation of #{name} at start up.
114
+ # Controls auto-instrumentation of #{name} at start-up.
115
115
  # May be one of [auto|prepend|chain|disabled]
116
116
  # instrumentation.#{name.downcase}: auto
117
117
  HEREDOC
@@ -9,7 +9,6 @@ module NewRelic::Agent::Instrumentation
9
9
  include NewRelic::Agent::Instrumentation::<%= @class_name %>
10
10
 
11
11
  alias_method(:<%= @method.downcase %>_without_new_relic, :<%= @method.downcase %>)
12
- alias_method(:<%= @method.downcase %>, :<%= @method.downcase %>_with_new_relic)
13
12
 
14
13
  def <%= @method.downcase %><%= "(#{@args})" unless @args.empty? %>
15
14
  <%= @method.downcase %>_with_new_relic<%= "(#{@args})" unless @args.empty? %> do
@@ -1,5 +1,4 @@
1
1
  alias_method(:<%= @method.downcase %>_without_new_relic, :<%= @method.downcase %>)
2
- alias_method(:<%= @method.downcase %>, :<%= @method.downcase %>_with_new_relic)
3
2
 
4
3
  def <%= @method.downcase %><%= "(#{@args})" unless @args.empty? %>
5
4
  <%= @method.downcase %>_with_new_relic<%= "(#{@args})" unless @args.empty? %> do
data/lib/tasks/tests.rake CHANGED
@@ -11,6 +11,75 @@ rescue LoadError
11
11
  end
12
12
 
13
13
  if defined? Rake::TestTask
14
+ def name_for_number(content, number)
15
+ (number - 1).downto(0).each do |i|
16
+ return Regexp.last_match(1) if content[i] =~ /^\s*def (test_.+)\s*$/
17
+ end
18
+ end
19
+
20
+ def info_from_test_var
21
+ return {} unless ENV['TEST'].to_s =~ /^(.+)((?::\d+)+)/
22
+
23
+ file = Regexp.last_match(1)
24
+ numbers = Regexp.last_match(2).split(':').reject(&:empty?).uniq.map(&:to_i)
25
+ abs = File.expand_path(File.join('../../..', file), __FILE__)
26
+ raise "File >>#{abs}<< does not exist!" unless File.exist?(abs)
27
+
28
+ content = File.read(abs).split("\n")
29
+ {file: file, numbers: numbers, content: content}
30
+ end
31
+
32
+ def test_names_from_test_file(info)
33
+ info[:numbers].each_with_object([]) do |number, names|
34
+ name = name_for_number(info[:content], number)
35
+ unless name
36
+ warn "Unable to determine a test name given line >>#{number}<< for file >>#{info[:file]}<<"
37
+ next
38
+ end
39
+ names << name
40
+ end
41
+ end
42
+
43
+ # Allow ENV['TEST'] to be set to a test file path with one or more
44
+ # `:<line number>` patterns on the end of it.
45
+ #
46
+ # For example:
47
+ # TEST=test/new_relic/agent/autostart_test.rb:57 bundle exec rake test
48
+ #
49
+ # The `autostart_test.rb` file will be read, and starting from line 57 and
50
+ # working upwards in the file (downwards by line number), a test definition
51
+ # will be searched for that matches `def test_<rest of the test name>`.
52
+ #
53
+ # Multiple line numbers can be specified like so:
54
+ # TEST=test/new_relic/agent/autostart_test.rb:57:26 bundle exec rake test
55
+ #
56
+ # For this multiple line number based example, both lines 57 and 26 will
57
+ # serve as separate starting points for the search for a test name.
58
+ #
59
+ # All test names that are discovered will be "ORed" into a regex pattern with
60
+ # pipes ('|') that is passed to Minitest via
61
+ # `TESTOPTS="--name='test_name1|test_name2'"`
62
+ #
63
+ # Once a line with one or more `:<line number>` values on the end of it has
64
+ # been found, replace the value of ENV['TEST'] with the path leading up to
65
+ # the first colon before invoking Minitest.
66
+ #
67
+ # Why refer to a test by line number instead of just supplying the name
68
+ # directly? The primary use case is text editor integration. A text editor
69
+ # can be taught to "run the single unit test containing the line the cursor is
70
+ # on" by building a string containing the path to the file, a colon, (':'),
71
+ # and the line number.
72
+ def process_line_numbers
73
+ info = info_from_test_var
74
+ return unless info.key?(:file)
75
+
76
+ test_names = test_names_from_test_file(info)
77
+ raise "Could not determine any test names for file >>#{abs}<< given numbers >>#{numbers}" if test_names.empty?
78
+
79
+ ENV['TESTOPTS'] = "#{ENV['TESTOPTS']} --name='#{test_names.map { |n| Regexp.escape(n) }.join('|')}'"
80
+ ENV['TEST'] = info[:file]
81
+ end
82
+
14
83
  namespace :test do
15
84
  tasks = Rake.application.top_level_tasks
16
85
  ENV['TESTOPTS'] ||= ''
@@ -21,6 +90,8 @@ if defined? Rake::TestTask
21
90
  ENV['TESTOPTS'] += ' --' + seed
22
91
  end
23
92
 
93
+ process_line_numbers
94
+
24
95
  agent_home = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
25
96
 
26
97
  Rake::TestTask.new(:newrelic) do |t|
data/newrelic.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  #
2
- # This file configures the New Relic Agent. New Relic monitors Ruby, Java,
2
+ # This file configures the New Relic agent. New Relic monitors Ruby, Java,
3
3
  # .NET, PHP, Python, Node, and Go applications with deep visibility and low
4
4
  # overhead. For more information, visit www.newrelic.com.
5
5
 
@@ -33,6 +33,18 @@ common: &default_settings
33
33
  # - a.third.event
34
34
  # active_support_custom_events_names: []
35
35
 
36
+ # If false, all LLM instrumentation (OpenAI only for now) will be disabled and no
37
+ # metrics, events, or spans will be sent. AI Monitoring is automatically disabled
38
+ # if high_security mode is enabled.
39
+ # ai_monitoring.enabled: false
40
+
41
+ # If false, LLM instrumentation (OpenAI only for now) will not capture input and
42
+ # output content on specific LLM events.
43
+ # The excluded attributes include:
44
+ # * content from LlmChatCompletionMessage events
45
+ # * input from LlmEmbedding events
46
+ # ai_monitoring.record_content.enabled: true
47
+
36
48
  # If true, enables capture of all HTTP request headers for all destinations.
37
49
  # allow_all_headers: false
38
50
 
@@ -102,7 +114,7 @@ common: &default_settings
102
114
  # Specify a list of constants that should prevent the agent from starting
103
115
  # automatically. Separate individual constants with a comma ,. For example,
104
116
  # "Rails::Console,UninstrumentedBackgroundJob".
105
- # autostart.denylisted_constants: Rails::Console
117
+ # autostart.denylisted_constants: Rails::Command::ConsoleCommand,Rails::Command::CredentialsCommand,Rails::Command::Db::System::ChangeCommand,Rails::Command::DbConsoleCommand,Rails::Command::DestroyCommand,Rails::Command::DevCommand,Rails::Command::EncryptedCommand,Rails::Command::GenerateCommand,Rails::Command::InitializersCommand,Rails::Command::NotesCommand,Rails::Command::RoutesCommand,Rails::Command::SecretsCommand,Rails::Console,Rails::DBConsole
106
118
 
107
119
  # Defines a comma-delimited list of executables that the agent should not
108
120
  # instrument. For example, "rake,my_ruby_script.rb".
@@ -324,7 +336,8 @@ common: &default_settings
324
336
  # error_collector.ignore_status_codes: ""
325
337
 
326
338
  # Defines the maximum number of frames in an error backtrace. Backtraces over this
327
- # amount are truncated at the beginning and end.
339
+ # amount are truncated in the middle, preserving the beginning and the end of the
340
+ # stack trace.
328
341
  # error_collector.max_backtrace_frames: 50
329
342
 
330
343
  # Defines the maximum number of TransactionError events reported per harvest
@@ -341,7 +354,7 @@ common: &default_settings
341
354
  # embedded service within another framework and the agent is detecting the Sinatra
342
355
  # app and skipping the at_exit handler as a result. Sinatra classically runs the
343
356
  # entire application in an at_exit block and would otherwise misbehave if the
344
- # Agent's at_exit handler was also installed in those circumstances. Note:
357
+ # agent's at_exit handler was also installed in those circumstances. Note:
345
358
  # send_data_on_exit should also be set to true in tandem with this setting.
346
359
  # force_install_exit_handler: false
347
360
 
@@ -374,39 +387,51 @@ common: &default_settings
374
387
  # Configures the TCP/IP port for the trace observer Host
375
388
  # infinite_tracing.trace_observer.port: 443
376
389
 
390
+ # Controls auto-instrumentation of ActiveSupport::BroadcastLogger at start up. May
391
+ # be one of: auto, prepend, chain, disabled. Used in Rails versions >= 7.1.
392
+ # instrumentation.active_support_broadcast_logger: auto
393
+
377
394
  # Controls auto-instrumentation of ActiveSupport::Logger at start up. May be one
378
- # of: auto, prepend, chain, disabled.
395
+ # of: auto, prepend, chain, disabled. Used in Rails versions below 7.1.
379
396
  # instrumentation.active_support_logger: auto
380
397
 
381
- # Controls auto-instrumentation of bunny at start up. May be one of: auto,
398
+ # Controls auto-instrumentation of Async::HTTP at start up. May be one of: auto,
399
+ # prepend, chain, disabled.
400
+ # instrumentation.async_http: auto
401
+
402
+ # Controls auto-instrumentation of bunny at start-up. May be one of: auto,
382
403
  # prepend, chain, disabled.
383
404
  # instrumentation.bunny: auto
384
405
 
385
- # Controls auto-instrumentation of the concurrent-ruby library at start up. May be
406
+ # Controls auto-instrumentation of the concurrent-ruby library at start-up. May be
386
407
  # one of: auto, prepend, chain, disabled.
387
408
  # instrumentation.concurrent_ruby: auto
388
409
 
389
- # Controls auto-instrumentation of Curb at start up. May be one of: auto, prepend,
410
+ # Controls auto-instrumentation of Curb at start-up. May be one of: auto, prepend,
390
411
  # chain, disabled.
391
412
  # instrumentation.curb: auto
392
413
 
393
- # Controls auto-instrumentation of Delayed Job at start up. May be one of: auto,
414
+ # Controls auto-instrumentation of Delayed Job at start-up. May be one of: auto,
394
415
  # prepend, chain, disabled.
395
416
  # instrumentation.delayed_job: auto
396
417
 
397
- # Controls auto-instrumentation of the elasticsearch library at start up. May be
418
+ # Controls auto-instrumentation of the elasticsearch library at start-up. May be
398
419
  # one of: auto, prepend, chain, disabled.
399
420
  # instrumentation.elasticsearch: auto
400
421
 
401
- # Controls auto-instrumentation of Excon at start up. May be one of: enabled,
422
+ # Controls auto-instrumentation of ethon at start up. May be one of
423
+ # [auto|prepend|chain|disabled]
424
+ # instrumentation.ethon: auto
425
+
426
+ # Controls auto-instrumentation of Excon at start-up. May be one of: enabled,
402
427
  # disabled.
403
428
  # instrumentation.excon: enabled
404
429
 
405
- # Controls auto-instrumentation of the Fiber class at start up. May be one of:
430
+ # Controls auto-instrumentation of the Fiber class at start-up. May be one of:
406
431
  # auto, prepend, chain, disabled.
407
432
  # instrumentation.fiber: auto
408
433
 
409
- # Controls auto-instrumentation of Grape at start up. May be one of: auto,
434
+ # Controls auto-instrumentation of Grape at start-up. May be one of: auto,
410
435
  # prepend, chain, disabled.
411
436
  # instrumentation.grape: auto
412
437
 
@@ -419,43 +444,47 @@ common: &default_settings
419
444
  # example, "private.com$,exception.*"
420
445
  # instrumentation.grpc.host_denylist: []
421
446
 
422
- # Controls auto-instrumentation of gRPC clients at start up. May be one of: auto,
447
+ # Controls auto-instrumentation of gRPC clients at start-up. May be one of: auto,
423
448
  # prepend, chain, disabled.
424
449
  # instrumentation.grpc_client: auto
425
450
 
426
- # Controls auto-instrumentation of gRPC servers at start up. May be one of: auto,
451
+ # Controls auto-instrumentation of gRPC servers at start-up. May be one of: auto,
427
452
  # prepend, chain, disabled.
428
453
  # instrumentation.grpc_server: auto
429
454
 
430
- # Controls auto-instrumentation of HTTPClient at start up. May be one of: auto,
455
+ # Controls auto-instrumentation of HTTPClient at start-up. May be one of: auto,
431
456
  # prepend, chain, disabled.
432
457
  # instrumentation.httpclient: auto
433
458
 
434
- # Controls auto-instrumentation of http.rb gem at start up. May be one of: auto,
459
+ # Controls auto-instrumentation of http.rb gem at start-up. May be one of: auto,
435
460
  # prepend, chain, disabled.
436
461
  # instrumentation.httprb: auto
437
462
 
438
- # Controls auto-instrumentation of Ruby standard library Logger at start up. May
463
+ # Controls auto-instrumentation of httpx at start up. May be one of
464
+ # [auto|prepend|chain|disabled]
465
+ # instrumentation.httpx: auto
466
+
467
+ # Controls auto-instrumentation of Ruby standard library Logger at start-up. May
439
468
  # be one of: auto, prepend, chain, disabled.
440
469
  # instrumentation.logger: auto
441
470
 
442
- # Controls auto-instrumentation of dalli gem for Memcache at start up. May be one
471
+ # Controls auto-instrumentation of dalli gem for Memcache at start-up. May be one
443
472
  # of: auto, prepend, chain, disabled.
444
473
  # instrumentation.memcache: auto
445
474
 
446
- # Controls auto-instrumentation of memcache-client gem for Memcache at start up.
475
+ # Controls auto-instrumentation of memcache-client gem for Memcache at start-up.
447
476
  # May be one of: auto, prepend, chain, disabled.
448
477
  # instrumentation.memcache_client: auto
449
478
 
450
- # Controls auto-instrumentation of memcached gem for Memcache at start up. May be
479
+ # Controls auto-instrumentation of memcached gem for Memcache at start-up. May be
451
480
  # one of: auto, prepend, chain, disabled.
452
481
  # instrumentation.memcached: auto
453
482
 
454
- # Controls auto-instrumentation of Mongo at start up. May be one of: enabled,
483
+ # Controls auto-instrumentation of Mongo at start-up. May be one of: enabled,
455
484
  # disabled.
456
485
  # instrumentation.mongo: enabled
457
486
 
458
- # Controls auto-instrumentation of Net::HTTP at start up. May be one of: auto,
487
+ # Controls auto-instrumentation of Net::HTTP at start-up. May be one of: auto,
459
488
  # prepend, chain, disabled.
460
489
  # instrumentation.net_http: auto
461
490
 
@@ -464,7 +493,7 @@ common: &default_settings
464
493
  # application startup. May be one of: auto, prepend, chain, disabled.
465
494
  # instrumentation.puma_rack: auto
466
495
 
467
- # Controls auto-instrumentation of Puma::Rack::URLMap at start up. May be one of:
496
+ # Controls auto-instrumentation of Puma::Rack::URLMap at start-up. May be one of:
468
497
  # auto, prepend, chain, disabled.
469
498
  # instrumentation.puma_rack_urlmap: auto
470
499
 
@@ -473,27 +502,31 @@ common: &default_settings
473
502
  # startup. May be one of: auto, prepend, chain, disabled.
474
503
  # instrumentation.rack: auto
475
504
 
476
- # Controls auto-instrumentation of Rack::URLMap at start up. May be one of: auto,
505
+ # Controls auto-instrumentation of Rack::URLMap at start-up. May be one of: auto,
477
506
  # prepend, chain, disabled.
478
507
  # instrumentation.rack_urlmap: auto
479
508
 
480
- # Controls auto-instrumentation of rake at start up. May be one of: auto, prepend,
509
+ # Controls auto-instrumentation of rake at start-up. May be one of: auto, prepend,
481
510
  # chain, disabled.
482
511
  # instrumentation.rake: auto
483
512
 
484
- # Controls auto-instrumentation of Redis at start up. May be one of: auto,
513
+ # Controls auto-instrumentation of Redis at start-up. May be one of: auto,
485
514
  # prepend, chain, disabled.
486
515
  # instrumentation.redis: auto
487
516
 
488
- # Controls auto-instrumentation of resque at start up. May be one of: auto,
517
+ # Controls auto-instrumentation of resque at start-up. May be one of: auto,
489
518
  # prepend, chain, disabled.
490
519
  # instrumentation.resque: auto
491
520
 
492
- # Controls auto-instrumentation of Roda at start up. May be one of: auto, prepend,
521
+ # Controls auto-instrumentation of Roda at start-up. May be one of: auto, prepend,
493
522
  # chain, disabled.
494
523
  # instrumentation.roda: auto
495
524
 
496
- # Controls auto-instrumentation of Sinatra at start up. May be one of: auto,
525
+ # Controls auto-instrumentation of the ruby-openai gem at start-up. May be one of:
526
+ # auto, prepend, chain, disabled.
527
+ # instrumentation.ruby_openai: auto
528
+
529
+ # Controls auto-instrumentation of Sinatra at start-up. May be one of: auto,
497
530
  # prepend, chain, disabled.
498
531
  # instrumentation.sinatra: auto
499
532
 
@@ -501,24 +534,28 @@ common: &default_settings
501
534
  # disabled.
502
535
  # instrumentation.stripe: enabled
503
536
 
504
- # Controls auto-instrumentation of the Thread class at start up to allow the agent
537
+ # Controls auto-instrumentation of the Thread class at start-up to allow the agent
505
538
  # to correctly nest spans inside of an asynchronous transaction. This does not
506
539
  # enable the agent to automatically trace all threads created (see
507
540
  # instrumentation.thread.tracing). May be one of: auto, prepend, chain, disabled.
508
541
  # instrumentation.thread: auto
509
542
 
510
- # Controls auto-instrumentation of the Thread class at start up to automatically
543
+ # Controls auto-instrumentation of the Thread class at start-up to automatically
511
544
  # add tracing to all Threads created in the application.
512
545
  # instrumentation.thread.tracing: true
513
546
 
514
- # Controls auto-instrumentation of the Tilt template rendering library at start
515
- # up. May be one of: auto, prepend, chain, disabled.
547
+ # Controls auto-instrumentation of the Tilt template rendering library at
548
+ # start-up. May be one of: auto, prepend, chain, disabled.
516
549
  # instrumentation.tilt: auto
517
550
 
518
- # Controls auto-instrumentation of Typhoeus at start up. May be one of: auto,
551
+ # Controls auto-instrumentation of Typhoeus at start-up. May be one of: auto,
519
552
  # prepend, chain, disabled.
520
553
  # instrumentation.typhoeus: auto
521
554
 
555
+ # Controls auto-instrumentation of ViewComponent at startup. May be one of: auto,
556
+ # prepend, chain, disabled.
557
+ # instrumentation.view_component: auto
558
+
522
559
  # A dictionary of label names and values that will be applied to the data sent
523
560
  # from this agent. May also be expressed as a semicolon-delimited ; string of
524
561
  # colon-separated : pairs. For example, Server:One;Data Center:Primary.
@@ -668,7 +705,7 @@ common: &default_settings
668
705
  # Regexp.new to permit advanced matching. For each hash pair, if either the key or
669
706
  # value is matched the
670
707
  # pair will not be reported. By default, no user_data is reported, so this option
671
- # should only be used if
708
+ # should only be used if
672
709
  # the stripe.user_data.include option is being used.
673
710
  # stripe.user_data.exclude: []
674
711
 
@@ -684,6 +721,9 @@ common: &default_settings
684
721
  # the New Relic agent has time to report.
685
722
  # sync_startup: false
686
723
 
724
+ # If true, tracer state storage is thread-local, otherwise, fiber-local
725
+ # thread_local_tracer_state: false
726
+
687
727
  # If true, enables use of the thread profiler.
688
728
  # thread_profiler.enabled: false
689
729
 
data/newrelic_rpm.gemspec CHANGED
@@ -21,8 +21,8 @@ Gem::Specification.new do |s|
21
21
  https://github.com/newrelic/newrelic-ruby-agent/
22
22
  EOS
23
23
  s.email = 'support@newrelic.com'
24
- # TODO: MAJOR VERSION - remove newrelic_cmd, deprecated since version 2.13
25
- s.executables = %w[newrelic_cmd newrelic nrdebug]
24
+ # TODO: MAJOR VERSION - remove newrelic, deprecated since version xxx.
25
+ s.executables = %w[newrelic_rpm newrelic nrdebug]
26
26
  s.extra_rdoc_files = [
27
27
  'CHANGELOG.md',
28
28
  'LICENSE',
@@ -49,17 +49,18 @@ Gem::Specification.new do |s|
49
49
  s.homepage = 'https://github.com/newrelic/newrelic-ruby-agent'
50
50
  s.require_paths = ['lib']
51
51
  s.summary = 'New Relic Ruby Agent'
52
+
52
53
  s.add_development_dependency 'bundler'
53
54
  s.add_development_dependency 'feedjira', '3.2.1' unless ENV['CI'] || RUBY_VERSION < '2.5' # for Gabby
54
55
  s.add_development_dependency 'httparty' unless ENV['CI'] # for perf tests and Gabby
55
56
  s.add_development_dependency 'minitest', "#{RUBY_VERSION >= '2.7.0' ? '5.3.3' : '4.7.5'}"
56
57
  s.add_development_dependency 'minitest-stub-const', '0.6'
57
58
  s.add_development_dependency 'mocha', '~> 1.16'
58
- s.add_development_dependency 'pry' unless ENV['CI']
59
+ s.add_development_dependency 'pry' if ENV['ENABLE_PRY']
59
60
  s.add_development_dependency 'rack'
60
61
  s.add_development_dependency 'rake', '12.3.3'
61
62
 
62
- s.add_development_dependency 'rubocop', '1.54' unless ENV['CI'] && RUBY_VERSION < '3.0.0'
63
+ s.add_development_dependency 'rubocop', '1.57.2' unless ENV['CI'] && RUBY_VERSION < '3.0.0'
63
64
  s.add_development_dependency 'rubocop-ast', '1.28.1' unless ENV['CI'] && RUBY_VERSION < '3.0.0'
64
65
  s.add_development_dependency 'rubocop-minitest', '0.27.0' unless ENV['CI'] && RUBY_VERSION < '3.0.0'
65
66
  s.add_development_dependency 'rubocop-performance', '1.16.0' unless ENV['CI'] && RUBY_VERSION < '3.0.0'
data/test/agent_helper.rb CHANGED
@@ -845,7 +845,7 @@ ensure
845
845
  end
846
846
 
847
847
  def json_dump_and_encode(object)
848
- Base64.encode64(JSON.dump(object))
848
+ NewRelic::Base64.encode64(JSON.dump(object))
849
849
  end
850
850
 
851
851
  def get_last_analytics_event
@@ -871,7 +871,7 @@ def load_cross_agent_test(name)
871
871
  test_file_path = File.join(cross_agent_tests_dir, "#{name}.json")
872
872
  data = File.read(test_file_path)
873
873
  data.gsub!('callCount', 'call_count')
874
- data = JSON.load(data)
874
+ data = JSON.parse(data)
875
875
  data.each { |testcase| testcase['testname'].tr!(' ', '_') if String === testcase['testname'] }
876
876
  data
877
877
  end
@@ -1025,3 +1025,15 @@ def defer_testing_to_min_supported_rails(test_file, min_rails_version, supports_
1025
1025
  puts "Skipping tests in #{File.basename(test_file)} because Rails >= #{min_rails_version} is unavailable" if ENV['VERBOSE_TEST_OUTPUT']
1026
1026
  end
1027
1027
  end
1028
+
1029
+ def first_call_for(subject)
1030
+ items = $collector.calls_for(subject)
1031
+
1032
+ if defined?(JRUBY_VERSION)
1033
+ refute_predicate items.size, :zero?, "Expected at least one call for '#{subject}'"
1034
+ else
1035
+ assert_equal 1, items.size, "Expected exactly one call for '#{subject}'"
1036
+ end
1037
+
1038
+ items.first
1039
+ end