newrelic_rpm 9.15.0 → 9.16.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -3
- data/lib/new_relic/agent/aws.rb +54 -3
- data/lib/new_relic/agent/configuration/default_source.rb +203 -30
- data/lib/new_relic/agent/database.rb +39 -0
- data/lib/new_relic/agent/instrumentation/active_record.rb +1 -8
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +3 -0
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +1 -12
- data/lib/new_relic/agent/instrumentation/aws_sdk_lambda/chain.rb +33 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_lambda/instrumentation.rb +93 -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/dynamodb/instrumentation.rb +7 -1
- data/lib/new_relic/agent/instrumentation/view_component/instrumentation.rb +5 -1
- data/lib/new_relic/agent/log_event_aggregator.rb +28 -2
- data/lib/new_relic/agent.rb +2 -2
- data/lib/new_relic/version.rb +2 -2
- data/newrelic.yml +119 -49
- 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: 4188543c2c5d39ce13735a832e955f9ec211bdce6e83b29a37414cd78d23ff84
|
4
|
+
data.tar.gz: 84431c682fb000ddcd0b520c39b3a8b358535fb580af32d41520d26471b02944
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6994d2922b5a327883c2143b3deb22e01eafb8b0e78bca60a71c6a8726ed29e48b391fdb2e2e60ee86681ffe88c8782c5cd4975ab169247fd9b61527e0090149
|
7
|
+
data.tar.gz: c10cf492bd247b12fe47203e8fb5a8d17e067a7d2807e39ec144dda958101e0d334fcd29234d3657cf2d6d73bd3f67f9cb89847252d08be178caadc236e46d70
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,38 @@
|
|
1
1
|
# New Relic Ruby Agent Release Notes
|
2
2
|
|
3
|
+
## v9.16.1
|
4
|
+
|
5
|
+
- **Bugfix: Add support for Trilogy database adapter**
|
6
|
+
|
7
|
+
The agent now fully supports Trilogy, a client library for MySQL-compatible database servers, and correctly lists MySQL as the corresponding database in the UI. [PR#2966](https://github.com/newrelic/newrelic-ruby-agent/pull/2966).
|
8
|
+
|
9
|
+
## v9.16.0
|
10
|
+
|
11
|
+
Version 9.16.0 introduces the following features and bug fixes:
|
12
|
+
|
13
|
+
- **Feature: Instrumentation for aws-sdk-lambda**
|
14
|
+
|
15
|
+
When the aws-sdk-lambda gem is available and used to invoke remote AWS Lambda functions, the timing and error details of the invocations will be reported to New Relic. [PR#2926](https://github.com/newrelic/newrelic-ruby-agent/pull/2926).
|
16
|
+
|
17
|
+
- **Feature: Add new configuration options to attach custom tags (labels) to logs**
|
18
|
+
|
19
|
+
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)
|
20
|
+
|
21
|
+
- **Feature: Update View Component instrumentation+**
|
22
|
+
|
23
|
+
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)
|
24
|
+
|
25
|
+
- **Bugfix: Record explain plan traces on Rails 7.2+**
|
26
|
+
|
27
|
+
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)
|
28
|
+
|
3
29
|
## v9.15.0
|
4
30
|
|
5
|
-
Version 9.15.0 updates View
|
6
|
-
|
31
|
+
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.
|
32
|
+
|
7
33
|
- **Feature: New configuration option cloud.aws.account_id**
|
8
34
|
|
9
|
-
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.
|
35
|
+
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)
|
10
36
|
|
11
37
|
- **Feature: Use default `View/component` metric name for unidentified View Components**
|
12
38
|
|
data/lib/new_relic/agent/aws.rb
CHANGED
@@ -5,13 +5,64 @@
|
|
5
5
|
module NewRelic
|
6
6
|
module Agent
|
7
7
|
module Aws
|
8
|
-
|
9
|
-
|
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
|
+
HEX_MASK = '7fffffffff80'
|
10
10
|
|
11
|
-
|
11
|
+
def self.create_arn(service, resource, region, account_id)
|
12
|
+
# if any of the values are nil, we can't create an ARN
|
13
|
+
return unless service && resource && region && account_id
|
14
|
+
|
15
|
+
"arn:aws:#{service}:#{region}:#{account_id}:#{resource}"
|
12
16
|
rescue => e
|
13
17
|
NewRelic::Agent.logger.warn("Failed to create ARN: #{e}")
|
14
18
|
end
|
19
|
+
|
20
|
+
def self.get_account_id(config)
|
21
|
+
# if it is set in the agent config, use that first
|
22
|
+
return NewRelic::Agent.config[:'cloud.aws.account_id'] if NewRelic::Agent.config[:'cloud.aws.account_id']
|
23
|
+
|
24
|
+
access_key_id = config.credentials.credentials.access_key_id if config&.credentials&.credentials&.respond_to?(:access_key_id)
|
25
|
+
return unless access_key_id
|
26
|
+
|
27
|
+
NewRelic::Agent::Aws.convert_access_key_to_account_id(access_key_id)
|
28
|
+
rescue => e
|
29
|
+
NewRelic::Agent.logger.debug("Failed to create account id: #{e}")
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.convert_access_key_to_account_id(access_key)
|
33
|
+
decoded_key = Integer(decode_to_hex(access_key[4..-1]), 16)
|
34
|
+
mask = Integer(HEX_MASK, 16)
|
35
|
+
(decoded_key & mask) >> 7
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.decode_to_hex(access_key)
|
39
|
+
bytes = access_key.delete('=').each_char.map { |c| CHARACTERS.index(c) }
|
40
|
+
|
41
|
+
bytes.each_slice(8).map do |section|
|
42
|
+
convert_section(section)
|
43
|
+
end.flatten[0...6].join
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.convert_section(section)
|
47
|
+
buffer = 0
|
48
|
+
section.each do |chunk|
|
49
|
+
buffer = (buffer << 5) + chunk
|
50
|
+
end
|
51
|
+
|
52
|
+
chunk_count = (section.length * 5.0 / 8.0).floor
|
53
|
+
|
54
|
+
if section.length < 8
|
55
|
+
buffer >>= (5 - (chunk_count * 8)) % 5
|
56
|
+
end
|
57
|
+
|
58
|
+
decoded = []
|
59
|
+
chunk_count.times do |i|
|
60
|
+
shift = 8 * (chunk_count - 1 - i)
|
61
|
+
decoded << ((buffer >> shift) & 255).to_s(16)
|
62
|
+
end
|
63
|
+
|
64
|
+
decoded
|
65
|
+
end
|
15
66
|
end
|
16
67
|
end
|
17
68
|
end
|
@@ -443,7 +443,7 @@ module NewRelic
|
|
443
443
|
:public => true,
|
444
444
|
:type => String,
|
445
445
|
:allowed_from_server => false,
|
446
|
-
: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."
|
447
447
|
},
|
448
448
|
:capture_memcache_keys => {
|
449
449
|
:default => false,
|
@@ -646,7 +646,7 @@ module NewRelic
|
|
646
646
|
:public => true,
|
647
647
|
:type => Boolean,
|
648
648
|
:allowed_from_server => true,
|
649
|
-
:description =>
|
649
|
+
:description => "If `true`, enables the collection of explain plans in transaction traces. This setting will also apply to explain plans in slow SQL traces if [`slow_sql.explain_enabled`](#slow_sql-explain_enabled) isn't set separately."
|
650
650
|
},
|
651
651
|
:'transaction_tracer.explain_threshold' => {
|
652
652
|
:default => 0.5,
|
@@ -881,6 +881,21 @@ module NewRelic
|
|
881
881
|
:allowed_from_server => false,
|
882
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"'
|
883
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
|
+
},
|
884
899
|
:'application_logging.forwarding.max_samples_stored' => {
|
885
900
|
:default => 10000,
|
886
901
|
:public => true,
|
@@ -1174,7 +1189,7 @@ module NewRelic
|
|
1174
1189
|
|
1175
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:
|
1176
1191
|
|
1177
|
-
```
|
1192
|
+
```rb
|
1178
1193
|
module MyCompany
|
1179
1194
|
class Image
|
1180
1195
|
def render_png
|
@@ -1192,7 +1207,7 @@ module NewRelic
|
|
1192
1207
|
|
1193
1208
|
Given that source code, the `newrelic.yml` config file might request instrumentation for both of these methods like so:
|
1194
1209
|
|
1195
|
-
```
|
1210
|
+
```yaml
|
1196
1211
|
automatic_custom_instrumentation_method_list:
|
1197
1212
|
- MyCompany::Image#render_png
|
1198
1213
|
- MyCompany::User.notify
|
@@ -1200,13 +1215,13 @@ module NewRelic
|
|
1200
1215
|
|
1201
1216
|
That configuration example uses YAML array syntax to specify both methods. Alternatively, you can use a comma-delimited string:
|
1202
1217
|
|
1203
|
-
```
|
1218
|
+
```yaml
|
1204
1219
|
automatic_custom_instrumentation_method_list: 'MyCompany::Image#render_png, MyCompany::User.notify'
|
1205
1220
|
```
|
1206
1221
|
|
1207
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:
|
1208
1223
|
|
1209
|
-
```
|
1224
|
+
```sh
|
1210
1225
|
export NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST='MyCompany::Image#render_png, MyCompany::User.notify'
|
1211
1226
|
```
|
1212
1227
|
DESCRIPTION
|
@@ -1537,6 +1552,15 @@ module NewRelic
|
|
1537
1552
|
:allowed_from_server => false,
|
1538
1553
|
:description => 'Controls auto-instrumentation of bunny at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
|
1539
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
|
+
},
|
1540
1564
|
:'instrumentation.ruby_kafka' => {
|
1541
1565
|
:default => 'auto',
|
1542
1566
|
:public => true,
|
@@ -1887,7 +1911,7 @@ module NewRelic
|
|
1887
1911
|
:description => <<~DESCRIPTION
|
1888
1912
|
An array of strings to specify which keys inside a Stripe event's `user_data` hash should be reported
|
1889
1913
|
to New Relic. Each string in this array will be turned into a regular expression via `Regexp.new` to
|
1890
|
-
|
1914
|
+
enable advanced matching. Setting the value to `["."]` will report all `user_data`.
|
1891
1915
|
DESCRIPTION
|
1892
1916
|
},
|
1893
1917
|
:'stripe.user_data.exclude' => {
|
@@ -1900,9 +1924,9 @@ module NewRelic
|
|
1900
1924
|
:description => <<~DESCRIPTION
|
1901
1925
|
An array of strings to specify which keys and/or values inside a Stripe event's `user_data` hash should
|
1902
1926
|
not be reported to New Relic. Each string in this array will be turned into a regular expression via
|
1903
|
-
`Regexp.new` to permit advanced matching. For each hash pair, if either the key or value is matched the
|
1904
|
-
|
1905
|
-
|
1927
|
+
`Regexp.new` to permit advanced matching. For each hash pair, if either the key or value is matched the pair
|
1928
|
+
isn't reported. By default, no `user_data` is reported. Use this option only if the
|
1929
|
+
`stripe.user_data.include` option is also used.
|
1906
1930
|
DESCRIPTION
|
1907
1931
|
},
|
1908
1932
|
:'instrumentation.thread' => {
|
@@ -2045,7 +2069,7 @@ module NewRelic
|
|
2045
2069
|
:transform => proc { |bool| NewRelic::Agent::ServerlessHandler.env_var_set? || bool },
|
2046
2070
|
:description => 'If `true`, the agent will operate in a streamlined mode suitable for use with short-lived ' \
|
2047
2071
|
'serverless functions. NOTE: Only AWS Lambda functions are supported currently and this ' \
|
2048
|
-
"option
|
2072
|
+
"option isn't intended for use without [New Relic's Ruby Lambda layer](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/get-started/monitoring-aws-lambda-serverless-monitoring/) offering."
|
2049
2073
|
},
|
2050
2074
|
# Sidekiq
|
2051
2075
|
:'sidekiq.args.include' => {
|
@@ -2665,7 +2689,7 @@ module NewRelic
|
|
2665
2689
|
:public => true,
|
2666
2690
|
:type => Boolean,
|
2667
2691
|
:allowed_from_server => false,
|
2668
|
-
:description => "If `true`, the security agent
|
2692
|
+
:description => "If `true`, the security agent loads (the agent performs a Ruby 'require')"
|
2669
2693
|
},
|
2670
2694
|
:'security.enabled' => {
|
2671
2695
|
:default => false,
|
@@ -2694,47 +2718,196 @@ module NewRelic
|
|
2694
2718
|
:description => 'Defines the endpoint URL for posting security-related data',
|
2695
2719
|
:dynamic_name => true
|
2696
2720
|
},
|
2697
|
-
:'security.
|
2698
|
-
: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,
|
2699
2768
|
:external => true,
|
2700
2769
|
:public => true,
|
2701
2770
|
:type => Boolean,
|
2702
2771
|
:allowed_from_server => false,
|
2703
|
-
:description => 'If `true`,
|
2772
|
+
:description => 'If `true`, disables the detection of low-severity insecure settings. For example, hash, crypto, cookie, random generators, trust boundary).'
|
2704
2773
|
},
|
2705
|
-
:'security.
|
2706
|
-
:default =>
|
2774
|
+
:'security.exclude_from_iast_scan.iast_detection_category.invalid_file_access' => {
|
2775
|
+
:default => false,
|
2707
2776
|
:external => true,
|
2708
2777
|
:public => true,
|
2709
2778
|
:type => Boolean,
|
2710
2779
|
:allowed_from_server => false,
|
2711
|
-
:description => 'If `true`,
|
2780
|
+
:description => 'If `true`, disables file operation-related IAST detections (File Access & Application integrity violation)'
|
2712
2781
|
},
|
2713
|
-
:'security.
|
2714
|
-
:default =>
|
2782
|
+
:'security.exclude_from_iast_scan.iast_detection_category.sql_injection' => {
|
2783
|
+
:default => false,
|
2715
2784
|
:external => true,
|
2716
2785
|
:public => true,
|
2717
2786
|
:type => Boolean,
|
2718
2787
|
:allowed_from_server => false,
|
2719
|
-
:description => 'If `true`,
|
2788
|
+
:description => 'If `true`, disables SQL injection detection in IAST scans.'
|
2720
2789
|
},
|
2721
|
-
:'security.
|
2722
|
-
:default =>
|
2723
|
-
:
|
2790
|
+
:'security.exclude_from_iast_scan.iast_detection_category.nosql_injection' => {
|
2791
|
+
:default => false,
|
2792
|
+
:external => true,
|
2724
2793
|
:public => true,
|
2725
|
-
: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,
|
2726
2800
|
:external => true,
|
2801
|
+
:public => true,
|
2802
|
+
:type => Boolean,
|
2727
2803
|
:allowed_from_server => false,
|
2728
|
-
:description => '
|
2804
|
+
:description => 'If `true`, disables LDAP injection detection in IAST scans.'
|
2729
2805
|
},
|
2730
|
-
:'security.
|
2731
|
-
:default =>
|
2732
|
-
:
|
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,
|
2848
|
+
:public => true,
|
2849
|
+
:type => Integer,
|
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,
|
2733
2856
|
:public => true,
|
2734
2857
|
:type => Integer,
|
2735
2858
|
:external => true,
|
2859
|
+
:allowed_from_server => true,
|
2860
|
+
:description => 'Indicates the duration (in minutes) for which the IAST scan will be performed.'
|
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,
|
2736
2876
|
:allowed_from_server => false,
|
2737
|
-
:description => '
|
2877
|
+
:description => 'If `true`, allows IAST to continuously gather trace data in the background. The security agent uses collected data 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.'
|
2738
2911
|
}
|
2739
2912
|
}.freeze
|
2740
2913
|
# rubocop:enable Metrics/CollectionLiteralLength
|
@@ -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
|
@@ -241,6 +277,7 @@ module NewRelic
|
|
241
277
|
MYSQL_PREFIX = 'mysql'.freeze
|
242
278
|
MYSQL2_PREFIX = 'mysql2'.freeze
|
243
279
|
SQLITE_PREFIX = 'sqlite'.freeze
|
280
|
+
TRILOGY_PREFIX = 'trilogy'.freeze
|
244
281
|
|
245
282
|
def symbolized_adapter(adapter)
|
246
283
|
if adapter.start_with?(POSTGRES_PREFIX) || adapter == POSTGIS_PREFIX
|
@@ -253,6 +290,8 @@ module NewRelic
|
|
253
290
|
:mysql2
|
254
291
|
elsif adapter.start_with?(SQLITE_PREFIX)
|
255
292
|
:sqlite
|
293
|
+
elsif adapter == TRILOGY_PREFIX
|
294
|
+
:trilogy
|
256
295
|
else
|
257
296
|
adapter.to_sym
|
258
297
|
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)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# This file is distributed under New Relic's license terms.
|
2
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
require_relative 'instrumentation'
|
6
|
+
|
7
|
+
module NewRelic::Agent::Instrumentation
|
8
|
+
module AwsSdkLambda::Chain
|
9
|
+
def self.instrument!
|
10
|
+
::Aws::Lambda::Client.class_eval do
|
11
|
+
include NewRelic::Agent::Instrumentation::AwsSdkLambda
|
12
|
+
|
13
|
+
alias_method(:invoke_without_new_relic, :invoke)
|
14
|
+
|
15
|
+
def invoke(*args)
|
16
|
+
invoke_with_new_relic(*args) { invoke_without_new_relic(*args) }
|
17
|
+
end
|
18
|
+
|
19
|
+
alias_method(:invoke_async_without_new_relic, :invoke_async)
|
20
|
+
|
21
|
+
def invoke_async(*args)
|
22
|
+
invoke_async_with_new_relic(*args) { invoke_async_without_new_relic(*args) }
|
23
|
+
end
|
24
|
+
|
25
|
+
alias_method(:invoke_with_response_stream_without_new_relic, :invoke_with_response_stream)
|
26
|
+
|
27
|
+
def invoke_with_response_stream(*args)
|
28
|
+
invoke_with_response_stream_with_new_relic(*args) { invoke_with_response_stream_without_new_relic(*args) }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# This file is distributed under New Relic's license terms.
|
2
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
require 'json'
|
6
|
+
|
7
|
+
module NewRelic::Agent::Instrumentation
|
8
|
+
module AwsSdkLambda
|
9
|
+
INSTRUMENTATION_NAME = 'aws_sdk_lambda'
|
10
|
+
AWS_SERVICE = 'lambda'
|
11
|
+
CLOUD_PLATFORM = 'aws_lambda'
|
12
|
+
WRAPPED_RESPONSE = Struct.new(:status_code, :has_status_code?)
|
13
|
+
|
14
|
+
def invoke_with_new_relic(*args)
|
15
|
+
with_tracing(:invoke, *args) { yield }
|
16
|
+
end
|
17
|
+
|
18
|
+
def invoke_async_with_new_relic(*args)
|
19
|
+
with_tracing(:invoke_async, *args) { yield }
|
20
|
+
end
|
21
|
+
|
22
|
+
def invoke_with_response_stream_with_new_relic(*args)
|
23
|
+
with_tracing(:invoke_with_response_stream, *args) { yield }
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def with_tracing(action, *args)
|
29
|
+
segment = generate_segment(action, *args)
|
30
|
+
|
31
|
+
# prevent additional instrumentation for things like Net::HTTP from
|
32
|
+
# creating any segments that may appear as redundant / confusing
|
33
|
+
NewRelic::Agent.disable_all_tracing do
|
34
|
+
response = NewRelic::Agent::Tracer.capture_segment_error(segment) { yield }
|
35
|
+
process_response(response, segment)
|
36
|
+
response
|
37
|
+
end
|
38
|
+
ensure
|
39
|
+
segment&.finish
|
40
|
+
end
|
41
|
+
|
42
|
+
def process_response(response, segment)
|
43
|
+
process_function_error(response) if response.respond_to?(:function_error)
|
44
|
+
rescue => e
|
45
|
+
NewRelic::Agent.logger.error("Error processing aws-sdk-lambda invocation response: #{e}")
|
46
|
+
end
|
47
|
+
|
48
|
+
# notice error that was raised / unhandled by the function
|
49
|
+
def process_function_error(response)
|
50
|
+
function_error = response.function_error
|
51
|
+
return unless function_error
|
52
|
+
|
53
|
+
msg = "[#{function_error}]"
|
54
|
+
payload = response.payload&.string if response.respond_to?(:payload)
|
55
|
+
payload_hash = JSON.parse(payload) if payload
|
56
|
+
msg = "#{msg} #{payload_hash['errorType']} - #{payload_hash['errorMessage']}" if payload_hash
|
57
|
+
e = StandardError.new(msg)
|
58
|
+
e.set_backtrace(payload_hash['stackTrace']) if payload_hash
|
59
|
+
|
60
|
+
NewRelic::Agent.notice_error(e)
|
61
|
+
end
|
62
|
+
|
63
|
+
def generate_segment(action, options = {})
|
64
|
+
function = function_name(options)
|
65
|
+
region = aws_region
|
66
|
+
arn = aws_arn(function, region)
|
67
|
+
segment = NewRelic::Agent::Tracer.start_segment(name: "Lambda/#{action}/#{function}")
|
68
|
+
segment.add_agent_attribute('cloud.account.id', nr_account_id)
|
69
|
+
segment.add_agent_attribute('cloud.platform', CLOUD_PLATFORM)
|
70
|
+
segment.add_agent_attribute('cloud.region', region)
|
71
|
+
segment.add_agent_attribute('cloud.resource_id', arn) if arn
|
72
|
+
segment
|
73
|
+
end
|
74
|
+
|
75
|
+
def function_name(options = {})
|
76
|
+
(options.fetch(:function_name, nil) if options.respond_to?(:fetch)) || NewRelic::UNKNOWN
|
77
|
+
end
|
78
|
+
|
79
|
+
def aws_region
|
80
|
+
config&.region if self.respond_to?(:config)
|
81
|
+
end
|
82
|
+
|
83
|
+
def aws_arn(function, region)
|
84
|
+
NewRelic::Agent::Aws.create_arn(AWS_SERVICE, "function:#{function}", region, nr_account_id)
|
85
|
+
end
|
86
|
+
|
87
|
+
def nr_account_id
|
88
|
+
return @nr_account_id if defined?(@nr_account_id)
|
89
|
+
|
90
|
+
@nr_account_id = NewRelic::Agent::Aws.get_account_id(config)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# This file is distributed under New Relic's license terms.
|
2
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
require_relative 'instrumentation'
|
6
|
+
|
7
|
+
module NewRelic::Agent::Instrumentation
|
8
|
+
module AwsSdkLambda::Prepend
|
9
|
+
include NewRelic::Agent::Instrumentation::AwsSdkLambda
|
10
|
+
|
11
|
+
def invoke(*args)
|
12
|
+
invoke_with_new_relic(*args) { super }
|
13
|
+
end
|
14
|
+
|
15
|
+
def invoke_async(*args)
|
16
|
+
invoke_async_with_new_relic(*args) { super }
|
17
|
+
end
|
18
|
+
|
19
|
+
def invoke_with_response_stream(*args)
|
20
|
+
invoke_with_response_stream_with_new_relic(*args) { super }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# This file is distributed under New Relic's license terms.
|
2
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
DependencyDetection.defer do
|
6
|
+
named :aws_sdk_lambda
|
7
|
+
|
8
|
+
depends_on do
|
9
|
+
defined?(Aws::Lambda::Client)
|
10
|
+
end
|
11
|
+
|
12
|
+
executes do
|
13
|
+
require_relative 'aws_sdk_lambda/instrumentation'
|
14
|
+
|
15
|
+
if use_prepend?
|
16
|
+
require_relative 'aws_sdk_lambda/prepend'
|
17
|
+
prepend_instrument Aws::Lambda::Client, NewRelic::Agent::Instrumentation::AwsSdkLambda::Prepend
|
18
|
+
else
|
19
|
+
require_relative 'aws_sdk_lambda/chain'
|
20
|
+
chain_instrument NewRelic::Agent::Instrumentation::AwsSdkLambda::Chain
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -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
59
|
return unless params[:table_name]
|
54
60
|
|
55
|
-
NewRelic::Agent::Aws.create_arn(PRODUCT.downcase, "table/#{params[:table_name]}", config&.region)
|
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
|
@@ -21,7 +21,11 @@ module NewRelic::Agent::Instrumentation
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def metric_name
|
24
|
-
|
24
|
+
# ViewComponent determines a component's identifier differently depending on the version
|
25
|
+
# https://github.com/ViewComponent/view_component/pull/2153
|
26
|
+
component_identifier = defined?(self.class.source_location) ? self.class.source_location : self.class.identifier
|
27
|
+
|
28
|
+
"View/#{metric_path(component_identifier)}/#{self.class.name}"
|
25
29
|
rescue => e
|
26
30
|
NewRelic::Agent.logger.error('Error identifying View Component metric name', e)
|
27
31
|
|
@@ -25,6 +25,7 @@ module NewRelic
|
|
25
25
|
METRICS_SUPPORTABILITY_FORMAT = 'Supportability/Logging/Metrics/Ruby/%s'.freeze
|
26
26
|
FORWARDING_SUPPORTABILITY_FORMAT = 'Supportability/Logging/Forwarding/Ruby/%s'.freeze
|
27
27
|
DECORATING_SUPPORTABILITY_FORMAT = 'Supportability/Logging/LocalDecorating/Ruby/%s'.freeze
|
28
|
+
LABELS_SUPPORTABILITY_FORMAT = 'Supportability/Logging/Labels/Ruby/%s'.freeze
|
28
29
|
MAX_BYTES = 32768 # 32 * 1024 bytes (32 kibibytes)
|
29
30
|
|
30
31
|
named :LogEventAggregator
|
@@ -38,6 +39,7 @@ module NewRelic
|
|
38
39
|
METRICS_ENABLED_KEY = :'application_logging.metrics.enabled'
|
39
40
|
FORWARDING_ENABLED_KEY = :'application_logging.forwarding.enabled'
|
40
41
|
DECORATING_ENABLED_KEY = :'application_logging.local_decorating.enabled'
|
42
|
+
LABELS_ENABLED_KEY = :'application_logging.forwarding.labels.enabled'
|
41
43
|
LOG_LEVEL_KEY = :'application_logging.forwarding.log_level'
|
42
44
|
CUSTOM_ATTRIBUTES_KEY = :'application_logging.forwarding.custom_attributes'
|
43
45
|
|
@@ -51,6 +53,7 @@ module NewRelic
|
|
51
53
|
@high_security = NewRelic::Agent.config[:high_security]
|
52
54
|
@instrumentation_logger_enabled = NewRelic::Agent::Instrumentation::Logger.enabled?
|
53
55
|
@attributes = NewRelic::Agent::LogEventAttributes.new
|
56
|
+
|
54
57
|
register_for_done_configuring(events)
|
55
58
|
end
|
56
59
|
|
@@ -186,6 +189,10 @@ module NewRelic
|
|
186
189
|
attributes.add_custom_attributes(custom_attributes)
|
187
190
|
end
|
188
191
|
|
192
|
+
def labels
|
193
|
+
@labels ||= create_labels
|
194
|
+
end
|
195
|
+
|
189
196
|
# Because our transmission format (MELT) is different than historical
|
190
197
|
# agent payloads, extract the munging here to keep the service focused
|
191
198
|
# on the general harvest + transmit instead of the format.
|
@@ -201,8 +208,9 @@ module NewRelic
|
|
201
208
|
# To save on unnecessary data transmission, trim the entity.type
|
202
209
|
# sent by classic logs-in-context
|
203
210
|
common_attributes.delete(ENTITY_TYPE_KEY)
|
204
|
-
|
205
|
-
common_attributes.merge!(
|
211
|
+
aggregator = NewRelic::Agent.agent.log_event_aggregator
|
212
|
+
common_attributes.merge!(aggregator.attributes.custom_attributes)
|
213
|
+
common_attributes.merge!(aggregator.labels)
|
206
214
|
|
207
215
|
_, items = data
|
208
216
|
payload = [{
|
@@ -247,6 +255,7 @@ module NewRelic
|
|
247
255
|
record_configuration_metric(METRICS_SUPPORTABILITY_FORMAT, METRICS_ENABLED_KEY)
|
248
256
|
record_configuration_metric(FORWARDING_SUPPORTABILITY_FORMAT, FORWARDING_ENABLED_KEY)
|
249
257
|
record_configuration_metric(DECORATING_SUPPORTABILITY_FORMAT, DECORATING_ENABLED_KEY)
|
258
|
+
record_configuration_metric(LABELS_SUPPORTABILITY_FORMAT, LABELS_ENABLED_KEY)
|
250
259
|
|
251
260
|
add_custom_attributes(NewRelic::Agent.config[CUSTOM_ATTRIBUTES_KEY])
|
252
261
|
end
|
@@ -327,6 +336,23 @@ module NewRelic
|
|
327
336
|
|
328
337
|
Logger::Severity.const_get(severity_constant) < Logger::Severity.const_get(configured_log_level_constant)
|
329
338
|
end
|
339
|
+
|
340
|
+
def create_labels
|
341
|
+
return NewRelic::EMPTY_HASH unless NewRelic::Agent.config[LABELS_ENABLED_KEY]
|
342
|
+
|
343
|
+
downcased_exclusions = NewRelic::Agent.config[:'application_logging.forwarding.labels.exclude'].map(&:downcase)
|
344
|
+
log_labels = {}
|
345
|
+
|
346
|
+
NewRelic::Agent.config.parsed_labels.each do |parsed_label|
|
347
|
+
next if downcased_exclusions.include?(parsed_label['label_type'].downcase)
|
348
|
+
|
349
|
+
# labels are referred to as tags in the UI, so prefix the
|
350
|
+
# label-related attributes with 'tags.*'
|
351
|
+
log_labels["tags.#{parsed_label['label_type']}"] = parsed_label['label_value']
|
352
|
+
end
|
353
|
+
|
354
|
+
log_labels
|
355
|
+
end
|
330
356
|
end
|
331
357
|
end
|
332
358
|
end
|
data/lib/new_relic/agent.rb
CHANGED
@@ -132,8 +132,8 @@ module NewRelic
|
|
132
132
|
def agent # :nodoc:
|
133
133
|
return @agent if @agent
|
134
134
|
|
135
|
-
NewRelic::Agent.logger.
|
136
|
-
NewRelic::Agent.logger.
|
135
|
+
NewRelic::Agent.logger.debug("Agent unavailable as it hasn't been started.")
|
136
|
+
NewRelic::Agent.logger.debug(caller.join("\n"))
|
137
137
|
nil
|
138
138
|
end
|
139
139
|
|
data/lib/new_relic/version.rb
CHANGED
data/newrelic.yml
CHANGED
@@ -65,6 +65,13 @@ common: &default_settings
|
|
65
65
|
# If true, the agent captures log records emitted by your application.
|
66
66
|
# application_logging.forwarding.enabled: true
|
67
67
|
|
68
|
+
# If true, the agent attaches labels to log records.
|
69
|
+
# application_logging.forwarding.labels.enabled: false
|
70
|
+
|
71
|
+
# A case-insensitive array or comma-delimited string containing the labels to
|
72
|
+
# exclude from log records.
|
73
|
+
# application_logging.forwarding.labels.exclude: []
|
74
|
+
|
68
75
|
# Sets the minimum level a log event must have to be forwarded to New Relic.
|
69
76
|
# This is based on the integer values of Ruby's Logger::Severity constants:
|
70
77
|
# https://github.com/ruby/ruby/blob/master/lib/logger/severity.rb
|
@@ -114,17 +121,15 @@ common: &default_settings
|
|
114
121
|
# audit_log.path: log/newrelic_audit.log
|
115
122
|
|
116
123
|
# An array of CLASS#METHOD (for instance methods) and/or CLASS.METHOD (for class
|
117
|
-
# methods) strings representing Ruby methods
|
118
|
-
# add custom instrumentation to
|
124
|
+
# methods) strings representing Ruby methods that the agent can automatically
|
125
|
+
# add custom instrumentation to. This doesn't require any modifications of the
|
119
126
|
# source code that defines the methods.
|
120
|
-
#
|
121
127
|
# Use fully qualified class names (using the :: delimiter) that include any
|
122
128
|
# module or class namespacing.
|
123
|
-
#
|
124
129
|
# Here is some Ruby source code that defines a render_png instance method for an
|
125
130
|
# Image class and a notify class method for a User class, both within a
|
126
131
|
# MyCompany module namespace:
|
127
|
-
#
|
132
|
+
#
|
128
133
|
# module MyCompany
|
129
134
|
# class Image
|
130
135
|
# def render_png
|
@@ -147,17 +152,20 @@ common: &default_settings
|
|
147
152
|
# - MyCompany::User.notify
|
148
153
|
#
|
149
154
|
# That configuration example uses YAML array syntax to specify both methods.
|
150
|
-
# Alternatively, a comma-delimited string
|
151
|
-
#
|
152
|
-
# automatic_custom_instrumentation_method_list: 'MyCompany::Image#render_png,
|
153
|
-
#
|
155
|
+
# Alternatively, you can use a comma-delimited string:
|
156
|
+
#
|
157
|
+
# automatic_custom_instrumentation_method_list: 'MyCompany::Image#render_png,
|
158
|
+
# MyCompany::User.notify'
|
159
|
+
#
|
154
160
|
# Whitespace around the comma(s) in the list is optional. When configuring the
|
155
161
|
# agent with a list of methods via the
|
156
162
|
# NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST environment variable,
|
157
|
-
# this comma-delimited string format
|
158
|
-
#
|
159
|
-
# export
|
160
|
-
#
|
163
|
+
# use this comma-delimited string format:
|
164
|
+
#
|
165
|
+
# export
|
166
|
+
# NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST='MyCompany::Image#render_png,
|
167
|
+
# MyCompany::User.notify'
|
168
|
+
#
|
161
169
|
# automatic_custom_instrumentation_method_list: []
|
162
170
|
|
163
171
|
# Specify a list of constants that should prevent the agent from starting
|
@@ -197,9 +205,8 @@ common: &default_settings
|
|
197
205
|
# monitoring scripts. For now, auto-injection only works with Rails 5.2+.
|
198
206
|
# browser_monitoring.content_security_policy_nonce: true
|
199
207
|
|
200
|
-
# Manual override for the path to your local CA bundle. This CA bundle
|
201
|
-
#
|
202
|
-
# service.
|
208
|
+
# Manual override for the path to your local CA bundle. This CA bundle validates
|
209
|
+
# the SSL certificate presented by New Relic's data collection service.
|
203
210
|
# ca_bundle_path: nil
|
204
211
|
|
205
212
|
# Enable or disable the capture of memcache keys from transaction traces.
|
@@ -315,18 +322,6 @@ common: &default_settings
|
|
315
322
|
# If true, disables agent middleware for Sinatra. This middleware is responsible
|
316
323
|
# for advanced feature support such as cross application tracing, page load
|
317
324
|
# timing, and error collection.
|
318
|
-
# Cross application tracing is deprecated in favor of distributed tracing.
|
319
|
-
# Distributed tracing is on by default for Ruby agent versions 8.0.0 and above.
|
320
|
-
# Middlewares are not required to support distributed tracing.
|
321
|
-
# To continue using cross application tracing, update the following options in
|
322
|
-
# your newrelic.yml configuration file:
|
323
|
-
# ``yaml
|
324
|
-
# # newrelic.yml
|
325
|
-
# cross_application_tracer:
|
326
|
-
# enabled: true
|
327
|
-
# distributed_tracing:
|
328
|
-
# enabled: false
|
329
|
-
# ``
|
330
325
|
# disable_sinatra_auto_middleware: false
|
331
326
|
|
332
327
|
# If true, disables view instrumentation.
|
@@ -458,6 +453,10 @@ common: &default_settings
|
|
458
453
|
# prepend, chain, disabled.
|
459
454
|
# instrumentation.async_http: auto
|
460
455
|
|
456
|
+
# Controls auto-instrumentation of the aws_sdk_lambda library at start-up. May
|
457
|
+
# be one of auto, prepend, chain, disabled.
|
458
|
+
# instrumentation.aws_sdk_lambda: auto
|
459
|
+
|
461
460
|
# Controls auto-instrumentation of the aws-sdk-sqs library at start-up. May be
|
462
461
|
# one of: auto, prepend, chain, disabled.
|
463
462
|
# instrumentation.aws_sqs: auto
|
@@ -722,8 +721,8 @@ common: &default_settings
|
|
722
721
|
|
723
722
|
# If true, the agent will operate in a streamlined mode suitable for use with
|
724
723
|
# short-lived serverless functions. NOTE: Only AWS Lambda functions are
|
725
|
-
# supported currently and this option
|
726
|
-
#
|
724
|
+
# supported currently and this option isn't intended for use without New Relic's
|
725
|
+
# Ruby Lambda layer offering.
|
727
726
|
# serverless_mode.enabled: false
|
728
727
|
|
729
728
|
# An array of strings that will collectively serve as a denylist for filtering
|
@@ -802,17 +801,17 @@ common: &default_settings
|
|
802
801
|
# not be reported to New Relic. Each string in this array will be turned into a
|
803
802
|
# regular expression via
|
804
803
|
# Regexp.new to permit advanced matching. For each hash pair, if either the key
|
805
|
-
# or value is matched the
|
806
|
-
#
|
807
|
-
#
|
808
|
-
#
|
804
|
+
# or value is matched the pair
|
805
|
+
# isn't reported. By default, no user_data is reported. Use this option only if
|
806
|
+
# the
|
807
|
+
# stripe.user_data.include option is also used.
|
809
808
|
# stripe.user_data.exclude: []
|
810
809
|
|
811
810
|
# An array of strings to specify which keys inside a Stripe event's user_data
|
812
811
|
# hash should be reported
|
813
812
|
# to New Relic. Each string in this array will be turned into a regular
|
814
813
|
# expression via Regexp.new to
|
815
|
-
#
|
814
|
+
# enable advanced matching. Setting the value to ["."] will report all
|
816
815
|
# user_data.
|
817
816
|
# stripe.user_data.include: []
|
818
817
|
|
@@ -876,7 +875,7 @@ common: &default_settings
|
|
876
875
|
|
877
876
|
# If true, enables the collection of explain plans in transaction traces. This
|
878
877
|
# setting will also apply to explain plans in slow SQL traces if
|
879
|
-
# slow_sql.explain_enabled
|
878
|
+
# slow_sql.explain_enabled isn't set separately.
|
880
879
|
# transaction_tracer.explain_enabled: true
|
881
880
|
|
882
881
|
# Threshold (in seconds) above which the agent will collect explain plans.
|
@@ -951,32 +950,103 @@ common: &default_settings
|
|
951
950
|
# security agent, and all other configuration parameters that may
|
952
951
|
# have "security" in the name somewhere are related to the APM agent.
|
953
952
|
|
954
|
-
# If true, the security agent
|
953
|
+
# If true, the security agent loads (the agent performs a Ruby 'require')
|
955
954
|
# security.agent.enabled: false
|
956
955
|
|
957
956
|
# The port the application is listening on. This setting is mandatory for
|
958
|
-
# Passenger servers.
|
957
|
+
# Passenger servers. The agent detects other servers by default.
|
959
958
|
# security.application_info.port: nil
|
960
959
|
|
961
|
-
# If true,
|
962
|
-
# security.
|
960
|
+
# If true, the security agent is started (the agent runs in its event loop)
|
961
|
+
# security.enabled: false
|
962
|
+
|
963
|
+
# Defines API paths the security agent should ignore in IAST scans. Accepts an
|
964
|
+
# array of regex patterns matching the URI to ignore. The regex pattern should
|
965
|
+
# find a complete match for the URL without the endpoint. For example,
|
966
|
+
# [".*account.*"], [".*/\api\/v1\/.*?\/login"]
|
967
|
+
# security.exclude_from_iast_scan.api: []
|
963
968
|
|
964
|
-
#
|
965
|
-
#
|
969
|
+
# An array of HTTP request body keys the security agent should ignore in IAST
|
970
|
+
# scans.
|
971
|
+
# security.exclude_from_iast_scan.http_request_parameters.body: []
|
966
972
|
|
967
|
-
#
|
968
|
-
#
|
973
|
+
# An array of HTTP request headers the security agent should ignore in IAST
|
974
|
+
# scans. The array should specify a list of patterns matching the headers to
|
975
|
+
# ignore.
|
976
|
+
# security.exclude_from_iast_scan.http_request_parameters.header: []
|
969
977
|
|
970
|
-
#
|
971
|
-
#
|
978
|
+
# An array of HTTP request query parameters the security agent should ignore in
|
979
|
+
# IAST scans. The array should specify a list of patterns matching the HTTP
|
980
|
+
# request query parameters to ignore.
|
981
|
+
# security.exclude_from_iast_scan.http_request_parameters.query: []
|
982
|
+
|
983
|
+
# If true, disables system command injection detection in IAST scans.
|
984
|
+
# security.exclude_from_iast_scan.iast_detection_category.command_injection: false
|
985
|
+
|
986
|
+
# If true, disables the detection of low-severity insecure settings. For
|
987
|
+
# example, hash, crypto, cookie, random generators, trust boundary).
|
988
|
+
# security.exclude_from_iast_scan.iast_detection_category.insecure_settings: false
|
989
|
+
|
990
|
+
# If true, disables file operation-related IAST detections (File Access &
|
991
|
+
# Application integrity violation)
|
992
|
+
# security.exclude_from_iast_scan.iast_detection_category.invalid_file_access: false
|
993
|
+
|
994
|
+
# If true, disables Javascript injection detection in IAST scans.
|
995
|
+
# security.exclude_from_iast_scan.iast_detection_category.javascript_injection: false
|
996
|
+
|
997
|
+
# If true, disables LDAP injection detection in IAST scans.
|
998
|
+
# security.exclude_from_iast_scan.iast_detection_category.ldap_injection: false
|
999
|
+
|
1000
|
+
# If true, disables NOSQL injection detection in IAST scans.
|
1001
|
+
# security.exclude_from_iast_scan.iast_detection_category.nosql_injection: false
|
1002
|
+
|
1003
|
+
# If true, disables Reflected Cross-Site Scripting (RXSS) detection in IAST
|
1004
|
+
# scans.
|
1005
|
+
# security.exclude_from_iast_scan.iast_detection_category.rxss: false
|
1006
|
+
|
1007
|
+
# If true, disables SQL injection detection in IAST scans.
|
1008
|
+
# security.exclude_from_iast_scan.iast_detection_category.sql_injection: false
|
1009
|
+
|
1010
|
+
# If true, disables Sever-Side Request Forgery (SSRF) detection in IAST scans.
|
1011
|
+
# security.exclude_from_iast_scan.iast_detection_category.ssrf: false
|
1012
|
+
|
1013
|
+
# If true, disables XPATH injection detection in IAST scans.
|
1014
|
+
# security.exclude_from_iast_scan.iast_detection_category.xpath_injection: false
|
1015
|
+
|
1016
|
+
# A unique test identifier when runnning IAST in a CI/CD environment to
|
1017
|
+
# differentiate between different test runs. For example, a build number.
|
1018
|
+
# security.iast_test_identifier: nil
|
972
1019
|
|
973
1020
|
# Defines the mode for the security agent to operate in. Currently only IAST is
|
974
1021
|
# supported
|
975
1022
|
# security.mode: IAST
|
976
1023
|
|
977
|
-
#
|
978
|
-
# default value is
|
979
|
-
# security.
|
1024
|
+
# Sets the maximum number of HTTP requests allowed for the IAST scan per minute.
|
1025
|
+
# Any Integer between 12 and 3600 is valid. The default value is 3600.
|
1026
|
+
# security.scan_controllers.iast_scan_request_rate_limit: 3600
|
1027
|
+
|
1028
|
+
# If true, enables the sending of HTTP responses bodies. Disabling this also
|
1029
|
+
# disables Reflected Cross-Site Scripting (RXSS) vulnerability detection.
|
1030
|
+
# security.scan_controllers.report_http_response_body: true
|
1031
|
+
|
1032
|
+
# The number of application instances for a specific entity to perform IAST
|
1033
|
+
# analysis on.
|
1034
|
+
# security.scan_controllers.scan_instance_count: 0
|
1035
|
+
|
1036
|
+
# If true, allows IAST to continuously gather trace data in the background. The
|
1037
|
+
# security agent uses collected data to perform an IAST scan at the scheduled
|
1038
|
+
# time.
|
1039
|
+
# security.scan_schedule.always_sample_traces: false
|
1040
|
+
|
1041
|
+
# Specifies the delay time (in minutes) before the IAST scan begins after the
|
1042
|
+
# application starts.
|
1043
|
+
# security.scan_schedule.delay: 0
|
1044
|
+
|
1045
|
+
# Indicates the duration (in minutes) for which the IAST scan will be performed.
|
1046
|
+
# security.scan_schedule.duration: 0
|
1047
|
+
|
1048
|
+
# Specifies a cron expression that sets when the IAST scan should run.
|
1049
|
+
# security.scan_schedule.schedule: ""
|
980
1050
|
|
981
1051
|
# Defines the endpoint URL for posting security-related data
|
982
1052
|
# security.validator_service_url: wss://csec.nr-data.net
|
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.
|
4
|
+
version: 9.16.1
|
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-12-04 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -392,6 +392,10 @@ files:
|
|
392
392
|
- lib/new_relic/agent/instrumentation/async_http/chain.rb
|
393
393
|
- lib/new_relic/agent/instrumentation/async_http/instrumentation.rb
|
394
394
|
- lib/new_relic/agent/instrumentation/async_http/prepend.rb
|
395
|
+
- lib/new_relic/agent/instrumentation/aws_sdk_lambda.rb
|
396
|
+
- lib/new_relic/agent/instrumentation/aws_sdk_lambda/chain.rb
|
397
|
+
- lib/new_relic/agent/instrumentation/aws_sdk_lambda/instrumentation.rb
|
398
|
+
- lib/new_relic/agent/instrumentation/aws_sdk_lambda/prepend.rb
|
395
399
|
- lib/new_relic/agent/instrumentation/aws_sqs.rb
|
396
400
|
- lib/new_relic/agent/instrumentation/aws_sqs/chain.rb
|
397
401
|
- lib/new_relic/agent/instrumentation/aws_sqs/instrumentation.rb
|
@@ -778,7 +782,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
778
782
|
- !ruby/object:Gem::Version
|
779
783
|
version: 1.3.1
|
780
784
|
requirements: []
|
781
|
-
rubygems_version: 3.5.
|
785
|
+
rubygems_version: 3.5.22
|
782
786
|
signing_key:
|
783
787
|
specification_version: 4
|
784
788
|
summary: New Relic Ruby Agent
|