newrelic_rpm 9.10.1 → 9.10.2

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: 8660cb164e8b97c18397b4413d5b2ccb582c8cb377599f77b89d15920d3eb568
4
- data.tar.gz: 81e5a8617f26c196f72f57b8dbb536acafb199325af6c56676190fb7a12acfc8
3
+ metadata.gz: cef71bbfaac5e07f6d5b0862fccb3bf35e4c99251ce5fec00143036c89c964f8
4
+ data.tar.gz: e5521d0958408d97494625b155f2dcb97736d02994f7b7dfdc58143dabc73dee
5
5
  SHA512:
6
- metadata.gz: 7f6aef929dcdaef485265ef0055466292a511fcb71af6720947b5fc1599f6518aca4e11b43a553df65c20c61b73cd59e8e6fbdd53683222f875c88dba5cc942b
7
- data.tar.gz: 293dcf0e5a6865e1aed9bf0f913c14cbda26251aa2141f1a5dd3a096804239496889a413b2f2d21c0009552913fc42f7a8bd52c85aa76fdf4be1b546a219f527
6
+ metadata.gz: 28a45e748a241b3bfb2c93bb19500cda6bc433c9c428e56f4cbcc92ff5c12d8f6d0198ab87d3a910f11539695fc8d0a4935c65ea5869d6bf36b66ae2b012c3a7
7
+ data.tar.gz: 35426f77a90e9f10b2be825538482a5bda1d074cc4d3c22acd1df007774f21a190b10696ad962fe34e30db0dd57d0a5bcadb3db6d5bc97edad0dcfba88db9a19
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # New Relic Ruby Agent Release Notes
2
2
 
3
+ ## v9.10.2
4
+
5
+ Version 9.10.2 fixes a bug related to the new DynamoDB instrumentation and removes `Rails::Command::RakeCommand` from the default list of denylisted constants.
6
+
7
+ - **Bugfix: DynamoDB instrumentation logging errors when trying to get account_id**
8
+
9
+ When trying to access data needed to add the `account_id` to the DynamoDB span, the agent encountered an error when certain credentials classes were used. This has been fixed. Thanks to [@kichik](https://github.com/kichik) for bringing this to our attention. [PR#2864](https://github.com/newrelic/newrelic-ruby-agent/pull/2684)
10
+
11
+ - **Bugfix: Remove Rails::Command::RakeCommand from the default list of autostart.denylisted_constants**
12
+
13
+ The default value for the `autostart.denylisted_constants` configuration was changed in 9.10.0 to include `Rails::Command::RunnerCommand` and `Rails::Command::RakeCommand`. The inclusion of `Rails::Command::RakeCommand` prevented the agent from starting automatically when Solid Queue was started using `bin/rails solid_queue:start`. We recognize there are many commands nested within `Rails::Command::RakeCommand` and have decided to remove it from the default list. We encourage users who do not want the agent to run on `Rails::Command::RakeCommand` to add the constant to their configuration. This can be accomplished by adding the following to your `newrelic.yml` file:
14
+
15
+ ```yaml
16
+ 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::RakeCommand,Rails::Command::RoutesCommand,Rails::Command::RunnerCommand,Rails::Command::SecretsCommand,Rails::Console,Rails::DBConsole"
17
+ ```
18
+
19
+ Thank you, [@edariedl](https://github.com/edariedl), for reporting this issue. [Issue#2677](https://github.com/newrelic/newrelic-ruby-agent/issues/2677) [PR#2694](https://github.com/newrelic/newrelic-ruby-agent/pull/2694)
20
+
3
21
  ## v9.10.1
4
22
 
5
23
  - **Bugfix: Incompatibility with Bootstrap**
@@ -11,7 +29,7 @@ Version 9.10.1 fixes an incompatibility between the agent and the [Bootstrap](ht
11
29
  Version 9.10.0 introduces instrumentation for DynamoDB, adds a new feature to automatically apply nonces from the Rails content security policy, fixes a bug that would cause an expected error to negatively impact a transaction's Apdex, and fixes the agent's autostart logic so that by default `rails runner` and `rails db` commands will not cause the agent to start.
12
30
 
13
31
  - **Feature: Add instrumentation for DynamoDB**
14
-
32
+
15
33
  The agent has added instrumentation for the aws-sdk-dynamodb gem. The agent will now record datastore spans for DynamoDB client calls made with the aws-sdk-dynamodb gem. [PR#2642](https://github.com/newrelic/newrelic-ruby-agent/pull/2642)
16
34
 
17
35
  - **Feature: Automatically apply nonces from the Rails content security policy**
@@ -8,15 +8,21 @@ module NewRelic
8
8
  CHARACTERS = %w[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 2 3 4 5 6 7].freeze
9
9
  HEX_MASK = '7fffffffff80'
10
10
 
11
- def self.create_arn(service, resource, config)
12
- region = config.region
13
- account_id = NewRelic::Agent::Aws.convert_access_key_to_account_id(config.credentials.access_key_id)
14
-
11
+ def self.create_arn(service, resource, region, account_id)
15
12
  "arn:aws:#{service}:#{region}:#{account_id}:#{resource}"
16
13
  rescue => e
17
14
  NewRelic::Agent.logger.warn("Failed to create ARN: #{e}")
18
15
  end
19
16
 
17
+ def self.get_account_id(config)
18
+ access_key_id = config.credentials.credentials.access_key_id if config&.credentials&.credentials&.respond_to?(:access_key_id)
19
+ return unless access_key_id
20
+
21
+ NewRelic::Agent::Aws.convert_access_key_to_account_id(access_key_id)
22
+ rescue => e
23
+ NewRelic::Agent.logger.debug("Failed to create account id: #{e}")
24
+ end
25
+
20
26
  def self.convert_access_key_to_account_id(access_key)
21
27
  decoded_key = Integer(decode_to_hex(access_key[4..-1]), 16)
22
28
  mask = Integer(HEX_MASK, 16)
@@ -480,7 +480,12 @@ module NewRelic
480
480
  :type => Boolean,
481
481
  :allowed_from_server => false,
482
482
  :description => <<~DESC
483
- Forces the exit handler that sends all cached data to collector before shutting down to be installed regardless of detecting scenarios where it generally should not be. Known use-case for this option is where Sinatra is running as an embedded service within another framework and the agent is detecting the Sinatra app and skipping the `at_exit` handler as a result. Sinatra classically runs the entire application in an `at_exit` block and would otherwise misbehave if the Agent's `at_exit` handler was also installed in those circumstances. Note: `send_data_on_exit` should also be set to `true` in tandem with this setting."
483
+ The exit handler that sends all cached data to the collector before shutting down is forcibly installed. \
484
+ This is true even when it detects scenarios where it generally should not be. The known use case for this \
485
+ option is when Sinatra runs as an embedded service within another framework. The agent detects the Sinatra \
486
+ app and skips the `at_exit` handler as a result. Sinatra classically runs the entire application in an \
487
+ `at_exit` block and would otherwise misbehave if the agent's `at_exit` handler was also installed in those \
488
+ circumstances. Note: `send_data_on_exit` should also be set to `true` in tandem with this setting.
484
489
  DESC
485
490
  },
486
491
  :high_security => {
@@ -1077,7 +1082,6 @@ module NewRelic
1077
1082
  Rails::Command::GenerateCommand
1078
1083
  Rails::Command::InitializersCommand
1079
1084
  Rails::Command::NotesCommand
1080
- Rails::Command::RakeCommand
1081
1085
  Rails::Command::RoutesCommand
1082
1086
  Rails::Command::RunnerCommand
1083
1087
  Rails::Command::SecretsCommand
@@ -1144,8 +1148,12 @@ module NewRelic
1144
1148
  :public => true,
1145
1149
  :type => Integer,
1146
1150
  :allowed_from_server => true,
1147
- :description => 'Specify a maximum number of custom events to buffer in memory at a time.',
1148
- :dynamic_name => true
1151
+ :dynamic_name => true,
1152
+ :description => <<~DESC
1153
+ * Specify a maximum number of custom events to buffer in memory at a time.'
1154
+ * When configuring the agent for [AI monitoring](/docs/ai-monitoring/intro-to-ai-monitoring), \
1155
+ set to max value `100000`. This ensures the agent captures the maximum amount of LLM events.
1156
+ DESC
1149
1157
  },
1150
1158
  # Datastore tracer
1151
1159
  :'datastore_tracer.database_name_reporting.enabled' => {
@@ -1983,8 +1991,8 @@ module NewRelic
1983
1991
  :allowed_from_server => true,
1984
1992
  :description => <<~DESC
1985
1993
  * Defines the maximum number of span events reported from a single harvest. Any Integer between `1` and `10000` is valid.'
1986
- * When configuring the agent for [AI monitoring](/docs/ai-monitoring/intro-to-ai-monitoring), set to max value `10000`.\
1987
- This ensures that the agent captures the maximum amount of distributed traces.
1994
+ * When configuring the agent for [AI monitoring](/docs/ai-monitoring/intro-to-ai-monitoring), set to max value `10000`.\
1995
+ This ensures the agent captures the maximum amount of distributed traces.
1988
1996
  DESC
1989
1997
  },
1990
1998
  # Strip exception messages
@@ -49,10 +49,16 @@ module NewRelic::Agent::Instrumentation
49
49
  @nr_captured_request = yield
50
50
  end
51
51
 
52
+ def nr_account_id
53
+ return @nr_account_id if defined?(@nr_account_id)
54
+
55
+ @nr_account_id = NewRelic::Agent::Aws.get_account_id(config)
56
+ end
57
+
52
58
  def get_arn(params)
53
- return unless params[:table_name]
59
+ return unless params[:table_name] && nr_account_id
54
60
 
55
- NewRelic::Agent::Aws.create_arn(PRODUCT.downcase, "table/#{params[:table_name]}", config)
61
+ NewRelic::Agent::Aws.create_arn(PRODUCT.downcase, "table/#{params[:table_name]}", config&.region, nr_account_id)
56
62
  end
57
63
  end
58
64
  end
@@ -7,7 +7,7 @@ module NewRelic
7
7
  module VERSION # :nodoc:
8
8
  MAJOR = 9
9
9
  MINOR = 10
10
- TINY = 1
10
+ TINY = 2
11
11
 
12
12
  STRING = "#{MAJOR}.#{MINOR}.#{TINY}"
13
13
  end
@@ -31,15 +31,16 @@ class Instrumentation < Thor
31
31
 
32
32
  def scaffold(name)
33
33
  @name = name
34
+ @snake_name = snake_name(@name)
34
35
  @method = options[:method] if options[:method]
35
36
  @args = options[:args] if options[:args]
36
37
  @class_name = ::NewRelic::LanguageSupport.camelize(name)
37
- base_path = "#{INSTRUMENTATION_ROOT}#{name.downcase}"
38
+ base_path = "#{INSTRUMENTATION_ROOT}#{@snake_name}"
38
39
 
39
40
  empty_directory(base_path)
40
41
  create_instrumentation_files(base_path)
41
- append_to_default_source(name)
42
- append_to_newrelic_yml(name)
42
+ append_to_default_source(@name, @snake_name)
43
+ # append_to_newrelic_yml(@name, @snake_name) # This is now done on release, we don't need it anymore, but leaving it to be sure.
43
44
  create_tests(name)
44
45
  end
45
46
 
@@ -69,53 +70,60 @@ class Instrumentation < Thor
69
70
  def create_tests(name)
70
71
  @name = name
71
72
  @instrumentation_method_global_erb_snippet = '<%= $instrumentation_method %>'
72
- base_path = "#{MULTIVERSE_SUITE_ROOT}#{@name.downcase}"
73
+ @snake_name = snake_name(@name)
74
+ base_path = "#{MULTIVERSE_SUITE_ROOT}#{@snake_name}"
73
75
  empty_directory(base_path)
74
76
  template('templates/Envfile.tt', "#{base_path}/Envfile")
75
- template('templates/test.tt', "#{base_path}/#{@name.downcase}_instrumentation_test.rb")
77
+ template('templates/test.tt', "#{base_path}/#{@snake_name}_instrumentation_test.rb")
76
78
 
77
79
  empty_directory("#{base_path}/config")
78
80
  template('templates/newrelic.yml.tt', "#{base_path}/config/newrelic.yml")
79
81
  end
80
82
 
81
- def append_to_default_source(name)
83
+ def append_to_default_source(name, snake_name)
82
84
  insert_into_file(
83
85
  DEFAULT_SOURCE_LOCATION,
84
- config_block(name.downcase),
86
+ config_block(name, snake_name),
85
87
  after: ":description => 'Controls auto-instrumentation of bunny at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
86
88
  },\n"
87
89
  )
88
90
  end
89
91
 
90
- def append_to_newrelic_yml(name)
92
+ def append_to_newrelic_yml(name, snake_name)
91
93
  insert_into_file(
92
94
  NEWRELIC_YML_LOCATION,
93
- yaml_block(name),
95
+ yaml_block(name, snake_name),
94
96
  after: "# instrumentation.bunny: auto\n"
95
97
  )
96
98
  end
97
99
 
98
- def config_block(name)
99
- <<~CONFIG
100
- :'instrumentation.#{name.downcase}' => {
101
- :default => 'auto',
102
- :public => true,
103
- :type => String,
104
- :dynamic_name => true,
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].'
107
- },
100
+ def config_block(name, snake_name)
101
+ # Don't change to <<~
102
+ # We want to preserve the whitespace so the config is correctly indented
103
+ <<-CONFIG
104
+ :'instrumentation.#{snake_name}' => {
105
+ :default => 'auto',
106
+ :public => true,
107
+ :type => String,
108
+ :dynamic_name => true,
109
+ :allowed_from_server => false,
110
+ :description => 'Controls auto-instrumentation of the #{name} library at start-up. May be one of `auto`, `prepend`, `chain`, `disabled`.'
111
+ },
108
112
  CONFIG
109
113
  end
110
114
 
111
- def yaml_block(name)
115
+ def yaml_block(name, snake_name)
112
116
  <<~HEREDOC
113
117
 
114
118
  # Controls auto-instrumentation of #{name} at start-up.
115
119
  # May be one of [auto|prepend|chain|disabled]
116
- # instrumentation.#{name.downcase}: auto
120
+ # instrumentation.#{snake_name}: auto
117
121
  HEREDOC
118
122
  end
123
+
124
+ def snake_name(name)
125
+ name.downcase.tr('-', '_')
126
+ end
119
127
  end
120
128
 
121
129
  Instrumentation.start(ARGV)
@@ -2,12 +2,12 @@
2
2
  # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
3
3
  # frozen_string_literal: true
4
4
 
5
- require_relative '<%= @name.downcase %>/instrumentation'
6
- require_relative '<%= @name.downcase %>/chain'
7
- require_relative '<%= @name.downcase %>/prepend'
5
+ require_relative '<%= @snake_name.downcase %>/instrumentation'
6
+ require_relative '<%= @snake_name.downcase %>/chain'
7
+ require_relative '<%= @snake_name.downcase %>/prepend'
8
8
 
9
9
  DependencyDetection.defer do
10
- named :<%= @name.match?(/\-|\_/) ? "'#{@name.downcase}'" : @name.downcase %>
10
+ named :<%= @name.match?(/\-|\_/) ? "'#{@snake_name}'" : @name.downcase %>
11
11
 
12
12
  depends_on do
13
13
  # The class that needs to be defined to prepend/chain onto. This can be used
@@ -6,7 +6,7 @@ development:
6
6
  monitor_mode: true
7
7
  license_key: bootstrap_newrelic_admin_license_key_000
8
8
  instrumentation:
9
- <%= @name.downcase %>: <%= @instrumentation_method_global_erb_snippet %>
9
+ <%= @snake_name %>: <%= @instrumentation_method_global_erb_snippet %>
10
10
  app_name: test
11
11
  log_level: debug
12
12
  host: 127.0.0.1
data/newrelic.yml CHANGED
@@ -116,7 +116,7 @@ common: &default_settings
116
116
  # Specify a list of constants that should prevent the agent from starting
117
117
  # automatically. Separate individual constants with a comma ,. For example,
118
118
  # "Rails::Console,UninstrumentedBackgroundJob".
119
- # 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::RakeCommand,Rails::Command::RoutesCommand,Rails::Command::RunnerCommand,Rails::Command::SecretsCommand,Rails::Console,Rails::DBConsole
119
+ # 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::RunnerCommand,Rails::Command::SecretsCommand,Rails::Console,Rails::DBConsole
120
120
 
121
121
  # Defines a comma-delimited list of executables that the agent should not
122
122
  # instrument. For example, "rake,my_ruby_script.rb".
@@ -188,7 +188,9 @@ common: &default_settings
188
188
  # If true, the agent captures custom events.
189
189
  # custom_insights_events.enabled: true
190
190
 
191
- # Specify a maximum number of custom events to buffer in memory at a time.
191
+ # * Specify a maximum number of custom events to buffer in memory at a time.'
192
+ # * When configuring the agent for AI monitoring, set to max value 100000. This
193
+ # ensures the agent captures the maximum amount of LLM events.
192
194
  # custom_insights_events.max_samples_stored: 3000
193
195
 
194
196
  # If false, the agent will not add database_name parameter to transaction or slow
@@ -354,14 +356,14 @@ common: &default_settings
354
356
  # requests.
355
357
  # exclude_newrelic_header: false
356
358
 
357
- # Forces the exit handler that sends all cached data to collector before shutting
358
- # down to be installed regardless of detecting scenarios where it generally should
359
- # not be. Known use-case for this option is where Sinatra is running as an
360
- # embedded service within another framework and the agent is detecting the Sinatra
361
- # app and skipping the at_exit handler as a result. Sinatra classically runs the
359
+ # The exit handler that sends all cached data to the collector before shutting
360
+ # down is forcibly installed. This is true even when it detects scenarios where it
361
+ # generally should not be. The known use case for this option is when Sinatra runs
362
+ # as an embedded service within another framework. The agent detects the Sinatra
363
+ # app and skips the at_exit handler as a result. Sinatra classically runs the
362
364
  # entire application in an at_exit block and would otherwise misbehave if the
363
- # Agent's at_exit handler was also installed in those circumstances. Note:
364
- # send_data_on_exit should also be set to true in tandem with this setting."
365
+ # agent's at_exit handler was also installed in those circumstances. Note:
366
+ # send_data_on_exit should also be set to true in tandem with this setting.
365
367
  # force_install_exit_handler: false
366
368
 
367
369
  # Ordinarily the agent reports dyno names with a trailing dot and process ID (for
@@ -699,8 +701,8 @@ common: &default_settings
699
701
 
700
702
  # * Defines the maximum number of span events reported from a single harvest. Any
701
703
  # Integer between 1 and 10000 is valid.'
702
- # * When configuring the agent for AI monitoring, set to max value 10000. This
703
- # ensures that the agent captures the maximum amount of distributed traces.
704
+ # * When configuring the agent for AI monitoring, set to max value 10000.This
705
+ # ensures the agent captures the maximum amount of distributed traces.
704
706
  # span_events.max_samples_stored: 2000
705
707
 
706
708
  # Sets the maximum number of span events to buffer when streaming to the trace
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_rpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.10.1
4
+ version: 9.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tanna McClure
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2024-06-03 00:00:00.000000000 Z
14
+ date: 2024-06-06 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler