newrelic_rpm 9.14.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 +32 -4
- data/lib/new_relic/agent/aws.rb +3 -48
- data/lib/new_relic/agent/configuration/default_source.rb +12 -3
- data/lib/new_relic/agent/configuration/manager.rb +1 -1
- 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 +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 +7 -8
- data/lib/new_relic/agent/instrumentation/view_component.rb +0 -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 +8 -5
- data/test/agent_helper.rb +1 -1
- metadata +2 -2
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,8 +1,36 @@
|
|
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
|
+
|
3
31
|
## v9.14.0
|
4
32
|
|
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
|
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+.
|
6
34
|
|
7
35
|
- **Feature: Add Apache Kafka instrumentation for the rdkafka and ruby-kafka gems**
|
8
36
|
|
@@ -42,13 +70,13 @@ Version 9.14.0 adds Apache Kafka instrumentation for the rdkafka and ruby-kafka
|
|
42
70
|
- MyCompany::User.notify
|
43
71
|
```
|
44
72
|
|
45
|
-
That configuration example uses YAML array syntax to specify both methods. Alternatively, a comma-delimited string
|
73
|
+
That configuration example uses YAML array syntax to specify both methods. Alternatively, you can use a comma-delimited string:
|
46
74
|
|
47
75
|
```
|
48
76
|
automatic_custom_instrumentation_method_list: 'MyCompany::Image#render_png, MyCompany::User.notify'
|
49
77
|
```
|
50
78
|
|
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
|
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:
|
52
80
|
|
53
81
|
```
|
54
82
|
export NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST='MyCompany::Image#render_png, MyCompany::User.notify'
|
@@ -56,7 +84,7 @@ Version 9.14.0 adds Apache Kafka instrumentation for the rdkafka and ruby-kafka
|
|
56
84
|
|
57
85
|
[PR#2851](https://github.com/newrelic/newrelic-ruby-agent/pull/2851)
|
58
86
|
|
59
|
-
- **Feature: Collect just MIME type for
|
87
|
+
- **Feature: Collect just MIME type for ActionDispatch 7.0+ requests**
|
60
88
|
|
61
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)
|
62
90
|
|
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 => {
|
@@ -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,
|
@@ -1159,7 +1168,7 @@ module NewRelic
|
|
1159
1168
|
:allowed_from_server => false,
|
1160
1169
|
:transform => proc { |arr| NewRelic::Agent.add_automatic_method_tracers(arr) },
|
1161
1170
|
:description => <<~DESCRIPTION
|
1162
|
-
An array of `CLASS#METHOD` (for instance methods) and/or `CLASS.METHOD` (for class methods) strings representing Ruby methods
|
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.
|
1163
1172
|
|
1164
1173
|
Use fully qualified class names (using the `::` delimiter) that include any module or class namespacing.
|
1165
1174
|
|
@@ -1189,13 +1198,13 @@ module NewRelic
|
|
1189
1198
|
- MyCompany::User.notify
|
1190
1199
|
```
|
1191
1200
|
|
1192
|
-
That configuration example uses YAML array syntax to specify both methods. Alternatively, a comma-delimited string
|
1201
|
+
That configuration example uses YAML array syntax to specify both methods. Alternatively, you can use a comma-delimited string:
|
1193
1202
|
|
1194
1203
|
```
|
1195
1204
|
automatic_custom_instrumentation_method_list: 'MyCompany::Image#render_png, MyCompany::User.notify'
|
1196
1205
|
```
|
1197
1206
|
|
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
|
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:
|
1199
1208
|
|
1200
1209
|
```
|
1201
1210
|
export NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST='MyCompany::Image#render_png, MyCompany::User.notify'
|
@@ -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
|
@@ -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
|
@@ -31,9 +31,8 @@ module NewRelic::Agent::Instrumentation
|
|
31
31
|
collection: args[0][:table_name]
|
32
32
|
)
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
# segment&.add_agent_attribute('cloud.resource_id', arn) if arn
|
34
|
+
arn = get_arn(args[0])
|
35
|
+
segment&.add_agent_attribute('cloud.resource_id', arn) if arn
|
37
36
|
|
38
37
|
@nr_captured_request = nil # clear request just in case
|
39
38
|
begin
|
@@ -50,16 +49,10 @@ module NewRelic::Agent::Instrumentation
|
|
50
49
|
@nr_captured_request = yield
|
51
50
|
end
|
52
51
|
|
53
|
-
def nr_account_id
|
54
|
-
return @nr_account_id if defined?(@nr_account_id)
|
55
|
-
|
56
|
-
@nr_account_id = NewRelic::Agent::Aws.get_account_id(config)
|
57
|
-
end
|
58
|
-
|
59
52
|
def get_arn(params)
|
60
|
-
return unless params[:table_name]
|
53
|
+
return unless params[:table_name]
|
61
54
|
|
62
|
-
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)
|
63
56
|
end
|
64
57
|
end
|
65
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
|
-
((Bundler.rubygems.respond_to?(:installed_specs) && 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
|
@@ -13,10 +13,6 @@ DependencyDetection.defer do
|
|
13
13
|
defined?(HTTPX) && Gem::Version.new(HTTPX::VERSION) >= Gem::Version.new('1.0.0')
|
14
14
|
end
|
15
15
|
|
16
|
-
executes do
|
17
|
-
NewRelic::Agent.logger.info('Installing httpx instrumentation')
|
18
|
-
end
|
19
|
-
|
20
16
|
executes do
|
21
17
|
if use_prepend?
|
22
18
|
prepend_instrument HTTPX::Session, NewRelic::Agent::Instrumentation::HTTPX::Prepend
|
@@ -15,12 +15,10 @@ DependencyDetection.defer do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
executes do
|
18
|
-
NewRelic::Agent.logger.info('Installing Logger instrumentation')
|
19
|
-
|
20
18
|
if use_prepend?
|
21
19
|
prepend_instrument Logger, NewRelic::Agent::Instrumentation::Logger::Prepend
|
22
20
|
else
|
23
|
-
chain_instrument NewRelic::Agent::Instrumentation::Logger
|
21
|
+
chain_instrument NewRelic::Agent::Instrumentation::Logger, NewRelic::Agent::Instrumentation::Logger::INSTRUMENTATION_NAME
|
24
22
|
end
|
25
23
|
end
|
26
24
|
end
|
@@ -74,7 +74,6 @@ DependencyDetection.defer do
|
|
74
74
|
depends_on { NewRelic::Agent::Instrumentation::Memcache::DalliCAS.should_instrument? }
|
75
75
|
|
76
76
|
executes do
|
77
|
-
NewRelic::Agent.logger.info('Installing Dalli CAS Client Memcache instrumentation')
|
78
77
|
if use_prepend?
|
79
78
|
prepend_module = NewRelic::Agent::Instrumentation::Memcache::Prepend
|
80
79
|
prepend_module.dalli_cas_prependers do |client_class, instrumenting_module|
|
@@ -14,8 +14,6 @@ DependencyDetection.defer do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
executes do
|
17
|
-
NewRelic::Agent.logger.info('Installing opensearch-ruby instrumentation')
|
18
|
-
|
19
17
|
if use_prepend?
|
20
18
|
prepend_instrument OpenSearch::Transport::Client, NewRelic::Agent::Instrumentation::OpenSearch::Prepend
|
21
19
|
else
|
@@ -22,11 +22,11 @@ DependencyDetection.defer do
|
|
22
22
|
depends_on { defined?(Padrino) && defined?(Padrino::Routing::InstanceMethods) }
|
23
23
|
|
24
24
|
executes do
|
25
|
-
NewRelic::Agent
|
25
|
+
supportability_name = NewRelic::Agent::Instrumentation::Padrino::INSTRUMENTATION_NAME
|
26
26
|
if use_prepend?
|
27
|
-
prepend_instrument Padrino::Application, NewRelic::Agent::Instrumentation::PadrinoTracer::Prepend
|
27
|
+
prepend_instrument Padrino::Application, NewRelic::Agent::Instrumentation::PadrinoTracer::Prepend, supportability_name
|
28
28
|
else
|
29
|
-
chain_instrument NewRelic::Agent::Instrumentation::PadrinoTracer::Chain
|
29
|
+
chain_instrument NewRelic::Agent::Instrumentation::PadrinoTracer::Chain, supportability_name
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -17,7 +17,6 @@ DependencyDetection.defer do
|
|
17
17
|
depends_on { NewRelic::Agent::Instrumentation::Rake.safe_from_third_party_gem? }
|
18
18
|
|
19
19
|
executes do
|
20
|
-
NewRelic::Agent.logger.info('Installing Rake instrumentation')
|
21
20
|
NewRelic::Agent.logger.debug("Instrumenting Rake tasks: #{NewRelic::Agent.config[:'rake.tasks']}")
|
22
21
|
end
|
23
22
|
|
@@ -40,7 +40,8 @@ module NewRelic::Agent::Instrumentation
|
|
40
40
|
alias_method(:producer_without_new_relic, :producer)
|
41
41
|
alias_method(:consumer_without_new_relic, :consumer)
|
42
42
|
|
43
|
-
if Gem::Version.new(::Rdkafka::VERSION) >= Gem::Version.new('0.16.0')
|
43
|
+
if Gem::Version.new(::Rdkafka::VERSION) >= Gem::Version.new('0.16.0') ||
|
44
|
+
(Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7.0'))
|
44
45
|
def producer(**kwargs)
|
45
46
|
producer_without_new_relic(**kwargs).tap do |producer|
|
46
47
|
set_nr_config(producer)
|
@@ -36,7 +36,8 @@ module NewRelic::Agent::Instrumentation
|
|
36
36
|
module Prepend
|
37
37
|
include NewRelic::Agent::Instrumentation::RdkafkaConfig
|
38
38
|
|
39
|
-
if defined?(::Rdkafka) && Gem::Version.new(::Rdkafka::VERSION) >= Gem::Version.new('0.16.0')
|
39
|
+
if (defined?(::Rdkafka) && Gem::Version.new(::Rdkafka::VERSION) >= Gem::Version.new('0.16.0')) ||
|
40
|
+
(Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7.0'))
|
40
41
|
def producer(**kwargs)
|
41
42
|
super.tap do |producer|
|
42
43
|
set_nr_config(producer)
|
@@ -31,7 +31,6 @@ DependencyDetection.defer do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
executes do
|
34
|
-
NewRelic::Agent.logger.info('Installing Redis Instrumentation')
|
35
34
|
if NewRelic::Agent::Instrumentation::Redis::Constants::HAS_REDIS_CLIENT
|
36
35
|
RedisClient.register(NewRelic::Agent::Instrumentation::RedisClient::Middleware)
|
37
36
|
|
@@ -18,10 +18,6 @@ DependencyDetection.defer do
|
|
18
18
|
defined?(Airbrake) && defined?(Airbrake::AIRBRAKE_VERSION) && Gem::Version.create(Airbrake::AIRBRAKE_VERSION) < Gem::Version.create('11.0.3')
|
19
19
|
end
|
20
20
|
|
21
|
-
executes do
|
22
|
-
NewRelic::Agent.logger.info('Installing Resque instrumentation')
|
23
|
-
end
|
24
|
-
|
25
21
|
executes do
|
26
22
|
if NewRelic::Agent.config[:'resque.use_ruby_dns'] && NewRelic::Agent.config[:dispatcher] == :resque
|
27
23
|
NewRelic::Agent.logger.info('Requiring resolv-replace')
|
@@ -20,15 +20,15 @@ DependencyDetection.defer do
|
|
20
20
|
require_relative '../../rack/agent_hooks'
|
21
21
|
require_relative '../../rack/browser_monitoring'
|
22
22
|
|
23
|
-
NewRelic::Agent.logger.info('Installing Roda instrumentation')
|
24
|
-
|
25
23
|
if use_prepend?
|
26
24
|
require_relative 'roda/prepend'
|
27
|
-
|
25
|
+
|
26
|
+
supportability_name = NewRelic::Agent::Instrumentation::Roda::Tracer::INSTRUMENTATION_NAME
|
27
|
+
prepend_instrument Roda.singleton_class, NewRelic::Agent::Instrumentation::Roda::Build::Prepend, supportability_name
|
28
28
|
prepend_instrument Roda, NewRelic::Agent::Instrumentation::Roda::Prepend
|
29
29
|
else
|
30
30
|
require_relative 'roda/chain'
|
31
|
-
chain_instrument NewRelic::Agent::Instrumentation::Roda::Build::Chain
|
31
|
+
chain_instrument NewRelic::Agent::Instrumentation::Roda::Build::Chain, supportability_name
|
32
32
|
chain_instrument NewRelic::Agent::Instrumentation::Roda::Chain
|
33
33
|
end
|
34
34
|
Roda.class_eval { extend NewRelic::Agent::Instrumentation::Roda::Ignorer }
|
@@ -20,10 +20,20 @@ module NewRelic::Agent::Instrumentation
|
|
20
20
|
module Prepend
|
21
21
|
include NewRelic::Agent::Instrumentation::RubyKafka
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3')
|
24
|
+
def each_message(**args)
|
25
|
+
super do |message|
|
26
|
+
each_message_with_new_relic(message) do
|
27
|
+
yield(message)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
else
|
32
|
+
def each_message(*args)
|
33
|
+
super do |message|
|
34
|
+
each_message_with_new_relic(message) do
|
35
|
+
yield(message)
|
36
|
+
end
|
27
37
|
end
|
28
38
|
end
|
29
39
|
end
|
@@ -14,8 +14,6 @@ DependencyDetection.defer do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
executes do
|
17
|
-
NewRelic::Agent.logger.info('Installing ruby-kafka instrumentation')
|
18
|
-
|
19
17
|
if use_prepend?
|
20
18
|
prepend_instrument Kafka::Producer, NewRelic::Agent::Instrumentation::RubyKafkaProducer::Prepend
|
21
19
|
prepend_instrument Kafka::Consumer, NewRelic::Agent::Instrumentation::RubyKafkaConsumer::Prepend
|
@@ -16,10 +16,6 @@ DependencyDetection.defer do
|
|
16
16
|
depends_on { Sinatra::Base.private_method_defined?(:process_route) }
|
17
17
|
depends_on { Sinatra::Base.private_method_defined?(:route_eval) }
|
18
18
|
|
19
|
-
executes do
|
20
|
-
NewRelic::Agent.logger.info('Installing Sinatra instrumentation')
|
21
|
-
end
|
22
|
-
|
23
19
|
executes do
|
24
20
|
if use_prepend?
|
25
21
|
prepend_instrument Sinatra::Base, NewRelic::Agent::Instrumentation::Sinatra::Prepend
|
@@ -32,14 +28,15 @@ DependencyDetection.defer do
|
|
32
28
|
end
|
33
29
|
|
34
30
|
executes do
|
31
|
+
supportability_name = NewRelic::Agent::Instrumentation::Sinatra::Tracer::INSTRUMENTATION_NAME
|
35
32
|
# These requires are inside an executes block because they require rack, and
|
36
33
|
# we can't be sure that rack is available when this file is first required.
|
37
34
|
require 'new_relic/rack/agent_hooks'
|
38
35
|
require 'new_relic/rack/browser_monitoring'
|
39
36
|
if use_prepend?
|
40
|
-
prepend_instrument Sinatra::Base.singleton_class, NewRelic::Agent::Instrumentation::Sinatra::Build::Prepend
|
37
|
+
prepend_instrument Sinatra::Base.singleton_class, NewRelic::Agent::Instrumentation::Sinatra::Build::Prepend, supportability_name
|
41
38
|
else
|
42
|
-
chain_instrument NewRelic::Agent::Instrumentation::Sinatra::Build::Chain
|
39
|
+
chain_instrument NewRelic::Agent::Instrumentation::Sinatra::Build::Chain, supportability_name
|
43
40
|
end
|
44
41
|
end
|
45
42
|
end
|
@@ -11,10 +11,6 @@ DependencyDetection.defer do
|
|
11
11
|
|
12
12
|
depends_on { defined?(Tilt) }
|
13
13
|
|
14
|
-
executes do
|
15
|
-
NewRelic::Agent.logger.info('Installing Tilt instrumentation')
|
16
|
-
end
|
17
|
-
|
18
14
|
executes do
|
19
15
|
if use_prepend?
|
20
16
|
prepend_instrument Tilt::Template, NewRelic::Agent::Instrumentation::Tilt::Prepend
|
@@ -10,12 +10,7 @@ module NewRelic::Agent::Instrumentation
|
|
10
10
|
NewRelic::Agent.record_instrumentation_invocation(INSTRUMENTATION_NAME)
|
11
11
|
|
12
12
|
begin
|
13
|
-
segment = NewRelic::Agent::Tracer.start_segment(
|
14
|
-
name: metric_name(
|
15
|
-
self.class.respond_to?(:identifier) ? self.class.identifier : nil,
|
16
|
-
self.class.name
|
17
|
-
)
|
18
|
-
)
|
13
|
+
segment = NewRelic::Agent::Tracer.start_segment(name: metric_name)
|
19
14
|
yield
|
20
15
|
rescue => e
|
21
16
|
NewRelic::Agent.notice_error(e)
|
@@ -25,8 +20,12 @@ module NewRelic::Agent::Instrumentation
|
|
25
20
|
end
|
26
21
|
end
|
27
22
|
|
28
|
-
def metric_name
|
29
|
-
"View/#{metric_path(
|
23
|
+
def metric_name
|
24
|
+
"View/#{metric_path(self.class.source_location)}/#{self.class.name}"
|
25
|
+
rescue => e
|
26
|
+
NewRelic::Agent.logger.error('Error identifying View Component metric name', e)
|
27
|
+
|
28
|
+
'View/component'
|
30
29
|
end
|
31
30
|
|
32
31
|
def metric_path(identifier)
|
@@ -52,6 +52,8 @@ module NewRelic
|
|
52
52
|
DATASTORE_CATEGORY = 'datastore'
|
53
53
|
CLIENT = 'client'
|
54
54
|
|
55
|
+
DB_STATEMENT_MAX_BYTES = 4096
|
56
|
+
|
55
57
|
# Builds a Hash of error attributes as well as the Span ID when
|
56
58
|
# an error is present. Otherwise, returns nil when no error present.
|
57
59
|
def error_attributes(segment)
|
@@ -114,9 +116,9 @@ module NewRelic
|
|
114
116
|
agent_attributes[DB_SYSTEM_KEY] = segment.product if allowed?(DB_SYSTEM_KEY)
|
115
117
|
|
116
118
|
if segment.sql_statement && allowed?(DB_STATEMENT_KEY)
|
117
|
-
agent_attributes[DB_STATEMENT_KEY] = truncate(segment.sql_statement.safe_sql,
|
119
|
+
agent_attributes[DB_STATEMENT_KEY] = truncate(segment.sql_statement.safe_sql, DB_STATEMENT_MAX_BYTES)
|
118
120
|
elsif segment.nosql_statement && allowed?(DB_STATEMENT_KEY)
|
119
|
-
agent_attributes[DB_STATEMENT_KEY] = truncate(segment.nosql_statement,
|
121
|
+
agent_attributes[DB_STATEMENT_KEY] = truncate(segment.nosql_statement, DB_STATEMENT_MAX_BYTES)
|
120
122
|
end
|
121
123
|
|
122
124
|
[intrinsics, custom_attributes(segment), agent_attributes.merge(agent_attributes(segment))]
|
@@ -9,11 +9,7 @@ module NewRelic
|
|
9
9
|
module Frameworks
|
10
10
|
class Rails4 < NewRelic::Control::Frameworks::Rails3
|
11
11
|
def rails_gem_list
|
12
|
-
|
13
|
-
Bundler.rubygems.installed_specs.map { |gem| "#{gem.name} (#{gem.version})" }
|
14
|
-
else
|
15
|
-
Bundler.rubygems.all_specs.map { |gem| "#{gem.name} (#{gem.version})" }
|
16
|
-
end
|
12
|
+
NewRelic::Helper.rubygems_specs.map { |gem| "#{gem.name} (#{gem.version})" }
|
17
13
|
end
|
18
14
|
|
19
15
|
def append_plugin_list
|
@@ -25,11 +25,9 @@ module DependencyDetection
|
|
25
25
|
|
26
26
|
def detect!
|
27
27
|
@items.each do |item|
|
28
|
-
if item.
|
29
|
-
|
30
|
-
|
31
|
-
item.configure_as_unsatisfied unless item.disabled_configured?
|
32
|
-
end
|
28
|
+
next if item.executed || item.disabled_configured?
|
29
|
+
|
30
|
+
item.dependencies_satisfied? ? item.execute : item.configure_as_unsatisfied
|
33
31
|
end
|
34
32
|
end
|
35
33
|
|
@@ -65,6 +63,13 @@ module DependencyDetection
|
|
65
63
|
end
|
66
64
|
|
67
65
|
def configure_as_unsatisfied
|
66
|
+
# TODO: currently using :unsatisfied for Padrino will clobber the value
|
67
|
+
# already set for Sinatra, so skip Padrino and circle back with a
|
68
|
+
# new Padrino specific solution in the future.
|
69
|
+
#
|
70
|
+
# https://github.com/newrelic/newrelic-ruby-agent/issues/2912
|
71
|
+
return if name == :padrino
|
72
|
+
|
68
73
|
NewRelic::Agent.config.instance_variable_get(:@cache)[config_key] = :unsatisfied
|
69
74
|
end
|
70
75
|
|
@@ -44,11 +44,7 @@ module NewRelic
|
|
44
44
|
####################################
|
45
45
|
report_on('Gems') do
|
46
46
|
begin
|
47
|
-
|
48
|
-
Bundler.rubygems.installed_specs.map { |gem| "#{gem.name}(#{gem.version})" }
|
49
|
-
else
|
50
|
-
Bundler.rubygems.all_specs.map { |gem| "#{gem.name}(#{gem.version})" }
|
51
|
-
end
|
47
|
+
NewRelic::Helper.rubygems_specs.map { |gem| "#{gem.name}(#{gem.version})" }
|
52
48
|
rescue
|
53
49
|
# There are certain rubygem, bundler, rails combinations (e.g. gem
|
54
50
|
# 1.6.2, rails 2.3, bundler 1.2.3) where the code above throws an error
|
data/lib/new_relic/helper.rb
CHANGED
@@ -82,5 +82,20 @@ module NewRelic
|
|
82
82
|
File.exist?(executable_path) && File.file?(executable_path) && File.executable?(executable_path)
|
83
83
|
end
|
84
84
|
end
|
85
|
+
|
86
|
+
# Bundler version 2.5.12 deprecated all_specs and added installed_specs.
|
87
|
+
# To support newer Bundler versions, try to use installed_specs first,
|
88
|
+
# then fall back to all_specs.
|
89
|
+
# All callers expect this to be an array, so return an array if Bundler isn't defined
|
90
|
+
# @api private
|
91
|
+
def rubygems_specs
|
92
|
+
return [] unless defined?(Bundler)
|
93
|
+
|
94
|
+
if Bundler.rubygems.respond_to?(:installed_specs)
|
95
|
+
Bundler.rubygems.installed_specs
|
96
|
+
else
|
97
|
+
Bundler.rubygems.all_specs
|
98
|
+
end
|
99
|
+
end
|
85
100
|
end
|
86
101
|
end
|
@@ -90,11 +90,7 @@ module NewRelic
|
|
90
90
|
def bundled_gem?(gem_name)
|
91
91
|
return false unless defined?(Bundler)
|
92
92
|
|
93
|
-
|
94
|
-
Bundler.rubygems.installed_specs.map(&:name).include?(gem_name)
|
95
|
-
else
|
96
|
-
Bundler.rubygems.all_specs.map(&:name).include?(gem_name)
|
97
|
-
end
|
93
|
+
NewRelic::Helper.rubygems_specs.map(&:name).include?(gem_name)
|
98
94
|
rescue => e
|
99
95
|
::NewRelic::Agent.logger.info("Could not determine if third party #{gem_name} gem is installed", e)
|
100
96
|
false
|
data/lib/new_relic/version.rb
CHANGED
@@ -79,7 +79,7 @@ module Sequel
|
|
79
79
|
|
80
80
|
THREAD_SAFE_CONNECTION_POOL_CLASSES = [
|
81
81
|
(defined?(::Sequel::ThreadedConnectionPool) && ::Sequel::ThreadedConnectionPool),
|
82
|
-
(defined?(::Sequel::TimedQueueConnectionPool) && RUBY_VERSION >= '3.
|
82
|
+
(defined?(::Sequel::TimedQueueConnectionPool) && RUBY_VERSION >= '3.2' && ::Sequel::TimedQueueConnectionPool)
|
83
83
|
].compact.freeze
|
84
84
|
|
85
85
|
def explainer_for(sql)
|
@@ -2,12 +2,8 @@
|
|
2
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
3
|
# frozen_string_literal: true
|
4
4
|
|
5
|
-
require_relative '<%= @snake_name.downcase %>/instrumentation'
|
6
|
-
require_relative '<%= @snake_name.downcase %>/chain'
|
7
|
-
require_relative '<%= @snake_name.downcase %>/prepend'
|
8
|
-
|
9
5
|
DependencyDetection.defer do
|
10
|
-
named :<%= @
|
6
|
+
named :<%= @snake_name %>
|
11
7
|
|
12
8
|
depends_on do
|
13
9
|
# The class that needs to be defined to prepend/chain onto. This can be used
|
@@ -18,11 +14,18 @@ DependencyDetection.defer do
|
|
18
14
|
end
|
19
15
|
|
20
16
|
executes do
|
21
|
-
|
17
|
+
require_relative '<%= @snake_name.downcase %>/instrumentation'
|
22
18
|
|
19
|
+
# prepend_instrument and chain_instrument call extract_supportability_name
|
20
|
+
# to get the library name for supportability metrics and info-level logging.
|
21
|
+
# This is done by spliting on the 2nd to last spot of the instrumented
|
22
|
+
# module. If this isn't how we want the name to appear, pass in the desired
|
23
|
+
# name as a third argument.
|
23
24
|
if use_prepend?
|
25
|
+
require_relative '<%= @snake_name.downcase %>/prepend'
|
24
26
|
prepend_instrument <%= @class_name %>, NewRelic::Agent::Instrumentation::<%= @class_name %>::Prepend
|
25
27
|
else
|
28
|
+
require_relative '<%= @snake_name.downcase %>/chain'
|
26
29
|
chain_instrument NewRelic::Agent::Instrumentation::<%= @class_name %>::Chain
|
27
30
|
end
|
28
31
|
end
|
data/newrelic.yml
CHANGED
@@ -114,9 +114,9 @@ common: &default_settings
|
|
114
114
|
# audit_log.path: log/newrelic_audit.log
|
115
115
|
|
116
116
|
# An array of CLASS#METHOD (for instance methods) and/or CLASS.METHOD (for class
|
117
|
-
# methods) strings representing Ruby methods for the agent to automatically
|
118
|
-
# custom instrumentation to without the need for altering any of the
|
119
|
-
# that defines the methods.
|
117
|
+
# methods) strings representing Ruby methods for the agent to automatically
|
118
|
+
# add custom instrumentation to without the need for altering any of the
|
119
|
+
# source code that defines the methods.
|
120
120
|
#
|
121
121
|
# Use fully qualified class names (using the :: delimiter) that include any
|
122
122
|
# module or class namespacing.
|
@@ -138,10 +138,10 @@ common: &default_settings
|
|
138
138
|
# end
|
139
139
|
# end
|
140
140
|
# end
|
141
|
-
#
|
141
|
+
#
|
142
142
|
# Given that source code, the newrelic.yml config file might request
|
143
143
|
# instrumentation for both of these methods like so:
|
144
|
-
#
|
144
|
+
#
|
145
145
|
# automatic_custom_instrumentation_method_list:
|
146
146
|
# - MyCompany::Image#render_png
|
147
147
|
# - MyCompany::User.notify
|
@@ -216,6 +216,9 @@ common: &default_settings
|
|
216
216
|
# If true, the agent will clear Tracer::State in Agent.drop_buffered_data.
|
217
217
|
# clear_transaction_state_after_fork: false
|
218
218
|
|
219
|
+
# The AWS account ID for the AWS account associated with this app
|
220
|
+
# cloud.aws.account_id: nil
|
221
|
+
|
219
222
|
# If true, the agent will report source code level metrics for traced methods.
|
220
223
|
# See:
|
221
224
|
# https://docs.newrelic.com/docs/apm/agents/ruby-agent/features/ruby-codestream-integration/
|
data/test/agent_helper.rb
CHANGED
@@ -112,7 +112,7 @@ def assert_log_contains(log, message)
|
|
112
112
|
lines = log.array
|
113
113
|
|
114
114
|
assert (lines.any? { |line| line.match(message) }),
|
115
|
-
"Could not find message. Log contained: #{lines.join("\n")}"
|
115
|
+
"Could not find message: '#{message.inspect}'. Log contained: #{lines.join("\n")}"
|
116
116
|
end
|
117
117
|
|
118
118
|
def assert_audit_log_contains(audit_log_contents, needle)
|
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.15.0
|
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-10-31 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|