newrelic_rpm 9.14.0 → 9.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.build_ignore +1 -0
- data/CHANGELOG.md +52 -4
- data/lib/new_relic/agent/aws.rb +3 -48
- data/lib/new_relic/agent/configuration/default_source.rb +211 -29
- data/lib/new_relic/agent/configuration/manager.rb +1 -1
- data/lib/new_relic/agent/database.rb +36 -0
- data/lib/new_relic/agent/instrumentation/active_record.rb +1 -8
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +1 -12
- data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger.rb +0 -2
- data/lib/new_relic/agent/instrumentation/active_support_logger.rb +0 -2
- data/lib/new_relic/agent/instrumentation/async_http.rb +1 -2
- data/lib/new_relic/agent/instrumentation/aws_sdk_lambda/chain.rb +33 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_lambda/instrumentation.rb +94 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_lambda/prepend.rb +23 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_lambda.rb +23 -0
- data/lib/new_relic/agent/instrumentation/aws_sqs.rb +0 -2
- data/lib/new_relic/agent/instrumentation/bunny.rb +3 -4
- data/lib/new_relic/agent/instrumentation/concurrent_ruby.rb +0 -2
- data/lib/new_relic/agent/instrumentation/curb.rb +3 -4
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +0 -4
- data/lib/new_relic/agent/instrumentation/dynamodb/instrumentation.rb +4 -11
- data/lib/new_relic/agent/instrumentation/dynamodb.rb +0 -2
- data/lib/new_relic/agent/instrumentation/elasticsearch.rb +0 -2
- data/lib/new_relic/agent/instrumentation/ethon.rb +0 -4
- data/lib/new_relic/agent/instrumentation/fiber.rb +0 -2
- data/lib/new_relic/agent/instrumentation/grape.rb +1 -3
- data/lib/new_relic/agent/instrumentation/httpclient.rb +0 -1
- data/lib/new_relic/agent/instrumentation/httprb.rb +0 -1
- data/lib/new_relic/agent/instrumentation/httpx.rb +0 -4
- data/lib/new_relic/agent/instrumentation/logger.rb +1 -3
- data/lib/new_relic/agent/instrumentation/logstasher.rb +0 -2
- data/lib/new_relic/agent/instrumentation/memcache.rb +0 -1
- data/lib/new_relic/agent/instrumentation/opensearch.rb +0 -2
- data/lib/new_relic/agent/instrumentation/padrino.rb +3 -3
- data/lib/new_relic/agent/instrumentation/rake.rb +0 -1
- data/lib/new_relic/agent/instrumentation/rdkafka/chain.rb +2 -1
- data/lib/new_relic/agent/instrumentation/rdkafka/prepend.rb +2 -1
- data/lib/new_relic/agent/instrumentation/rdkafka.rb +0 -2
- data/lib/new_relic/agent/instrumentation/redis.rb +0 -1
- data/lib/new_relic/agent/instrumentation/resque.rb +0 -4
- data/lib/new_relic/agent/instrumentation/roda.rb +4 -4
- data/lib/new_relic/agent/instrumentation/ruby_kafka/prepend.rb +14 -4
- data/lib/new_relic/agent/instrumentation/ruby_kafka.rb +0 -2
- data/lib/new_relic/agent/instrumentation/sinatra.rb +3 -6
- data/lib/new_relic/agent/instrumentation/thread.rb +0 -2
- data/lib/new_relic/agent/instrumentation/tilt.rb +0 -4
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +0 -1
- data/lib/new_relic/agent/instrumentation/view_component/instrumentation.rb +11 -8
- data/lib/new_relic/agent/instrumentation/view_component.rb +0 -2
- data/lib/new_relic/agent/log_event_aggregator.rb +28 -2
- data/lib/new_relic/agent/span_event_primitive.rb +4 -2
- data/lib/new_relic/control/frameworks/rails4.rb +1 -5
- data/lib/new_relic/dependency_detection.rb +10 -5
- data/lib/new_relic/environment_report.rb +1 -5
- data/lib/new_relic/helper.rb +15 -0
- data/lib/new_relic/language_support.rb +1 -5
- data/lib/new_relic/version.rb +1 -1
- data/lib/sequel/extensions/new_relic_instrumentation.rb +1 -1
- data/lib/tasks/instrumentation_generator/templates/dependency_detection.tt +9 -6
- data/newrelic.yml +116 -41
- data/test/agent_helper.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23ad23d616fbcea334710ab3d67003e1775aedbadaecd7d50932c22543419ef4
|
4
|
+
data.tar.gz: f26ff6b168dc8975354fa1bf7f73f02400d01e2feca735f71b510f92978b3edf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4519cf295a06513f04810805b8428d0cebdbd8aa4731c4e831de0d873c014978396dee436a966c726866246a26b6ced9dcea5fd1bba2c839b6d69b66b00f51d7
|
7
|
+
data.tar.gz: 5e32b59dea295c346c88de6c0cc317d7d2d8981fbe7fed6d2d0d72a6cfb2bd6b2eb5ae006871603757e957e85fe0404b618d4e4cee7afae0189ffebb1770945f
|
data/.build_ignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,56 @@
|
|
1
1
|
# New Relic Ruby Agent Release Notes
|
2
2
|
|
3
|
+
## v9.16.0
|
4
|
+
|
5
|
+
Version 9.16.0 introduces instrumentation for the aws-sdk-lambda gem, allows users to opt-in to adding labels to logs, updates View Component instrumentation, and fixes a bug with explain plans on Rails 7.2+.
|
6
|
+
|
7
|
+
- **Feature: Instrumentation for aws-sdk-lambda**
|
8
|
+
|
9
|
+
If the aws-sdk-lambda gem is present and used to invoke remote AWS Lambda functions, timing and error details for the invocations will be reported to New Relic. [PR#2926](https://github.com/newrelic/newrelic-ruby-agent/pull/2926).
|
10
|
+
|
11
|
+
- **Feature: Add new configuration options to attach custom tags (labels) to logs**
|
12
|
+
|
13
|
+
The Ruby agent now allows you to opt-in to adding your custom tags (labels) to agent-forwarded logs. With custom tags on logs, platform engineers can easily filter, search, and correlate log data for faster and more efficient troubleshooting, improved performance, and optimized resource utilization. [PR#2925](https://github.com/newrelic/newrelic-ruby-agent/pull/2925)
|
14
|
+
|
15
|
+
- **Feature: Update View Component instrumentation+**
|
16
|
+
|
17
|
+
The `.identifier` method will be formally exposed as part of the View Component public API. The agent will now use this method for building metric names when available, ensuring ongoing compatibility with all View Component versions. [PR#2956](https://github.com/newrelic/newrelic-ruby-agent/pull/2956)
|
18
|
+
|
19
|
+
- **Bugfix: Record explain plan traces on Rails 7.2+**
|
20
|
+
|
21
|
+
Rails 7.2 removed adapter-specific connection methods (ex. `ActiveRecord::Base.postgresql_connection`) and replaced them with `ActiveRecord::Base.with_connection`. Our explain plan feature relies on making a connection to the database to create an explain plan trace. Due to a bug in our tests, we missed this regression. Now, the agent uses the new method to fetch explain plans on Rails 7.2+. Thank you, [@gsar](https://github.com/gsar) and [@gstark](https://github.com/gstark) for bringing this to our attention! [Issue#2922](https://github.com/newrelic/newrelic-ruby-agent/issues/2922) [PR#2940](https://github.com/newrelic/newrelic-ruby-agent/pull/2940)
|
22
|
+
|
23
|
+
## v9.15.0
|
24
|
+
|
25
|
+
Version 9.15.0 updates View Component instrumentation to use a default metric name when one is unavailable, adds a configuration option to associate the AWS account ID with the DynamoDB calls from the AWS SDK, resolves a bug in rdkafka instrumentation when using the karafka-rdkafka gem, resolves a bug in the ruby-kafka instrumentation, fixes a bug with Grape instrumentation, and addresses a bug preventing the agent from running in serverless mode in an AWS Lambda layer.
|
26
|
+
|
27
|
+
- **Feature: New configuration option cloud.aws.account_id**
|
28
|
+
|
29
|
+
A new configuration option has been added, `cloud.aws.account_id`, that will allow New Relic to provide more details about certain calls made using the AWS SDK. For example, relationships between AWS services instrumented with New Relic's CloudWatch Metric Streams will have relationships formed in the service map with APM applications. Currently, the DynamoDB instrumentation is the only instrumentation that will make use of this configuration option, but this will be used in future instrumentation as well. [PR#2904](https://github.com/newrelic/newrelic-ruby-agent/pull/2904)
|
30
|
+
|
31
|
+
- **Feature: Use default `View/component` metric name for unidentified View Components**
|
32
|
+
|
33
|
+
Previously, when a View Component metric name could not be identified, the agent would set the name as `nil`. Now, the agent defaults to using `View/component` as the metric name when one can not be identified. [PR#2907](https://github.com/newrelic/newrelic-ruby-agent/pull/2907)
|
34
|
+
|
35
|
+
- **Bugfix: Instrumentation errors when using the karafka-rdkafka gem**
|
36
|
+
|
37
|
+
Due to version differences between the rdkafka gem and karafka-rdkafka gem, the agent could encounter an error when it tried to install rdkafka instrumentation. This has now been resolved. Thank you to @krisdigital for bringing this issue to our attention. [PR#2880](https://github.com/newrelic/newrelic-ruby-agent/pull/2880)
|
38
|
+
|
39
|
+
- **Bugfix: Stop calling deprecated all_specs method to check for the presence of newrelic-grape**
|
40
|
+
|
41
|
+
In 9.14.0, we released a fix for calls to the deprecated `Bundler.rubygems.all_specs`, but the fix fell short for the agent's Grape instrumentation and deprecation warnings could still be raised. The condition has been simplified and deprecation warnings should no longer be raised. Thank you, [@excelsior](https://github.com/excelsior) for bringing this to our attention. [Issue#2885](https://github.com/newrelic/newrelic-ruby-agent/issues/2885) [PR#2906](https://github.com/newrelic/newrelic-ruby-agent/pull/2906)
|
42
|
+
|
43
|
+
- **Bugfix: Instrumentation errors when using the ruby-kafka gem**
|
44
|
+
|
45
|
+
Kafka::Consumer#each_message takes keyword arguments, while the prepended method is defined with a single splat positional argument. In Ruby >= 3.0, this signature mismatch raises an ArgumentError. Thank you [@patrickarnett](https://github.com/patrickarnett) for providing this bugfix. [PR#2915](https://github.com/newrelic/newrelic-ruby-agent/pull/2915)
|
46
|
+
|
47
|
+
- **Bugfix: Restore AWS Lambda layer operational functionality**
|
48
|
+
|
49
|
+
Version 9.14.0 of the agent introduced an optimization related to how the agent handles boolean configuration parameters which inadvertently caused the agent to stop operating properly in an AWS Lambda layer context. [Issue#2919](https://github.com/newrelic/newrelic-ruby-agent/issues/2919)[PR#2920](https://github.com/newrelic/newrelic-ruby-agent/pull/2920)
|
50
|
+
|
3
51
|
## v9.14.0
|
4
52
|
|
5
|
-
Version 9.14.0 adds Apache Kafka instrumentation for the rdkafka and ruby-kafka gems, introduces a configuration-based, automatic way to add custom instrumentation method tracers, correctly captures MIME type for
|
53
|
+
Version 9.14.0 adds Apache Kafka instrumentation for the rdkafka and ruby-kafka gems, introduces a configuration-based, automatic way to add custom instrumentation method tracers, correctly captures MIME type for ActionDispatch 7.0+ requests, properly handles Boolean coercion for `newrelic.yml` configuration, fixes a JRuby bug in the configuration manager, fixes a bug related to `Bundler.rubygems.installed_specs`, and fixes a bug to make the agent compatible with ViewComponent v3.15.0+.
|
6
54
|
|
7
55
|
- **Feature: Add Apache Kafka instrumentation for the rdkafka and ruby-kafka gems**
|
8
56
|
|
@@ -42,13 +90,13 @@ Version 9.14.0 adds Apache Kafka instrumentation for the rdkafka and ruby-kafka
|
|
42
90
|
- MyCompany::User.notify
|
43
91
|
```
|
44
92
|
|
45
|
-
That configuration example uses YAML array syntax to specify both methods. Alternatively, a comma-delimited string
|
93
|
+
That configuration example uses YAML array syntax to specify both methods. Alternatively, you can use a comma-delimited string:
|
46
94
|
|
47
95
|
```
|
48
96
|
automatic_custom_instrumentation_method_list: 'MyCompany::Image#render_png, MyCompany::User.notify'
|
49
97
|
```
|
50
98
|
|
51
|
-
Whitespace around the comma(s) in the list is optional. When configuring the agent with a list of methods via the `NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST` environment variable, this comma-delimited string format
|
99
|
+
Whitespace around the comma(s) in the list is optional. When configuring the agent with a list of methods via the `NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST` environment variable, use this comma-delimited string format:
|
52
100
|
|
53
101
|
```
|
54
102
|
export NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST='MyCompany::Image#render_png, MyCompany::User.notify'
|
@@ -56,7 +104,7 @@ Version 9.14.0 adds Apache Kafka instrumentation for the rdkafka and ruby-kafka
|
|
56
104
|
|
57
105
|
[PR#2851](https://github.com/newrelic/newrelic-ruby-agent/pull/2851)
|
58
106
|
|
59
|
-
- **Feature: Collect just MIME type for
|
107
|
+
- **Feature: Collect just MIME type for ActionDispatch 7.0+ requests**
|
60
108
|
|
61
109
|
Rails 7.0 [introduced changes](https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#actiondispatch-request-content-type-now-returns-content-type-header-as-it-is) to the behavior of `ActionDispatch::Request#content_type`, adding extra request-related details the agent wasn't expecting to collect. Additionally, the agent's use of `content_type ` was triggering deprecation warnings. The agent now uses `ActionDispatch::Request#media_type` to capture the MIME type. Thanks to [@internethostage](https://github.com/internethostage) for letting us know about this change. [Issue#2500](https://github.com/newrelic/newrelic-ruby-agent/issues/2500) [PR#2855](https://github.com/newrelic/newrelic-ruby-agent/pull/2855)
|
62
110
|
|
data/lib/new_relic/agent/aws.rb
CHANGED
@@ -5,58 +5,13 @@
|
|
5
5
|
module NewRelic
|
6
6
|
module Agent
|
7
7
|
module Aws
|
8
|
-
|
9
|
-
|
8
|
+
def self.create_arn(service, resource, region)
|
9
|
+
return unless NewRelic::Agent.config[:'cloud.aws.account_id']
|
10
10
|
|
11
|
-
|
12
|
-
"arn:aws:#{service}:#{region}:#{account_id}:#{resource}"
|
11
|
+
"arn:aws:#{service}:#{region}:#{NewRelic::Agent.config[:'cloud.aws.account_id']}:#{resource}"
|
13
12
|
rescue => e
|
14
13
|
NewRelic::Agent.logger.warn("Failed to create ARN: #{e}")
|
15
14
|
end
|
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
|
-
|
26
|
-
def self.convert_access_key_to_account_id(access_key)
|
27
|
-
decoded_key = Integer(decode_to_hex(access_key[4..-1]), 16)
|
28
|
-
mask = Integer(HEX_MASK, 16)
|
29
|
-
(decoded_key & mask) >> 7
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.decode_to_hex(access_key)
|
33
|
-
bytes = access_key.delete('=').each_char.map { |c| CHARACTERS.index(c) }
|
34
|
-
|
35
|
-
bytes.each_slice(8).map do |section|
|
36
|
-
convert_section(section)
|
37
|
-
end.flatten[0...6].join
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.convert_section(section)
|
41
|
-
buffer = 0
|
42
|
-
section.each do |chunk|
|
43
|
-
buffer = (buffer << 5) + chunk
|
44
|
-
end
|
45
|
-
|
46
|
-
chunk_count = (section.length * 5.0 / 8.0).floor
|
47
|
-
|
48
|
-
if section.length < 8
|
49
|
-
buffer >>= (5 - (chunk_count * 8)) % 5
|
50
|
-
end
|
51
|
-
|
52
|
-
decoded = []
|
53
|
-
chunk_count.times do |i|
|
54
|
-
shift = 8 * (chunk_count - 1 - i)
|
55
|
-
decoded << ((buffer >> shift) & 255).to_s(16)
|
56
|
-
end
|
57
|
-
|
58
|
-
decoded
|
59
|
-
end
|
60
15
|
end
|
61
16
|
end
|
62
17
|
end
|
@@ -427,6 +427,7 @@ module NewRelic
|
|
427
427
|
:public => true,
|
428
428
|
:type => String,
|
429
429
|
:allowed_from_server => false,
|
430
|
+
:exclude_from_reported_settings => true,
|
430
431
|
:description => 'Your New Relic <InlinePopover type="userKey" />. Required when using the New Relic REST API v2 to record deployments using the `newrelic deployments` command.'
|
431
432
|
},
|
432
433
|
:backport_fast_active_record_connection_lookup => {
|
@@ -442,7 +443,7 @@ module NewRelic
|
|
442
443
|
:public => true,
|
443
444
|
:type => String,
|
444
445
|
:allowed_from_server => false,
|
445
|
-
:description => "Manual override for the path to your local CA bundle. This CA bundle
|
446
|
+
:description => "Manual override for the path to your local CA bundle. This CA bundle validates the SSL certificate presented by New Relic's data collection service."
|
446
447
|
},
|
447
448
|
:capture_memcache_keys => {
|
448
449
|
:default => false,
|
@@ -471,6 +472,14 @@ module NewRelic
|
|
471
472
|
:allowed_from_server => false,
|
472
473
|
:description => 'If `true`, the agent will clear `Tracer::State` in `Agent.drop_buffered_data`.'
|
473
474
|
},
|
475
|
+
:'cloud.aws.account_id' => {
|
476
|
+
:default => nil,
|
477
|
+
:public => true,
|
478
|
+
:type => String,
|
479
|
+
:allow_nil => true,
|
480
|
+
:allowed_from_server => false,
|
481
|
+
:description => 'The AWS account ID for the AWS account associated with this app'
|
482
|
+
},
|
474
483
|
:config_path => {
|
475
484
|
:default => DefaultSource.config_path,
|
476
485
|
:public => true,
|
@@ -872,6 +881,21 @@ module NewRelic
|
|
872
881
|
:allowed_from_server => false,
|
873
882
|
:description => 'A hash with key/value pairs to add as custom attributes to all log events forwarded to New Relic. If sending using an environment variable, the value must be formatted like: "key1=value1,key2=value2"'
|
874
883
|
},
|
884
|
+
:'application_logging.forwarding.labels.enabled' => {
|
885
|
+
:default => false,
|
886
|
+
:public => true,
|
887
|
+
:type => Boolean,
|
888
|
+
:allowed_from_server => false,
|
889
|
+
:description => 'If `true`, the agent attaches [labels](https://docs.newrelic.com/docs/apm/agents/ruby-agent/configuration/ruby-agent-configuration/#labels) to log records.'
|
890
|
+
},
|
891
|
+
:'application_logging.forwarding.labels.exclude' => {
|
892
|
+
:default => [],
|
893
|
+
:public => true,
|
894
|
+
:type => Array,
|
895
|
+
:transform => DefaultSource.method(:convert_to_list),
|
896
|
+
:allowed_from_server => false,
|
897
|
+
:description => 'A case-insensitive array or comma-delimited string containing the labels to exclude from log records.'
|
898
|
+
},
|
875
899
|
:'application_logging.forwarding.max_samples_stored' => {
|
876
900
|
:default => 10000,
|
877
901
|
:public => true,
|
@@ -1159,13 +1183,13 @@ module NewRelic
|
|
1159
1183
|
:allowed_from_server => false,
|
1160
1184
|
:transform => proc { |arr| NewRelic::Agent.add_automatic_method_tracers(arr) },
|
1161
1185
|
:description => <<~DESCRIPTION
|
1162
|
-
An array of `CLASS#METHOD` (for instance methods) and/or `CLASS.METHOD` (for class methods) strings representing Ruby methods
|
1186
|
+
An array of `CLASS#METHOD` (for instance methods) and/or `CLASS.METHOD` (for class methods) strings representing Ruby methods that the agent can automatically add custom instrumentation to. This doesn't require any modifications of the source code that defines the methods.
|
1163
1187
|
|
1164
1188
|
Use fully qualified class names (using the `::` delimiter) that include any module or class namespacing.
|
1165
1189
|
|
1166
1190
|
Here is some Ruby source code that defines a `render_png` instance method for an `Image` class and a `notify` class method for a `User` class, both within a `MyCompany` module namespace:
|
1167
1191
|
|
1168
|
-
```
|
1192
|
+
```rb
|
1169
1193
|
module MyCompany
|
1170
1194
|
class Image
|
1171
1195
|
def render_png
|
@@ -1183,21 +1207,21 @@ module NewRelic
|
|
1183
1207
|
|
1184
1208
|
Given that source code, the `newrelic.yml` config file might request instrumentation for both of these methods like so:
|
1185
1209
|
|
1186
|
-
```
|
1210
|
+
```yaml
|
1187
1211
|
automatic_custom_instrumentation_method_list:
|
1188
1212
|
- MyCompany::Image#render_png
|
1189
1213
|
- MyCompany::User.notify
|
1190
1214
|
```
|
1191
1215
|
|
1192
|
-
That configuration example uses YAML array syntax to specify both methods. Alternatively, a comma-delimited string
|
1216
|
+
That configuration example uses YAML array syntax to specify both methods. Alternatively, you can use a comma-delimited string:
|
1193
1217
|
|
1194
|
-
```
|
1218
|
+
```yaml
|
1195
1219
|
automatic_custom_instrumentation_method_list: 'MyCompany::Image#render_png, MyCompany::User.notify'
|
1196
1220
|
```
|
1197
1221
|
|
1198
|
-
Whitespace around the comma(s) in the list is optional. When configuring the agent with a list of methods via the `NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST` environment variable, this comma-delimited string format
|
1222
|
+
Whitespace around the comma(s) in the list is optional. When configuring the agent with a list of methods via the `NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST` environment variable, use this comma-delimited string format:
|
1199
1223
|
|
1200
|
-
```
|
1224
|
+
```sh
|
1201
1225
|
export NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST='MyCompany::Image#render_png, MyCompany::User.notify'
|
1202
1226
|
```
|
1203
1227
|
DESCRIPTION
|
@@ -1528,6 +1552,15 @@ module NewRelic
|
|
1528
1552
|
:allowed_from_server => false,
|
1529
1553
|
:description => 'Controls auto-instrumentation of bunny at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
|
1530
1554
|
},
|
1555
|
+
:'instrumentation.aws_sdk_lambda' => {
|
1556
|
+
:default => 'auto',
|
1557
|
+
:documentation_default => 'auto',
|
1558
|
+
:public => true,
|
1559
|
+
:type => String,
|
1560
|
+
:dynamic_name => true,
|
1561
|
+
:allowed_from_server => false,
|
1562
|
+
:description => 'Controls auto-instrumentation of the aws_sdk_lambda library at start-up. May be one of `auto`, `prepend`, `chain`, `disabled`.'
|
1563
|
+
},
|
1531
1564
|
:'instrumentation.ruby_kafka' => {
|
1532
1565
|
:default => 'auto',
|
1533
1566
|
:public => true,
|
@@ -1892,8 +1925,8 @@ module NewRelic
|
|
1892
1925
|
An array of strings to specify which keys and/or values inside a Stripe event's `user_data` hash should
|
1893
1926
|
not be reported to New Relic. Each string in this array will be turned into a regular expression via
|
1894
1927
|
`Regexp.new` to permit advanced matching. For each hash pair, if either the key or value is matched the
|
1895
|
-
pair will not be reported. By default, no `user_data` is reported
|
1896
|
-
|
1928
|
+
pair will not be reported. By default, no `user_data` is reported. Use this option only if the
|
1929
|
+
`stripe.user_data.include` option is also used.
|
1897
1930
|
DESCRIPTION
|
1898
1931
|
},
|
1899
1932
|
:'instrumentation.thread' => {
|
@@ -2656,7 +2689,7 @@ module NewRelic
|
|
2656
2689
|
:public => true,
|
2657
2690
|
:type => Boolean,
|
2658
2691
|
:allowed_from_server => false,
|
2659
|
-
:description => "If `true`, the security agent is loaded (a Ruby 'require'
|
2692
|
+
:description => "If `true`, the security agent is loaded (the agent performs a Ruby 'require')"
|
2660
2693
|
},
|
2661
2694
|
:'security.enabled' => {
|
2662
2695
|
:default => false,
|
@@ -2685,47 +2718,196 @@ module NewRelic
|
|
2685
2718
|
:description => 'Defines the endpoint URL for posting security-related data',
|
2686
2719
|
:dynamic_name => true
|
2687
2720
|
},
|
2688
|
-
:'security.
|
2689
|
-
:default =>
|
2721
|
+
:'security.application_info.port' => {
|
2722
|
+
:default => nil,
|
2723
|
+
:allow_nil => true,
|
2724
|
+
:public => true,
|
2725
|
+
:type => Integer,
|
2726
|
+
:external => true,
|
2727
|
+
:allowed_from_server => false,
|
2728
|
+
:description => 'The port the application is listening on. This setting is mandatory for Passenger servers. The agent detects other servers by default.'
|
2729
|
+
},
|
2730
|
+
:'security.exclude_from_iast_scan.api' => {
|
2731
|
+
:default => [],
|
2732
|
+
:public => true,
|
2733
|
+
:type => Array,
|
2734
|
+
:external => true,
|
2735
|
+
:allowed_from_server => true,
|
2736
|
+
:transform => DefaultSource.method(:convert_to_list),
|
2737
|
+
:description => 'Defines API paths the security agent should ignore in IAST scans. Accepts an array of regex patterns matching the URI to ignore. The regex pattern should find a complete match for the URL without the endpoint. For example, `[".*account.*"], [".*/\api\/v1\/.*?\/login"]`'
|
2738
|
+
},
|
2739
|
+
:'security.exclude_from_iast_scan.http_request_parameters.header' => {
|
2740
|
+
:default => [],
|
2741
|
+
:public => true,
|
2742
|
+
:type => Array,
|
2743
|
+
:external => true,
|
2744
|
+
:allowed_from_server => true,
|
2745
|
+
:transform => DefaultSource.method(:convert_to_list),
|
2746
|
+
:description => 'An array of HTTP request headers the security agent should ignore in IAST scans. The array should specify a list of patterns matching the headers to ignore.'
|
2747
|
+
},
|
2748
|
+
:'security.exclude_from_iast_scan.http_request_parameters.query' => {
|
2749
|
+
:default => [],
|
2750
|
+
:public => true,
|
2751
|
+
:type => Array,
|
2752
|
+
:external => true,
|
2753
|
+
:allowed_from_server => true,
|
2754
|
+
:transform => DefaultSource.method(:convert_to_list),
|
2755
|
+
:description => 'An array of HTTP request query parameters the security agent should ignore in IAST scans. The array should specify a list of patterns matching the HTTP request query parameters to ignore.'
|
2756
|
+
},
|
2757
|
+
:'security.exclude_from_iast_scan.http_request_parameters.body' => {
|
2758
|
+
:default => [],
|
2759
|
+
:public => true,
|
2760
|
+
:type => Array,
|
2761
|
+
:external => true,
|
2762
|
+
:allowed_from_server => true,
|
2763
|
+
:transform => DefaultSource.method(:convert_to_list),
|
2764
|
+
:description => 'An array of HTTP request body keys the security agent should ignore in IAST scans.'
|
2765
|
+
},
|
2766
|
+
:'security.exclude_from_iast_scan.iast_detection_category.insecure_settings' => {
|
2767
|
+
:default => false,
|
2690
2768
|
:external => true,
|
2691
2769
|
:public => true,
|
2692
2770
|
:type => Boolean,
|
2693
2771
|
:allowed_from_server => false,
|
2694
|
-
:description => 'If `true`,
|
2772
|
+
:description => 'If `true`, disables the detection of low-severity insecure settings. For example, hash, crypto, cookie, random generators, trust boundary).'
|
2695
2773
|
},
|
2696
|
-
:'security.
|
2697
|
-
:default =>
|
2774
|
+
:'security.exclude_from_iast_scan.iast_detection_category.invalid_file_access' => {
|
2775
|
+
:default => false,
|
2698
2776
|
:external => true,
|
2699
2777
|
:public => true,
|
2700
2778
|
:type => Boolean,
|
2701
2779
|
:allowed_from_server => false,
|
2702
|
-
:description => 'If `true`,
|
2780
|
+
:description => 'If `true`, disables file operation-related IAST detections (File Access & Application integrity violation)'
|
2703
2781
|
},
|
2704
|
-
:'security.
|
2705
|
-
:default =>
|
2782
|
+
:'security.exclude_from_iast_scan.iast_detection_category.sql_injection' => {
|
2783
|
+
:default => false,
|
2706
2784
|
:external => true,
|
2707
2785
|
:public => true,
|
2708
2786
|
:type => Boolean,
|
2709
2787
|
:allowed_from_server => false,
|
2710
|
-
:description => 'If `true`,
|
2788
|
+
:description => 'If `true`, disables SQL injection detection in IAST scans.'
|
2711
2789
|
},
|
2712
|
-
:'security.
|
2713
|
-
:default =>
|
2714
|
-
:
|
2790
|
+
:'security.exclude_from_iast_scan.iast_detection_category.nosql_injection' => {
|
2791
|
+
:default => false,
|
2792
|
+
:external => true,
|
2715
2793
|
:public => true,
|
2716
|
-
:type =>
|
2794
|
+
:type => Boolean,
|
2795
|
+
:allowed_from_server => false,
|
2796
|
+
:description => 'If `true`, disables NOSQL injection detection in IAST scans.'
|
2797
|
+
},
|
2798
|
+
:'security.exclude_from_iast_scan.iast_detection_category.ldap_injection' => {
|
2799
|
+
:default => false,
|
2717
2800
|
:external => true,
|
2801
|
+
:public => true,
|
2802
|
+
:type => Boolean,
|
2718
2803
|
:allowed_from_server => false,
|
2719
|
-
:description => '
|
2804
|
+
:description => 'If `true`, disables LDAP injection detection in IAST scans.'
|
2720
2805
|
},
|
2721
|
-
:'security.
|
2722
|
-
:default =>
|
2723
|
-
:
|
2806
|
+
:'security.exclude_from_iast_scan.iast_detection_category.javascript_injection' => {
|
2807
|
+
:default => false,
|
2808
|
+
:external => true,
|
2809
|
+
:public => true,
|
2810
|
+
:type => Boolean,
|
2811
|
+
:allowed_from_server => false,
|
2812
|
+
:description => 'If `true`, disables Javascript injection detection in IAST scans.'
|
2813
|
+
},
|
2814
|
+
:'security.exclude_from_iast_scan.iast_detection_category.command_injection' => {
|
2815
|
+
:default => false,
|
2816
|
+
:external => true,
|
2817
|
+
:public => true,
|
2818
|
+
:type => Boolean,
|
2819
|
+
:allowed_from_server => false,
|
2820
|
+
:description => 'If `true`, disables system command injection detection in IAST scans.'
|
2821
|
+
},
|
2822
|
+
:'security.exclude_from_iast_scan.iast_detection_category.xpath_injection' => {
|
2823
|
+
:default => false,
|
2824
|
+
:external => true,
|
2825
|
+
:public => true,
|
2826
|
+
:type => Boolean,
|
2827
|
+
:allowed_from_server => false,
|
2828
|
+
:description => 'If `true`, disables XPATH injection detection in IAST scans.'
|
2829
|
+
},
|
2830
|
+
:'security.exclude_from_iast_scan.iast_detection_category.ssrf' => {
|
2831
|
+
:default => false,
|
2832
|
+
:external => true,
|
2833
|
+
:public => true,
|
2834
|
+
:type => Boolean,
|
2835
|
+
:allowed_from_server => false,
|
2836
|
+
:description => 'If `true`, disables Sever-Side Request Forgery (SSRF) detection in IAST scans.'
|
2837
|
+
},
|
2838
|
+
:'security.exclude_from_iast_scan.iast_detection_category.rxss' => {
|
2839
|
+
:default => false,
|
2840
|
+
:external => true,
|
2841
|
+
:public => true,
|
2842
|
+
:type => Boolean,
|
2843
|
+
:allowed_from_server => false,
|
2844
|
+
:description => 'If `true`, disables Reflected Cross-Site Scripting (RXSS) detection in IAST scans.'
|
2845
|
+
},
|
2846
|
+
:'security.scan_schedule.delay' => {
|
2847
|
+
:default => 0,
|
2724
2848
|
:public => true,
|
2725
2849
|
:type => Integer,
|
2726
2850
|
:external => true,
|
2851
|
+
:allowed_from_server => true,
|
2852
|
+
:description => 'Specifies the delay time (in minutes) before the IAST scan begins after the application starts.'
|
2853
|
+
},
|
2854
|
+
:'security.scan_schedule.duration' => {
|
2855
|
+
:default => 0,
|
2856
|
+
:public => true,
|
2857
|
+
:type => Integer,
|
2858
|
+
:external => true,
|
2859
|
+
:allowed_from_server => true,
|
2860
|
+
:description => 'Specifies the length of time (in minutes) that the IAST scan will run.'
|
2861
|
+
},
|
2862
|
+
:'security.scan_schedule.schedule' => {
|
2863
|
+
:default => '',
|
2864
|
+
:public => true,
|
2865
|
+
:type => String,
|
2866
|
+
:external => true,
|
2867
|
+
:allowed_from_server => true,
|
2868
|
+
:description => 'Specifies a cron expression that sets when the IAST scan should run.',
|
2869
|
+
:dynamic_name => true
|
2870
|
+
},
|
2871
|
+
:'security.scan_schedule.always_sample_traces' => {
|
2872
|
+
:default => false,
|
2873
|
+
:external => true,
|
2874
|
+
:public => true,
|
2875
|
+
:type => Boolean,
|
2727
2876
|
:allowed_from_server => false,
|
2728
|
-
:description => '
|
2877
|
+
:description => 'If `true`, allows IAST to continuously gather trace data in the background. Collected data will be used by the security agent to perform an IAST scan at the scheduled time.'
|
2878
|
+
},
|
2879
|
+
:'security.scan_controllers.iast_scan_request_rate_limit' => {
|
2880
|
+
:default => 3600,
|
2881
|
+
:public => true,
|
2882
|
+
:type => Integer,
|
2883
|
+
:external => true,
|
2884
|
+
:allowed_from_server => true,
|
2885
|
+
:description => 'Sets the maximum number of HTTP requests allowed for the IAST scan per minute. Any Integer between 12 and 3600 is valid. The default value is 3600.'
|
2886
|
+
},
|
2887
|
+
:'security.scan_controllers.scan_instance_count' => {
|
2888
|
+
:default => 0,
|
2889
|
+
:public => true,
|
2890
|
+
:type => Integer,
|
2891
|
+
:external => true,
|
2892
|
+
:allowed_from_server => true,
|
2893
|
+
:description => 'The number of application instances for a specific entity to perform IAST analysis on.'
|
2894
|
+
},
|
2895
|
+
:'security.scan_controllers.report_http_response_body' => {
|
2896
|
+
:default => true,
|
2897
|
+
:public => true,
|
2898
|
+
:type => Boolean,
|
2899
|
+
:external => true,
|
2900
|
+
:allowed_from_server => true,
|
2901
|
+
:description => 'If `true`, enables the sending of HTTP responses bodies. Disabling this also disables Reflected Cross-Site Scripting (RXSS) vulnerability detection.'
|
2902
|
+
},
|
2903
|
+
:'security.iast_test_identifier' => {
|
2904
|
+
:default => nil,
|
2905
|
+
:allow_nil => true,
|
2906
|
+
:public => true,
|
2907
|
+
:type => String,
|
2908
|
+
:external => true,
|
2909
|
+
:allowed_from_server => true,
|
2910
|
+
:description => 'A unique test identifier when runnning IAST in a CI/CD environment to differentiate between different test runs. For example, a build number.'
|
2729
2911
|
}
|
2730
2912
|
}.freeze
|
2731
2913
|
# rubocop:enable Metrics/CollectionLiteralLength
|
@@ -143,7 +143,7 @@ module NewRelic
|
|
143
143
|
return default if default
|
144
144
|
|
145
145
|
boolean = enforce_boolean(key, value)
|
146
|
-
|
146
|
+
evaluated = boolean if [true, false].include?(boolean)
|
147
147
|
|
148
148
|
apply_transformations(key, evaluated)
|
149
149
|
end
|
@@ -90,6 +90,42 @@ module NewRelic
|
|
90
90
|
ConnectionManager.instance.get_connection(config, &connector)
|
91
91
|
end
|
92
92
|
|
93
|
+
def explain_this(statement, use_execute = false)
|
94
|
+
if supports_with_connection?
|
95
|
+
explain_this_using_with_connection(statement)
|
96
|
+
else
|
97
|
+
explain_this_using_adapter_connection(statement, use_execute)
|
98
|
+
end
|
99
|
+
rescue => e
|
100
|
+
NewRelic::Agent.logger.error("Couldn't fetch the explain plan for statement: #{e}")
|
101
|
+
end
|
102
|
+
|
103
|
+
def explain_this_using_with_connection(statement)
|
104
|
+
::ActiveRecord::Base.with_connection do |conn|
|
105
|
+
conn.exec_query("EXPLAIN #{statement.sql}", "Explain #{statement.name}", statement.binds)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def explain_this_using_adapter_connection(statement, use_execute)
|
110
|
+
connection = get_connection(statement.config) do
|
111
|
+
::ActiveRecord::Base.send(:"#{statement.config[:adapter]}_connection", statement.config)
|
112
|
+
end
|
113
|
+
|
114
|
+
if use_execute
|
115
|
+
connection.execute("EXPLAIN #{statement.sql}")
|
116
|
+
else
|
117
|
+
connection.exec_query("EXPLAIN #{statement.sql}", "Explain #{statement.name}", statement.binds)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
# ActiveRecord v7.2.0 introduced with_connection
|
122
|
+
def supports_with_connection?
|
123
|
+
return @supports_with_connection if defined?(@supports_with_connection)
|
124
|
+
|
125
|
+
@supports_with_connection = defined?(::ActiveRecord::VERSION::STRING) &&
|
126
|
+
Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new('7.2.0')
|
127
|
+
end
|
128
|
+
|
93
129
|
def close_connections
|
94
130
|
ConnectionManager.instance.close_connections
|
95
131
|
end
|
@@ -9,14 +9,7 @@ module NewRelic
|
|
9
9
|
module Instrumentation
|
10
10
|
module ActiveRecord
|
11
11
|
EXPLAINER = lambda do |statement|
|
12
|
-
|
13
|
-
::ActiveRecord::Base.send("#{statement.config[:adapter]}_connection",
|
14
|
-
statement.config)
|
15
|
-
end
|
16
|
-
# the following line needs else branch coverage
|
17
|
-
if connection && connection.respond_to?(:execute) # rubocop:disable Style/SafeNavigation
|
18
|
-
return connection.execute("EXPLAIN #{statement.sql}")
|
19
|
-
end
|
12
|
+
NewRelic::Agent::Database.explain_this(statement, true)
|
20
13
|
end
|
21
14
|
|
22
15
|
def self.insert_instrumentation
|
@@ -70,18 +70,7 @@ module NewRelic
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def get_explain_plan(statement)
|
73
|
-
|
74
|
-
::ActiveRecord::Base.send("#{statement.config[:adapter]}_connection",
|
75
|
-
statement.config)
|
76
|
-
end
|
77
|
-
# the following line needs else branch coverage
|
78
|
-
if connection && connection.respond_to?(:exec_query) # rubocop:disable Style/SafeNavigation
|
79
|
-
return connection.exec_query("EXPLAIN #{statement.sql}",
|
80
|
-
"Explain #{statement.name}",
|
81
|
-
statement.binds)
|
82
|
-
end
|
83
|
-
rescue => e
|
84
|
-
NewRelic::Agent.logger.debug("Couldn't fetch the explain plan for #{statement} due to #{e}")
|
73
|
+
NewRelic::Agent::Database.explain_this(statement)
|
85
74
|
end
|
86
75
|
|
87
76
|
def active_record_config(payload)
|
@@ -12,8 +12,6 @@ DependencyDetection.defer do
|
|
12
12
|
depends_on { defined?(ActiveSupport::BroadcastLogger) }
|
13
13
|
|
14
14
|
executes do
|
15
|
-
NewRelic::Agent.logger.info('Installing ActiveSupport::BroadcastLogger instrumentation')
|
16
|
-
|
17
15
|
if use_prepend?
|
18
16
|
prepend_instrument ActiveSupport::BroadcastLogger, NewRelic::Agent::Instrumentation::ActiveSupportBroadcastLogger::Prepend
|
19
17
|
else
|
@@ -14,8 +14,6 @@ DependencyDetection.defer do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
executes do
|
17
|
-
NewRelic::Agent.logger.info('Installing ActiveSupport::Logger instrumentation')
|
18
|
-
|
19
17
|
if use_prepend?
|
20
18
|
# the only method currently instrumented is a class method
|
21
19
|
prepend_instrument ActiveSupport::Logger.singleton_class, NewRelic::Agent::Instrumentation::ActiveSupportLogger::Prepend
|
@@ -16,9 +16,8 @@ DependencyDetection.defer do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
executes do
|
19
|
-
NewRelic::Agent.logger.info('Installing async_http instrumentation')
|
20
|
-
|
21
19
|
require 'async/http/internet'
|
20
|
+
|
22
21
|
if use_prepend?
|
23
22
|
prepend_instrument Async::HTTP::Internet, NewRelic::Agent::Instrumentation::AsyncHttp::Prepend
|
24
23
|
else
|