newrelic_rpm 9.10.0 → 9.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +25 -1
- data/lib/{bootstrap.rb → boot/strap.rb} +9 -13
- data/lib/new_relic/agent/aws.rb +10 -4
- data/lib/new_relic/agent/configuration/default_source.rb +15 -7
- data/lib/new_relic/agent/instrumentation/dynamodb/instrumentation.rb +8 -2
- data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +51 -6
- data/lib/new_relic/version.rb +1 -1
- data/lib/sequel/extensions/new_relic_instrumentation.rb +3 -2
- data/lib/tasks/instrumentation_generator/instrumentation.thor +29 -21
- data/lib/tasks/instrumentation_generator/templates/dependency_detection.tt +4 -4
- data/lib/tasks/instrumentation_generator/templates/newrelic.yml.tt +1 -1
- data/newrelic.yml +23 -17
- data/test/agent_helper.rb +4 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cef71bbfaac5e07f6d5b0862fccb3bf35e4c99251ce5fec00143036c89c964f8
|
4
|
+
data.tar.gz: e5521d0958408d97494625b155f2dcb97736d02994f7b7dfdc58143dabc73dee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28a45e748a241b3bfb2c93bb19500cda6bc433c9c428e56f4cbcc92ff5c12d8f6d0198ab87d3a910f11539695fc8d0a4935c65ea5869d6bf36b66ae2b012c3a7
|
7
|
+
data.tar.gz: 35426f77a90e9f10b2be825538482a5bda1d074cc4d3c22acd1df007774f21a190b10696ad962fe34e30db0dd57d0a5bcadb3db6d5bc97edad0dcfba88db9a19
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,35 @@
|
|
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
|
+
|
21
|
+
## v9.10.1
|
22
|
+
|
23
|
+
- **Bugfix: Incompatibility with Bootstrap**
|
24
|
+
|
25
|
+
Version 9.10.1 fixes an incompatibility between the agent and the [Bootstrap](https://github.com/twbs/bootstrap-rubygem) gem caused by agent v9.10.0's introduction of a `lib/bootstrap.rb` file. Thank you to [@dorner](https://github.com/dorner) for reporting the bug and identifying the 'bootstrap' name collision as the root cause. [BUG#2675](https://github.com/newrelic/newrelic-ruby-agent/issues/2675) [PR#2676](https://github.com/newrelic/newrelic-ruby-agent/pull/2676)
|
26
|
+
|
3
27
|
## v9.10.0
|
4
28
|
|
5
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.
|
6
30
|
|
7
31
|
- **Feature: Add instrumentation for DynamoDB**
|
8
|
-
|
32
|
+
|
9
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)
|
10
34
|
|
11
35
|
- **Feature: Automatically apply nonces from the Rails content security policy**
|
@@ -27,7 +27,7 @@
|
|
27
27
|
# - Next, use the "RUBYOPT" environment variable to require ("-r") this
|
28
28
|
# file (note that the ".rb" extension is dropped):
|
29
29
|
# ```
|
30
|
-
# export RUBYOPT="-r /newrelic/lib/
|
30
|
+
# export RUBYOPT="-r /newrelic/lib/boot/strap"
|
31
31
|
# ```
|
32
32
|
# - Add your New Relic license key as an environment variable.
|
33
33
|
# ```
|
@@ -50,7 +50,7 @@ module NRBundlerPatch
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def require_newrelic
|
53
|
-
lib = File.
|
53
|
+
lib = File.expand_path('../..', __FILE__)
|
54
54
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
55
55
|
Kernel.require NR_AGENT_GEM
|
56
56
|
end
|
@@ -65,40 +65,36 @@ class NRBundlerPatcher
|
|
65
65
|
check_for_rubyopt
|
66
66
|
check_for_bundler
|
67
67
|
Bundler::Runtime.prepend(NRBundlerPatch)
|
68
|
+
rescue StandardError => e
|
69
|
+
Kernel.warn "New Relic entrypoint at #{__FILE__} encountered an issue:\n #{e.message}"
|
68
70
|
end
|
69
71
|
|
70
72
|
private
|
71
73
|
|
72
74
|
def self.check_for_require
|
73
|
-
|
75
|
+
raise "#{__FILE__} is meant to be required, not invoked directly" if $PROGRAM_NAME == __FILE__
|
74
76
|
end
|
75
77
|
|
76
78
|
def self.check_for_rubyopt
|
77
79
|
unless ENV[RUBYOPT].to_s.match?("-r #{__FILE__.rpartition('.').first}")
|
78
|
-
|
80
|
+
raise "#{__FILE__} is meant to be required via the RUBYOPT env var"
|
79
81
|
end
|
80
82
|
end
|
81
83
|
|
82
84
|
def self.check_for_bundler
|
83
85
|
require_bundler
|
84
86
|
|
85
|
-
|
87
|
+
raise 'Required Ruby Bundler class Bundler::Runtime not defined!' unless defined?(Bundler::Runtime)
|
86
88
|
|
87
89
|
unless Bundler::Runtime.method_defined?(:require)
|
88
|
-
|
90
|
+
raise "The active Ruby Bundler instance doesn't offer Bundler::Runtime#require"
|
89
91
|
end
|
90
92
|
end
|
91
93
|
|
92
94
|
def self.require_bundler
|
93
95
|
require BUNDLER
|
94
96
|
rescue LoadError => e
|
95
|
-
|
96
|
-
end
|
97
|
-
|
98
|
-
def self.warn_and_exit(msg)
|
99
|
-
warn "New Relic entrypoint at #{__FILE__} encountered an issue:\n\t#{msg}"
|
100
|
-
|
101
|
-
exit 1
|
97
|
+
raise "Required Ruby library '#{BUNDLER}' could not be required - #{e}"
|
102
98
|
end
|
103
99
|
end
|
104
100
|
|
data/lib/new_relic/agent/aws.rb
CHANGED
@@ -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,
|
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
|
-
|
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 => {
|
@@ -782,7 +787,7 @@ module NewRelic
|
|
782
787
|
# CSP nonce
|
783
788
|
:'browser_monitoring.content_security_policy_nonce' => {
|
784
789
|
:default => value_of(:'rum.enabled'),
|
785
|
-
:documentation_default =>
|
790
|
+
:documentation_default => true,
|
786
791
|
:public => true,
|
787
792
|
:type => Boolean,
|
788
793
|
:allowed_from_server => false,
|
@@ -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
|
-
:
|
1148
|
-
:
|
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
|
-
|
1987
|
-
|
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
|
@@ -8,6 +8,54 @@ module NewRelic::Agent::Instrumentation
|
|
8
8
|
module Elasticsearch
|
9
9
|
PRODUCT_NAME = 'Elasticsearch'
|
10
10
|
OPERATION = 'perform_request'
|
11
|
+
|
12
|
+
# Pattern to use with client caller location strings. Look for a location
|
13
|
+
# that contains '/lib/elasticsearch/api/' and is NOT followed by the
|
14
|
+
# string held in the OPERATION constant
|
15
|
+
OPERATION_PATTERN = %r{/lib/elasticsearch/api/(?!.+#{OPERATION})}.freeze
|
16
|
+
|
17
|
+
# Use the OPERATION_PATTERN pattern to find the appropriate caller location
|
18
|
+
# that will contain the client instance method (example: 'search') and
|
19
|
+
# return that method name.
|
20
|
+
#
|
21
|
+
# A Ruby caller location matching the OPERATION_PATTERN will contain an
|
22
|
+
# elasticsearch client instance method name (such as "search"), and that
|
23
|
+
# method name will be used as the operation name.
|
24
|
+
#
|
25
|
+
# With Ruby < 3.4 the method name is listed as:
|
26
|
+
#
|
27
|
+
# `search'
|
28
|
+
#
|
29
|
+
# with an opening backtick and a closing single tick. And only the
|
30
|
+
# method name itself is listed.
|
31
|
+
#
|
32
|
+
# With Ruby 3.4+ the method name is listed as:
|
33
|
+
#
|
34
|
+
# 'Elasticsearch::API::Actions#search'
|
35
|
+
#
|
36
|
+
# with opening and closing single ticks and the class defining the
|
37
|
+
# instance method listed.
|
38
|
+
#
|
39
|
+
# (?:) = ?: prevents capturing
|
40
|
+
# (?:`|') = allow ` or '
|
41
|
+
# (?:.+#) = allow the class name and '#' prefix to exist but ignore it
|
42
|
+
# ([^']+)' = after the opening ` or ', capturing everything up to the
|
43
|
+
# closing '. [^']+ = one or more characters that are not '
|
44
|
+
#
|
45
|
+
# Example Ruby 3.3.1 input:
|
46
|
+
#
|
47
|
+
# /Users/fallwith/.rubies/ruby-3.3.1/lib/ruby/gems/3.3.0/gems/elasticsearch-api-7.17.10/lib/elasticsearch/api/actions/index.rb:74:in `index'
|
48
|
+
#
|
49
|
+
# Example Ruby 3.4.0-preview1 input:
|
50
|
+
#
|
51
|
+
# /Users/fallwith/.rubies/ruby-3.4.0-preview1/lib/ruby/gems/3.4.0+0/gems/elasticsearch-api-7.17.10/lib/elasticsearch/api/actions/index.rb:74:in 'Elasticsearch::API::Actions#index'
|
52
|
+
#
|
53
|
+
# Example output for both Rubies:
|
54
|
+
#
|
55
|
+
# index
|
56
|
+
|
57
|
+
INSTANCE_METHOD_PATTERN = /:in (?:`|')(?:.+#)?([^']+)'\z/.freeze
|
58
|
+
|
11
59
|
INSTRUMENTATION_NAME = NewRelic::Agent.base_name(name)
|
12
60
|
|
13
61
|
# We need the positional arguments `params` and `body`
|
@@ -40,13 +88,10 @@ module NewRelic::Agent::Instrumentation
|
|
40
88
|
private
|
41
89
|
|
42
90
|
def nr_operation
|
43
|
-
|
44
|
-
|
45
|
-
string.include?('lib/elasticsearch/api') && !string.include?(OPERATION)
|
46
|
-
end
|
47
|
-
return nil unless operation_index
|
91
|
+
location = caller_locations.detect { |loc| loc.to_s.match?(OPERATION_PATTERN) }
|
92
|
+
return unless location && location.to_s =~ INSTANCE_METHOD_PATTERN
|
48
93
|
|
49
|
-
|
94
|
+
Regexp.last_match(1)
|
50
95
|
end
|
51
96
|
|
52
97
|
def nr_reported_query(query)
|
data/lib/new_relic/version.rb
CHANGED
@@ -78,8 +78,9 @@ module Sequel
|
|
78
78
|
end
|
79
79
|
|
80
80
|
THREAD_SAFE_CONNECTION_POOL_CLASSES = [
|
81
|
-
(defined?(::Sequel::ThreadedConnectionPool) && ::Sequel::ThreadedConnectionPool)
|
82
|
-
|
81
|
+
(defined?(::Sequel::ThreadedConnectionPool) && ::Sequel::ThreadedConnectionPool),
|
82
|
+
(defined?(::Sequel::TimedQueueConnectionPool) && RUBY_VERSION >= '3.4' && ::Sequel::TimedQueueConnectionPool)
|
83
|
+
].compact.freeze
|
83
84
|
|
84
85
|
def explainer_for(sql)
|
85
86
|
proc do |*|
|
@@ -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}#{
|
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
|
-
|
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}/#{@
|
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
|
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
|
-
<<~
|
100
|
-
|
101
|
-
|
102
|
-
:
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
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.#{
|
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 '<%= @
|
6
|
-
require_relative '<%= @
|
7
|
-
require_relative '<%= @
|
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?(/\-|\_/) ? "'#{@
|
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
|
-
<%= @
|
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
@@ -43,6 +43,8 @@ common: &default_settings
|
|
43
43
|
# The excluded attributes include:
|
44
44
|
# * content from LlmChatCompletionMessage events
|
45
45
|
# * input from LlmEmbedding events
|
46
|
+
# This is an optional security setting to prevent recording sensitive data sent to
|
47
|
+
# and received from your LLMs.
|
46
48
|
# ai_monitoring.record_content.enabled: true
|
47
49
|
|
48
50
|
# If true, enables capture of all HTTP request headers for all destinations.
|
@@ -114,7 +116,7 @@ common: &default_settings
|
|
114
116
|
# Specify a list of constants that should prevent the agent from starting
|
115
117
|
# automatically. Separate individual constants with a comma ,. For example,
|
116
118
|
# "Rails::Console,UninstrumentedBackgroundJob".
|
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::
|
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
|
118
120
|
|
119
121
|
# Defines a comma-delimited list of executables that the agent should not
|
120
122
|
# instrument. For example, "rake,my_ruby_script.rb".
|
@@ -146,7 +148,7 @@ common: &default_settings
|
|
146
148
|
|
147
149
|
# If true, enables auto-injection of Content Security Policy Nonce in browser
|
148
150
|
# monitoring scripts. For now, auto-injection only works with Rails 5.2+.
|
149
|
-
# browser_monitoring.content_security_policy_nonce:
|
151
|
+
# browser_monitoring.content_security_policy_nonce: true
|
150
152
|
|
151
153
|
# Manual override for the path to your local CA bundle. This CA bundle will be
|
152
154
|
# used to validate the SSL certificate presented by New Relic's data collection
|
@@ -186,7 +188,9 @@ common: &default_settings
|
|
186
188
|
# If true, the agent captures custom events.
|
187
189
|
# custom_insights_events.enabled: true
|
188
190
|
|
189
|
-
# 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.
|
190
194
|
# custom_insights_events.max_samples_stored: 3000
|
191
195
|
|
192
196
|
# If false, the agent will not add database_name parameter to transaction or slow
|
@@ -352,14 +356,14 @@ common: &default_settings
|
|
352
356
|
# requests.
|
353
357
|
# exclude_newrelic_header: false
|
354
358
|
|
355
|
-
#
|
356
|
-
# down
|
357
|
-
# not be.
|
358
|
-
# embedded service within another framework
|
359
|
-
# app and
|
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
|
360
364
|
# entire application in an at_exit block and would otherwise misbehave if the
|
361
365
|
# agent's at_exit handler was also installed in those circumstances. Note:
|
362
|
-
# send_data_on_exit should also be set to true in
|
366
|
+
# send_data_on_exit should also be set to true in tandem with this setting.
|
363
367
|
# force_install_exit_handler: false
|
364
368
|
|
365
369
|
# Ordinarily the agent reports dyno names with a trailing dot and process ID (for
|
@@ -420,15 +424,15 @@ common: &default_settings
|
|
420
424
|
# instrumentation.delayed_job: auto
|
421
425
|
|
422
426
|
# Controls auto-instrumentation of the aws-sdk-dynamodb library at start-up. May
|
423
|
-
# be one of
|
427
|
+
# be one of auto, prepend, chain, disabled.
|
424
428
|
# instrumentation.dynamodb: auto
|
425
429
|
|
426
430
|
# Controls auto-instrumentation of the elasticsearch library at start-up. May be
|
427
431
|
# one of: auto, prepend, chain, disabled.
|
428
432
|
# instrumentation.elasticsearch: auto
|
429
433
|
|
430
|
-
# Controls auto-instrumentation of ethon at start up. May be one of
|
431
|
-
#
|
434
|
+
# Controls auto-instrumentation of ethon at start up. May be one of auto, prepend,
|
435
|
+
# chain, disabled
|
432
436
|
# instrumentation.ethon: auto
|
433
437
|
|
434
438
|
# Controls auto-instrumentation of Excon at start-up. May be one of: enabled,
|
@@ -468,8 +472,8 @@ common: &default_settings
|
|
468
472
|
# prepend, chain, disabled.
|
469
473
|
# instrumentation.httprb: auto
|
470
474
|
|
471
|
-
# Controls auto-instrumentation of httpx at start up. May be one of
|
472
|
-
#
|
475
|
+
# Controls auto-instrumentation of httpx at start up. May be one of auto, prepend,
|
476
|
+
# chain, disabled
|
473
477
|
# instrumentation.httpx: auto
|
474
478
|
|
475
479
|
# Controls auto-instrumentation of Ruby standard library Logger at start-up. May
|
@@ -531,7 +535,7 @@ common: &default_settings
|
|
531
535
|
# instrumentation.roda: auto
|
532
536
|
|
533
537
|
# Controls auto-instrumentation of the ruby-openai gem at start-up. May be one of:
|
534
|
-
# auto, prepend, chain, disabled.
|
538
|
+
# auto, prepend, chain, disabled. Defaults to disabled in high security mode.
|
535
539
|
# instrumentation.ruby_openai: auto
|
536
540
|
|
537
541
|
# Controls auto-instrumentation of Sinatra at start-up. May be one of: auto,
|
@@ -695,8 +699,10 @@ common: &default_settings
|
|
695
699
|
# If true, enables span event sampling.
|
696
700
|
# span_events.enabled: true
|
697
701
|
|
698
|
-
# Defines the maximum number of span events reported from a single harvest. Any
|
699
|
-
# Integer between 1 and 10000 is valid.
|
702
|
+
# * Defines the maximum number of span events reported from a single harvest. Any
|
703
|
+
# Integer between 1 and 10000 is valid.'
|
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.
|
700
706
|
# span_events.max_samples_stored: 2000
|
701
707
|
|
702
708
|
# Sets the maximum number of span events to buffer when streaming to the trace
|
data/test/agent_helper.rb
CHANGED
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.
|
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-
|
14
|
+
date: 2024-06-06 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -243,7 +243,7 @@ files:
|
|
243
243
|
- bin/nrdebug
|
244
244
|
- init.rb
|
245
245
|
- install.rb
|
246
|
-
- lib/
|
246
|
+
- lib/boot/strap.rb
|
247
247
|
- lib/new_relic/agent.rb
|
248
248
|
- lib/new_relic/agent/adaptive_sampler.rb
|
249
249
|
- lib/new_relic/agent/agent.rb
|