newrelic_rpm 9.13.0 → 9.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +115 -5
- data/lib/new_relic/agent/aws.rb +3 -48
- data/lib/new_relic/agent/configuration/default_source.rb +91 -1
- data/lib/new_relic/agent/configuration/environment_source.rb +5 -1
- data/lib/new_relic/agent/configuration/manager.rb +16 -1
- data/lib/new_relic/agent/database/obfuscation_helpers.rb +11 -11
- 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_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 +2 -8
- 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 +72 -0
- data/lib/new_relic/agent/instrumentation/rdkafka/instrumentation.rb +70 -0
- data/lib/new_relic/agent/instrumentation/rdkafka/prepend.rb +67 -0
- data/lib/new_relic/agent/instrumentation/rdkafka.rb +25 -0
- 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/chain.rb +55 -0
- data/lib/new_relic/agent/instrumentation/ruby_kafka/instrumentation.rb +67 -0
- data/lib/new_relic/agent/instrumentation/ruby_kafka/prepend.rb +60 -0
- data/lib/new_relic/agent/instrumentation/ruby_kafka.rb +25 -0
- 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 +7 -5
- data/lib/new_relic/agent/instrumentation/view_component.rb +0 -2
- data/lib/new_relic/agent/javascript_instrumentor.rb +2 -3
- data/lib/new_relic/agent/messaging.rb +11 -5
- data/lib/new_relic/agent/span_event_primitive.rb +4 -2
- data/lib/new_relic/agent/transaction/request_attributes.rb +13 -1
- data/lib/new_relic/agent.rb +93 -0
- 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 +58 -0
- data/test/agent_helper.rb +1 -1
- metadata +11 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a02ae0dd81c8e98102873ea89251171352151071c77d4e30743cfff6e8570cc
|
4
|
+
data.tar.gz: da90bad15981745bdcaa2e8e1b22ad5d7d072ba75e4dfc8d54db412a3b800362
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ea9ab0cae780bc052ff7290876908358c158c3b93934cebb3380e56b53e9e141f79b5cb46b5ed7ded659cb4f52eafeb18b9a34932870383773c5b4e1ffd7a80
|
7
|
+
data.tar.gz: a005499eee4aae21a1e610dde7d4d466c4c2b8b24f64a5130cd4ff4a5897046677a0a7c07555d79234221eda6e375e347ab86b088a3be1a55d30cef213d371af
|
data/CHANGELOG.md
CHANGED
@@ -1,16 +1,126 @@
|
|
1
1
|
# New Relic Ruby Agent Release Notes
|
2
2
|
|
3
|
+
## v9.15.0
|
4
|
+
|
5
|
+
Version 9.15.0 updates View Componment 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.
|
6
|
+
|
7
|
+
- **Feature: New configuration option cloud.aws.account_id**
|
8
|
+
|
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. One example, is that 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
|
+
|
11
|
+
- **Feature: Use default `View/component` metric name for unidentified View Components**
|
12
|
+
|
13
|
+
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)
|
14
|
+
|
15
|
+
- **Bugfix: Instrumentation errors when using the karafka-rdkafka gem**
|
16
|
+
|
17
|
+
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)
|
18
|
+
|
19
|
+
- **Bugfix: Stop calling deprecated all_specs method to check for the presence of newrelic-grape**
|
20
|
+
|
21
|
+
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)
|
22
|
+
|
23
|
+
- **Bugfix: Instrumentation errors when using the ruby-kafka gem**
|
24
|
+
|
25
|
+
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)
|
26
|
+
|
27
|
+
- **Bugfix: Restore AWS Lambda layer operational functionality**
|
28
|
+
|
29
|
+
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)
|
30
|
+
|
31
|
+
## v9.14.0
|
32
|
+
|
33
|
+
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+.
|
34
|
+
|
35
|
+
- **Feature: Add Apache Kafka instrumentation for the rdkafka and ruby-kafka gems**
|
36
|
+
|
37
|
+
The agent now has instrumentation for both the rdkafka and ruby-kafka gems. The agent will record transactions and message broker segments for produce and consume calls made using these gems. [PR#2824](https://github.com/newrelic/newrelic-ruby-agent/pull/2824) [PR#2842](https://github.com/newrelic/newrelic-ruby-agent/pull/2842)
|
38
|
+
|
39
|
+
- **Feature: Add a configuration option to permit custom method tracers to be defined automatically**
|
40
|
+
|
41
|
+
A new `:automatic_custom_instrumentation_method_list` configuration parameter has been added to permit the user to define a list of fully qualified (namespaced) Ruby methods for the agent to automatically add custom instrumentation for without requiring any code modifications to be made to the classes that define the methods.
|
42
|
+
|
43
|
+
The list should be an array of `CLASS#METHOD` (for instance methods) and/or `CLASS.METHOD` (for class methods) strings.
|
44
|
+
|
45
|
+
Use fully qualified class names (using the `::` delimiter) that include any module or class namespacing.
|
46
|
+
|
47
|
+
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:
|
48
|
+
|
49
|
+
```
|
50
|
+
module MyCompany
|
51
|
+
class Image
|
52
|
+
def render_png
|
53
|
+
# code to render a PNG
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
class User
|
58
|
+
def self.notify
|
59
|
+
# code to notify users
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
```
|
64
|
+
|
65
|
+
Given that source code, the `newrelic.yml` config file might request instrumentation for both of these methods like so:
|
66
|
+
|
67
|
+
```
|
68
|
+
automatic_custom_instrumentation_method_list:
|
69
|
+
- MyCompany::Image#render_png
|
70
|
+
- MyCompany::User.notify
|
71
|
+
```
|
72
|
+
|
73
|
+
That configuration example uses YAML array syntax to specify both methods. Alternatively, you can use a comma-delimited string:
|
74
|
+
|
75
|
+
```
|
76
|
+
automatic_custom_instrumentation_method_list: 'MyCompany::Image#render_png, MyCompany::User.notify'
|
77
|
+
```
|
78
|
+
|
79
|
+
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:
|
80
|
+
|
81
|
+
```
|
82
|
+
export NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST='MyCompany::Image#render_png, MyCompany::User.notify'
|
83
|
+
```
|
84
|
+
|
85
|
+
[PR#2851](https://github.com/newrelic/newrelic-ruby-agent/pull/2851)
|
86
|
+
|
87
|
+
- **Feature: Collect just MIME type for ActionDispatch 7.0+ requests**
|
88
|
+
|
89
|
+
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)
|
90
|
+
|
91
|
+
- **Bugfix: Corrected Boolean coercion for `newrelic.yml` configuration**
|
92
|
+
|
93
|
+
Previously, any String assigned to New Relic configurations expecting a Boolean value were evaluated as `true`. This could lead to unexpected behavior. For example, setting `application_logging.enabled: 'false'` in `newrelic.yml` would incorrectly evaluate to `application_logging.enabled: true` due to the truthy nature of Strings.
|
94
|
+
|
95
|
+
Now, the agent strictly interprets Boolean configuration values. It recognizes both actual Boolean values and certain Strings/Symbols:
|
96
|
+
- `'true'`, `'yes'`, or `'on'` (evaluates to `true`)
|
97
|
+
- `'false'`, `'no'`, or `'off'` (evaluates to `false`)
|
98
|
+
|
99
|
+
Any other inputs will revert to the setting's default configuration value. [PR#2847](https://github.com/newrelic/newrelic-ruby-agent/pull/2847)
|
100
|
+
|
101
|
+
- **Bugfix: JRuby not saving configuration values correctly in configuration manager**
|
102
|
+
|
103
|
+
Previously, a change made to fix a different JRuby bug caused the agent to not save configuration values correctly in the configuration manager when running on JRuby. This has been fixed. [PR#2848](https://github.com/newrelic/newrelic-ruby-agent/pull/2848)
|
104
|
+
|
105
|
+
- **Bugfix: Update condition to verify Bundler.rubygems.installed_specs is available**
|
106
|
+
|
107
|
+
To address a recent Bundler deprecation warning, we started using `Bundler.rubygems.installed_specs` instead of `Bundler.rubygems.all_specs` in environments that seemed appropriate. We discovered the version constraint we used was too low. Now, rather than check the version, we check for the method using `respond_to?`. [PR#2853](https://github.com/newrelic/newrelic-ruby-agent/pull/2853)
|
108
|
+
|
109
|
+
- **Bugfix: Support view_component v3.15.0+**
|
110
|
+
|
111
|
+
Previously the agent had been making use of a private API to obtain a component identifier value. This private API was dropped in v3.15.0 of view_component, resulting in errors from the New Relic Ruby agent's continued attempts to use it. Many thanks to community member [@navidemad](https://github.com/navidemad) for bringing this issue to our attention and supplying a bugfix with [PR#2870](https://github.com/newrelic/newrelic-ruby-agent/pull/2870).
|
112
|
+
|
3
113
|
## v9.13.0
|
4
114
|
|
5
115
|
Version 9.13.0 enhances support for AWS Lambda functions, adds experimental OpenSearch instrumentation, updates framework detection, silences a Bundler deprecation warning, fixes Falcon dispatcher detection, fixes a bug with Redis instrumentation installation, and addresses a JRuby-specific concurrency issue.
|
6
116
|
|
7
117
|
- **Feature: Enhance AWS Lambda function instrumentation**
|
8
118
|
|
9
|
-
When utilized via the latest [New Relic Ruby layer for AWS Lambda](https://layers.newrelic-external.com/), the agent now offers enhanced support for AWS Lambda function instrumentation.
|
10
|
-
* The agent's instrumentation for AWS Lambda functions now supports distributed tracing.
|
11
|
-
* Web-triggered invocations are now identified as being "web"-based when an API Gateway call is involved, with support for both API Gateway versions 1.0 and 2.0.
|
12
|
-
* Web-based calls have the HTTP method, URI, and status code recorded.
|
13
|
-
* The agent now recognizes and reports on 12 separate AWS resources that are capable of triggering a Lambda function invocation: ALB, API Gateway V1, API Gateway V2, CloudFront, CloudWatch Scheduler, DynamoStreams, Firehose, Kinesis, S3, SES, SNS, and SQS.
|
119
|
+
When utilized via the latest [New Relic Ruby layer for AWS Lambda](https://layers.newrelic-external.com/), the agent now offers enhanced support for AWS Lambda function instrumentation.
|
120
|
+
* The agent's instrumentation for AWS Lambda functions now supports distributed tracing.
|
121
|
+
* Web-triggered invocations are now identified as being "web"-based when an API Gateway call is involved, with support for both API Gateway versions 1.0 and 2.0.
|
122
|
+
* Web-based calls have the HTTP method, URI, and status code recorded.
|
123
|
+
* The agent now recognizes and reports on 12 separate AWS resources that are capable of triggering a Lambda function invocation: ALB, API Gateway V1, API Gateway V2, CloudFront, CloudWatch Scheduler, DynamoStreams, Firehose, Kinesis, S3, SES, SNS, and SQS.
|
14
124
|
* The type of the triggering resource and its ARN will be recorded for each resource, and for many of them, extra resource-specific attributes will be recorded as well. For example, Lambda function invocations triggered by S3 bucket activity will now result in the S3 bucket name being recorded.
|
15
125
|
[PR#2811](https://github.com/newrelic/newrelic-ruby-agent/pull/2811)
|
16
126
|
|
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
|
@@ -35,6 +35,15 @@ module NewRelic
|
|
35
35
|
end
|
36
36
|
|
37
37
|
class DefaultSource
|
38
|
+
BOOLEAN_MAP = {
|
39
|
+
'true' => true,
|
40
|
+
'yes' => true,
|
41
|
+
'on' => true,
|
42
|
+
'false' => false,
|
43
|
+
'no' => false,
|
44
|
+
'off' => false
|
45
|
+
}.freeze
|
46
|
+
|
38
47
|
attr_reader :defaults
|
39
48
|
|
40
49
|
extend Forwardable
|
@@ -64,6 +73,12 @@ module NewRelic
|
|
64
73
|
value_from_defaults(key, :allowlist)
|
65
74
|
end
|
66
75
|
|
76
|
+
def self.boolean_for(key, value)
|
77
|
+
string_value = (value.respond_to?(:call) ? value.call : value).to_s
|
78
|
+
|
79
|
+
BOOLEAN_MAP.fetch(string_value, nil)
|
80
|
+
end
|
81
|
+
|
67
82
|
def self.default_for(key)
|
68
83
|
value_from_defaults(key, :default)
|
69
84
|
end
|
@@ -412,6 +427,7 @@ module NewRelic
|
|
412
427
|
:public => true,
|
413
428
|
:type => String,
|
414
429
|
:allowed_from_server => false,
|
430
|
+
:exclude_from_reported_settings => true,
|
415
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.'
|
416
432
|
},
|
417
433
|
:backport_fast_active_record_connection_lookup => {
|
@@ -456,6 +472,14 @@ module NewRelic
|
|
456
472
|
:allowed_from_server => false,
|
457
473
|
:description => 'If `true`, the agent will clear `Tracer::State` in `Agent.drop_buffered_data`.'
|
458
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
|
+
},
|
459
483
|
:config_path => {
|
460
484
|
:default => DefaultSource.config_path,
|
461
485
|
:public => true,
|
@@ -1137,6 +1161,56 @@ module NewRelic
|
|
1137
1161
|
:allowed_from_server => false,
|
1138
1162
|
:description => 'If `false`, custom attributes will not be sent on events.'
|
1139
1163
|
},
|
1164
|
+
:automatic_custom_instrumentation_method_list => {
|
1165
|
+
:default => NewRelic::EMPTY_ARRAY,
|
1166
|
+
:public => true,
|
1167
|
+
:type => Array,
|
1168
|
+
:allowed_from_server => false,
|
1169
|
+
:transform => proc { |arr| NewRelic::Agent.add_automatic_method_tracers(arr) },
|
1170
|
+
:description => <<~DESCRIPTION
|
1171
|
+
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.
|
1172
|
+
|
1173
|
+
Use fully qualified class names (using the `::` delimiter) that include any module or class namespacing.
|
1174
|
+
|
1175
|
+
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
|
+
|
1177
|
+
```
|
1178
|
+
module MyCompany
|
1179
|
+
class Image
|
1180
|
+
def render_png
|
1181
|
+
# code to render a PNG
|
1182
|
+
end
|
1183
|
+
end
|
1184
|
+
|
1185
|
+
class User
|
1186
|
+
def self.notify
|
1187
|
+
# code to notify users
|
1188
|
+
end
|
1189
|
+
end
|
1190
|
+
end
|
1191
|
+
```
|
1192
|
+
|
1193
|
+
Given that source code, the `newrelic.yml` config file might request instrumentation for both of these methods like so:
|
1194
|
+
|
1195
|
+
```
|
1196
|
+
automatic_custom_instrumentation_method_list:
|
1197
|
+
- MyCompany::Image#render_png
|
1198
|
+
- MyCompany::User.notify
|
1199
|
+
```
|
1200
|
+
|
1201
|
+
That configuration example uses YAML array syntax to specify both methods. Alternatively, you can use a comma-delimited string:
|
1202
|
+
|
1203
|
+
```
|
1204
|
+
automatic_custom_instrumentation_method_list: 'MyCompany::Image#render_png, MyCompany::User.notify'
|
1205
|
+
```
|
1206
|
+
|
1207
|
+
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
|
+
|
1209
|
+
```
|
1210
|
+
export NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST='MyCompany::Image#render_png, MyCompany::User.notify'
|
1211
|
+
```
|
1212
|
+
DESCRIPTION
|
1213
|
+
},
|
1140
1214
|
# Custom events
|
1141
1215
|
:'custom_insights_events.enabled' => {
|
1142
1216
|
:default => true,
|
@@ -1463,6 +1537,14 @@ module NewRelic
|
|
1463
1537
|
:allowed_from_server => false,
|
1464
1538
|
:description => 'Controls auto-instrumentation of bunny at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
|
1465
1539
|
},
|
1540
|
+
:'instrumentation.ruby_kafka' => {
|
1541
|
+
:default => 'auto',
|
1542
|
+
:public => true,
|
1543
|
+
:type => String,
|
1544
|
+
:dynamic_name => true,
|
1545
|
+
:allowed_from_server => false,
|
1546
|
+
:description => 'Controls auto-instrumentation of the ruby-kafka library at start-up. May be one of `auto`, `prepend`, `chain`, `disabled`.'
|
1547
|
+
},
|
1466
1548
|
:'instrumentation.opensearch' => {
|
1467
1549
|
:default => 'auto',
|
1468
1550
|
:documentation_default => 'auto',
|
@@ -1472,6 +1554,14 @@ module NewRelic
|
|
1472
1554
|
:allowed_from_server => false,
|
1473
1555
|
:description => 'Controls auto-instrumentation of the opensearch-ruby library at start-up. May be one of `auto`, `prepend`, `chain`, `disabled`.'
|
1474
1556
|
},
|
1557
|
+
:'instrumentation.rdkafka' => {
|
1558
|
+
:default => 'auto',
|
1559
|
+
:public => true,
|
1560
|
+
:type => String,
|
1561
|
+
:dynamic_name => true,
|
1562
|
+
:allowed_from_server => false,
|
1563
|
+
:description => 'Controls auto-instrumentation of the rdkafka library at start-up. May be one of `auto`, `prepend`, `chain`, `disabled`.'
|
1564
|
+
},
|
1475
1565
|
:'instrumentation.aws_sqs' => {
|
1476
1566
|
:default => 'auto',
|
1477
1567
|
:public => true,
|
@@ -2202,7 +2292,7 @@ module NewRelic
|
|
2202
2292
|
:description => 'Enable or disable debugging version of JavaScript agent loader for browser monitoring instrumentation.'
|
2203
2293
|
},
|
2204
2294
|
:'browser_monitoring.ssl_for_http' => {
|
2205
|
-
:default =>
|
2295
|
+
:default => false,
|
2206
2296
|
:allow_nil => true,
|
2207
2297
|
:public => false,
|
2208
2298
|
:type => Boolean,
|
@@ -92,7 +92,11 @@ module NewRelic
|
|
92
92
|
elsif type == Symbol
|
93
93
|
self[config_key] = value.to_sym
|
94
94
|
elsif type == Array
|
95
|
-
self[config_key] =
|
95
|
+
self[config_key] = if DEFAULTS[config_key].key?(:transform)
|
96
|
+
DEFAULTS[config_key][:transform].call(value)
|
97
|
+
else
|
98
|
+
value.split(/\s*,\s*/)
|
99
|
+
end
|
96
100
|
elsif type == NewRelic::Agent::Configuration::Boolean
|
97
101
|
if /false|off|no/i.match?(value)
|
98
102
|
self[config_key] = false
|
@@ -142,6 +142,9 @@ module NewRelic
|
|
142
142
|
default = enforce_allowlist(key, evaluated)
|
143
143
|
return default if default
|
144
144
|
|
145
|
+
boolean = enforce_boolean(key, value)
|
146
|
+
evaluated = boolean if [true, false].include?(boolean)
|
147
|
+
|
145
148
|
apply_transformations(key, evaluated)
|
146
149
|
end
|
147
150
|
|
@@ -167,6 +170,18 @@ module NewRelic
|
|
167
170
|
default
|
168
171
|
end
|
169
172
|
|
173
|
+
def enforce_boolean(key, value)
|
174
|
+
type = default_source.value_from_defaults(key, :type)
|
175
|
+
return unless type == Boolean
|
176
|
+
|
177
|
+
bool_value = default_source.boolean_for(key, value)
|
178
|
+
return bool_value unless bool_value.nil?
|
179
|
+
|
180
|
+
default = default_source.default_for(key)
|
181
|
+
NewRelic::Agent.logger.warn "Invalid value '#{value}' for #{key}, applying default value of '#{default}'"
|
182
|
+
default
|
183
|
+
end
|
184
|
+
|
170
185
|
def transform_from_default(key)
|
171
186
|
default_source.transform_for(key)
|
172
187
|
end
|
@@ -388,7 +403,7 @@ module NewRelic
|
|
388
403
|
# modified. The hash really only needs to be modified for the benefit
|
389
404
|
# of the security agent, so if JRuby is in play and the security agent
|
390
405
|
# is not, don't attempt to modify the hash at all and return early.
|
391
|
-
return
|
406
|
+
return new_cache if NewRelic::LanguageSupport.jruby? && !Agent.config[:'security.agent.enabled']
|
392
407
|
|
393
408
|
@lock.synchronize do
|
394
409
|
preserved = @cache.dup.select { |_k, v| DEPENDENCY_DETECTION_VALUES.include?(v) }
|
@@ -7,17 +7,17 @@ module NewRelic
|
|
7
7
|
module Database
|
8
8
|
module ObfuscationHelpers
|
9
9
|
COMPONENTS_REGEX_MAP = {
|
10
|
-
:
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
16
|
-
:
|
17
|
-
:
|
18
|
-
:
|
19
|
-
:
|
20
|
-
}
|
10
|
+
single_quotes: /'(?:[^']|'')*?(?:\\'.*|'(?!'))/,
|
11
|
+
double_quotes: /"(?:[^"]|"")*?(?:\\".*|"(?!"))/,
|
12
|
+
dollar_quotes: /(\$(?!\d)[^$]*?\$).*?(?:\1|$)/,
|
13
|
+
uuids: /\{?(?:[0-9a-fA-F]-*){32}\}?/,
|
14
|
+
numeric_literals: /-?\b(?:[0-9]+\.)?[0-9]+([eE][+-]?[0-9]+)?\b/,
|
15
|
+
boolean_literals: /\b(?:true|false|null)\b/i,
|
16
|
+
hexadecimal_literals: /0x[0-9a-fA-F]+/,
|
17
|
+
comments: /(?:#|--).*?(?=\r|\n|$)/i,
|
18
|
+
multi_line_comments: %r{/\*.*?\*/}m,
|
19
|
+
oracle_quoted_strings: /q'\[.*?(?:\]'|$)|q'\{.*?(?:\}'|$)|q'<.*?(?:>'|$)|q'\(.*?(?:\)'|$)/
|
20
|
+
}.freeze
|
21
21
|
|
22
22
|
DIALECT_COMPONENTS = {
|
23
23
|
:fallback => COMPONENTS_REGEX_MAP.keys,
|
@@ -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
|
@@ -14,7 +14,6 @@ DependencyDetection.defer do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
executes do
|
17
|
-
NewRelic::Agent.logger.info('Installing Bunny instrumentation')
|
18
17
|
require 'new_relic/agent/distributed_tracing/cross_app_tracing'
|
19
18
|
require 'new_relic/agent/messaging'
|
20
19
|
require 'new_relic/agent/transaction/message_broker_segment'
|
@@ -22,9 +21,9 @@ DependencyDetection.defer do
|
|
22
21
|
|
23
22
|
executes do
|
24
23
|
if use_prepend?
|
25
|
-
prepend_instrument Bunny::Exchange, NewRelic::Agent::Instrumentation::Bunny::Prepend::Exchange
|
26
|
-
prepend_instrument Bunny::Queue, NewRelic::Agent::Instrumentation::Bunny::Prepend::Queue
|
27
|
-
prepend_instrument Bunny::Consumer, NewRelic::Agent::Instrumentation::Bunny::Prepend::Consumer
|
24
|
+
prepend_instrument Bunny::Exchange, NewRelic::Agent::Instrumentation::Bunny::Prepend::Exchange, 'Bunny::Exchange'
|
25
|
+
prepend_instrument Bunny::Queue, NewRelic::Agent::Instrumentation::Bunny::Prepend::Queue, 'Bunny::Queue'
|
26
|
+
prepend_instrument Bunny::Consumer, NewRelic::Agent::Instrumentation::Bunny::Prepend::Consumer, 'Bunny::Consumer'
|
28
27
|
else
|
29
28
|
chain_instrument NewRelic::Agent::Instrumentation::Bunny::Chain
|
30
29
|
end
|
@@ -16,8 +16,6 @@ DependencyDetection.defer do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
executes do
|
19
|
-
NewRelic::Agent.logger.info('Installing concurrent-ruby instrumentation')
|
20
|
-
|
21
19
|
if use_prepend?
|
22
20
|
prepend_instrument(Concurrent::ThreadPoolExecutor, NewRelic::Agent::Instrumentation::ConcurrentRuby::Prepend)
|
23
21
|
|
@@ -16,17 +16,16 @@ DependencyDetection.defer do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
executes do
|
19
|
-
NewRelic::Agent.logger.info('Installing Curb instrumentation')
|
20
19
|
require 'new_relic/agent/distributed_tracing/cross_app_tracing'
|
21
20
|
require 'new_relic/agent/http_clients/curb_wrappers'
|
22
21
|
end
|
23
22
|
|
24
23
|
executes do
|
25
24
|
if use_prepend?
|
26
|
-
prepend_instrument Curl::Easy, NewRelic::Agent::Instrumentation::Curb::Easy::Prepend
|
27
|
-
prepend_instrument Curl::Multi, NewRelic::Agent::Instrumentation::Curb::Multi::Prepend
|
25
|
+
prepend_instrument Curl::Easy, NewRelic::Agent::Instrumentation::Curb::Easy::Prepend, 'Curb::Easy'
|
26
|
+
prepend_instrument Curl::Multi, NewRelic::Agent::Instrumentation::Curb::Multi::Prepend, 'Curb::Multi'
|
28
27
|
else
|
29
|
-
chain_instrument NewRelic::Agent::Instrumentation::Curb::Chain
|
28
|
+
chain_instrument NewRelic::Agent::Instrumentation::Curb::Chain, NewRelic::Agent::Instrumentation::Curb::Multi::INSTRUMENTATION_NAME
|
30
29
|
end
|
31
30
|
end
|
32
31
|
end
|
@@ -82,10 +82,6 @@ DependencyDetection.defer do
|
|
82
82
|
defined?(Delayed) && defined?(Delayed::Worker)
|
83
83
|
end
|
84
84
|
|
85
|
-
executes do
|
86
|
-
NewRelic::Agent.logger.info('Installing DelayedJob instrumentation [part 1/2]')
|
87
|
-
end
|
88
|
-
|
89
85
|
executes do
|
90
86
|
if use_prepend?
|
91
87
|
prepend_instrument Delayed::Worker, NewRelic::Agent::Instrumentation::DelayedJob::Prepend
|
@@ -49,16 +49,10 @@ 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
|
-
|
58
52
|
def get_arn(params)
|
59
|
-
return unless params[:table_name]
|
53
|
+
return unless params[:table_name]
|
60
54
|
|
61
|
-
NewRelic::Agent::Aws.create_arn(PRODUCT.downcase, "table/#{params[:table_name]}", config&.region
|
55
|
+
NewRelic::Agent::Aws.create_arn(PRODUCT.downcase, "table/#{params[:table_name]}", config&.region)
|
62
56
|
end
|
63
57
|
end
|
64
58
|
end
|
@@ -14,8 +14,6 @@ DependencyDetection.defer do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
executes do
|
17
|
-
NewRelic::Agent.logger.info('Installing Elasticsearch instrumentation')
|
18
|
-
|
19
17
|
to_instrument = if Gem::Version.create(Elasticsearch::VERSION) < Gem::Version.create('8.0.0')
|
20
18
|
Elasticsearch::Transport::Client
|
21
19
|
else
|
@@ -21,10 +21,6 @@ DependencyDetection.defer do
|
|
21
21
|
defined?(Ethon) && Gem::Version.new(Ethon::VERSION) >= Gem::Version.new('0.12.0')
|
22
22
|
end
|
23
23
|
|
24
|
-
executes do
|
25
|
-
NewRelic::Agent.logger.info('Installing ethon instrumentation')
|
26
|
-
end
|
27
|
-
|
28
24
|
executes do
|
29
25
|
if use_prepend?
|
30
26
|
# NOTE: by default prepend_instrument will go with the module name that
|
@@ -19,9 +19,7 @@ DependencyDetection.defer do
|
|
19
19
|
|
20
20
|
depends_on do
|
21
21
|
begin
|
22
|
-
if
|
23
|
-
((Gem::Version.new(Bundler::VERSION) >= Gem::Version.new('2.0.0') && Bundler.rubygems.installed_specs.map(&:name).include?('newrelic-grape')) ||
|
24
|
-
Bundler.rubygems.all_specs.map(&:name).include?('newrelic-grape'))
|
22
|
+
if NewRelic::Helper.rubygems_specs.map(&:name).include?('newrelic-grape')
|
25
23
|
NewRelic::Agent.logger.info('Not installing New Relic supported Grape instrumentation because the third party newrelic-grape gem is present')
|
26
24
|
false
|
27
25
|
else
|