newrelic_rpm 9.6.0 → 9.7.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 +33 -2
- data/CONTRIBUTING.md +0 -7
- data/bin/newrelic +2 -9
- data/bin/newrelic_rpm +15 -0
- data/init.rb +2 -2
- data/lib/new_relic/agent/agent.rb +1 -1
- data/lib/new_relic/agent/agent_helpers/shutdown.rb +1 -1
- data/lib/new_relic/agent/agent_helpers/special_startup.rb +1 -1
- data/lib/new_relic/agent/agent_helpers/start_worker_thread.rb +2 -2
- data/lib/new_relic/agent/agent_helpers/startup.rb +2 -2
- data/lib/new_relic/agent/attribute_filter.rb +3 -3
- data/lib/new_relic/agent/configuration/default_source.rb +14 -2
- data/lib/new_relic/agent/configuration/manager.rb +8 -7
- data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +1 -1
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +3 -3
- data/lib/new_relic/agent/event_loop.rb +1 -1
- data/lib/new_relic/agent/http_clients/abstract.rb +4 -0
- data/lib/new_relic/agent/http_clients/async_http_wrappers.rb +0 -3
- data/lib/new_relic/agent/http_clients/curb_wrappers.rb +1 -3
- data/lib/new_relic/agent/http_clients/ethon_wrappers.rb +0 -2
- data/lib/new_relic/agent/http_clients/excon_wrappers.rb +0 -3
- data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +1 -3
- data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +0 -3
- data/lib/new_relic/agent/http_clients/httpx_wrappers.rb +0 -2
- data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +1 -4
- data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +0 -3
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +1 -1
- data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/fiber/instrumentation.rb +1 -4
- data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sinatra.rb +1 -1
- data/lib/new_relic/agent/instrumentation/thread/instrumentation.rb +1 -4
- data/lib/new_relic/agent/instrumentation/view_component/chain.rb +21 -0
- data/lib/new_relic/agent/instrumentation/view_component/instrumentation.rb +38 -0
- data/lib/new_relic/agent/instrumentation/view_component/prepend.rb +13 -0
- data/lib/new_relic/agent/instrumentation/view_component.rb +26 -0
- data/lib/new_relic/agent/javascript_instrumentor.rb +0 -1
- data/lib/new_relic/agent/new_relic_service/encoders.rb +2 -2
- data/lib/new_relic/agent/new_relic_service.rb +8 -6
- data/lib/new_relic/agent/obfuscator.rb +0 -2
- data/lib/new_relic/agent/pipe_channel_manager.rb +2 -2
- data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +1 -2
- data/lib/new_relic/agent/sql_sampler.rb +0 -1
- data/lib/new_relic/agent/tracer.rb +4 -3
- data/lib/new_relic/agent/transaction/tracing.rb +11 -1
- data/lib/new_relic/agent/vm/{mri_vm.rb → c_ruby_vm.rb} +7 -15
- data/lib/new_relic/agent/vm.rb +2 -2
- data/lib/new_relic/agent/worker_loop.rb +1 -1
- data/lib/new_relic/agent.rb +5 -5
- data/lib/new_relic/base64.rb +25 -0
- data/lib/new_relic/cli/command.rb +6 -4
- data/lib/new_relic/constants.rb +2 -0
- data/lib/new_relic/control/frameworks/rails.rb +3 -3
- data/lib/new_relic/control/instrumentation.rb +1 -1
- data/lib/new_relic/local_environment.rb +22 -13
- data/lib/new_relic/supportability_helper.rb +1 -1
- data/lib/new_relic/version.rb +1 -1
- data/lib/tasks/config.rake +1 -1
- data/lib/tasks/helpers/config.html.erb +6 -6
- data/lib/tasks/helpers/newrelicyml.rb +1 -1
- data/newrelic.yml +6 -2
- data/newrelic_rpm.gemspec +3 -5
- data/test/agent_helper.rb +14 -2
- metadata +12 -21
- data/bin/newrelic_cmd +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ece3a3703c9847f5ddf5ddd8776a58ff03c6400e3d61053bfe227ea7ddc3d83
|
4
|
+
data.tar.gz: 14aa9f742b5a9e73d510ff88cfe5292007fb97a002a23d15bc835be72b3ae483
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 670682da76dcf65d64bd634579e63bf82ab33dafbfd72b5e66605b136d10dcdcc655e8a1d5ecac2db58e948ec57775ef74c337a43428b8458a5436458c1d1522
|
7
|
+
data.tar.gz: 9f5e190e03218aa49d57dba5299770a93f0e835436f21144f65c9e149427a496468644950ccfd6274cdda0ed735002a46a20703afc79483767439266043c5f8e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,36 @@
|
|
1
1
|
# New Relic Ruby Agent Release Notes
|
2
2
|
|
3
|
+
## v9.7.0
|
4
|
+
|
5
|
+
|
6
|
+
Version 9.7.0 introduces ViewComponent instrumentation, changes the endpoint used to access the cluster name for Elasticsearch instrumentation, removes the creation of the Ruby/Thread and Ruby/Fiber spans, and adds support for Falcon.
|
7
|
+
|
8
|
+
- **Feature: ViewComponent instrumentation**
|
9
|
+
|
10
|
+
[ViewComponent](https://viewcomponent.org/) is a now an instrumented framework. The agent currently supports Roda versions 2.0.0+. [PR#2367](https://github.com/newrelic/newrelic-ruby-agent/pull/2367)
|
11
|
+
|
12
|
+
- **Feature: Use root path to access Elasticsearch cluster name**
|
13
|
+
|
14
|
+
Previously, the agent used the cluster health endpoint (`/_cluster/health`) to access the cluster name. However, this has been found to make startup unstable for large clusters. Now, the agent uses the more performant root endpoint (`/`).
|
15
|
+
|
16
|
+
Our thanks go to [@erikkessler1](https://github.com/erikkessler1), [@gremerritt](https://github.com/gremerritt), and [@joshbranham](https://github.com/joshbranham) for reporting the issue, suggesting solutions, and testing them. [Issue#2360](https://github.com/newrelic/newrelic-ruby-agent/issues/2360) [PR#2377](https://github.com/newrelic/newrelic-ruby-agent/pull/2377)
|
17
|
+
|
18
|
+
- **Feature: Remove base64 dependency, use direct calls to String methods**
|
19
|
+
|
20
|
+
In version 9.6.0, the agent required the Ruby `base64` gem as a depdendency to prepare for deprecation warnings in Ruby 3.3 and the gem's removal from the Ruby standard libraries in 3.4. Including `base64` as a dependency has caused problems with version resolution in some environments.
|
21
|
+
|
22
|
+
To resolve this, the agent now directly calls the `String` methods used in the `base64` library in the new `NewRelic::Base64` module.
|
23
|
+
|
24
|
+
Thank you, [@Earlopain](https://github.com/Earlopain), for submitting this change. [PR#2378](https://github.com/newrelic/newrelic-ruby-agent/pull/2378)
|
25
|
+
|
26
|
+
- **Feature: Add Falcon support**
|
27
|
+
|
28
|
+
The agent now supports the web server [Falcon](https://socketry.github.io/falcon/). [PR#2383](https://github.com/newrelic/newrelic-ruby-agent/pull/2383)
|
29
|
+
|
30
|
+
- **Feature: Remove spans with name Ruby/Thread and Ruby/Fiber**
|
31
|
+
|
32
|
+
Due to the lack of helpful information and the confusion commonly caused by the spans named Ruby/Thread and Ruby/Fiber, these spans have been removed. However, the agents ability to monitor instrumented code running in a thread or fiber will remain unchanged. [PR#2389](https://github.com/newrelic/newrelic-ruby-agent/pull/2389)
|
33
|
+
|
3
34
|
## v9.6.0
|
4
35
|
|
5
36
|
Version 9.6.0 adds instrumentation for Async::HTTP, Ethon, and HTTPX, adds the ability to ignore specific routes with Roda, gleans Docker container IDs from cgroups v2-based containers, records additional synthetics attributes, fixes an issue with Rails 7.1 that could cause duplicate log records to be sent to New Relic, fixes a deprecation warning for the Sidekiq error handler, adds additional attributes for OpenTelemetry compatibility, and resolves some technical debt, thanks to the community.
|
@@ -69,7 +100,7 @@ Version 9.6.0 adds instrumentation for Async::HTTP, Ethon, and HTTPX, adds the a
|
|
69
100
|
|
70
101
|
We also received some great contributions from community members to resolve some outstanding technical debt issues. Thank you for your contributions!
|
71
102
|
* Add and Replace SLASH and ROOT constants: [PR#2256](https://github.com/newrelic/newrelic-ruby-agent/pull/2256) [chahmedejaz](https://github.com/chahmedejaz)
|
72
|
-
* Remove pry as a dev dependency:
|
103
|
+
* Remove pry as a dev dependency: PR#2665, PR#2273, AlajeBash (profile no longer active)
|
73
104
|
* Replace "start up" with "start-up": [PR#2249](https://github.com/newrelic/newrelic-ruby-agent/pull/2249) [chahmedejaz](https://github.com/chahmedejaz)
|
74
105
|
* Remove unused variables in test suites: [PR#2250](https://github.com/newrelic/newrelic-ruby-agent/pull/2250)
|
75
106
|
|
@@ -1465,7 +1496,7 @@ The multiverse collection of test suites requires a variety of data handling sof
|
|
1465
1496
|
|
1466
1497
|
- **Additional Transaction Information applied to Span Events**
|
1467
1498
|
|
1468
|
-
When Distributed Tracing and/or Infinite Tracing are enabled, the
|
1499
|
+
When Distributed Tracing and/or Infinite Tracing are enabled, the agent will now incorporate additional information from the Transaction Event on to the root Span Event of the transaction.
|
1469
1500
|
|
1470
1501
|
The following items are affected:
|
1471
1502
|
|
data/CONTRIBUTING.md
CHANGED
@@ -178,13 +178,6 @@ opensource@newrelic.com.
|
|
178
178
|
For more information about CLAs, please check out Alex Russell’s excellent post,
|
179
179
|
[“Why Do I Need to Sign This?”](https://infrequently.org/2008/06/why-do-i-need-to-sign-this/).
|
180
180
|
|
181
|
-
## Slack
|
182
|
-
|
183
|
-
We host a public Slack with a dedicated channel for contributors and maintainers
|
184
|
-
of open source projects hosted by New Relic. If you are contributing to this
|
185
|
-
project, you're welcome to request access to the #oss-contributors channel in
|
186
|
-
the newrelicusers.slack.com workspace. To request access, please use this [link](https://join.slack.com/t/newrelicusers/shared_invite/zt-1ayj69rzm-~go~Eo1whIQGYnu3qi15ng).
|
187
|
-
|
188
181
|
## Explorer's Hub
|
189
182
|
|
190
183
|
New Relic hosts and moderates an online forum where customers can interact with
|
data/bin/newrelic
CHANGED
@@ -1,15 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
+
# This command has been renamed "newrelic_rpm"
|
4
5
|
# executes one of the commands in the new_relic/commands directory
|
5
6
|
# pass the name of the command as an argument
|
6
7
|
|
7
|
-
|
8
|
-
require 'new_relic/cli/command'
|
9
|
-
begin
|
10
|
-
NewRelic::Cli::Command.run
|
11
|
-
rescue NewRelic::Cli::Command::CommandFailure => failure
|
12
|
-
STDERR.puts failure.message
|
13
|
-
STDERR.puts failure.options if failure.options
|
14
|
-
exit(1)
|
15
|
-
end
|
8
|
+
load File.dirname(__FILE__) + '/newrelic_rpm'
|
data/bin/newrelic_rpm
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# executes one of the commands in the new_relic/commands directory
|
5
|
+
# pass the name of the command as an argument
|
6
|
+
|
7
|
+
$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
|
8
|
+
require 'new_relic/cli/command'
|
9
|
+
begin
|
10
|
+
NewRelic::Cli::Command.run
|
11
|
+
rescue NewRelic::Cli::Command::CommandFailure => failure
|
12
|
+
STDERR.puts failure.message
|
13
|
+
STDERR.puts failure.options if failure.options
|
14
|
+
exit(1)
|
15
|
+
end
|
data/init.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
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
|
-
# This is the initialization for the New Relic Ruby
|
5
|
+
# This is the initialization for the New Relic Ruby agent when used as
|
6
6
|
# a plugin
|
7
7
|
require 'new_relic/control'
|
8
8
|
|
@@ -12,7 +12,7 @@ require 'new_relic/control'
|
|
12
12
|
# If you can't find any log files and you don't see anything in your
|
13
13
|
# application log files please visit support.newrelic.com.
|
14
14
|
|
15
|
-
# Initializer for the
|
15
|
+
# Initializer for the New Relic Ruby agent
|
16
16
|
|
17
17
|
# After version 2.0 of Rails we can access the configuration directly.
|
18
18
|
# We need it to add dev mode routes after initialization finished.
|
@@ -47,7 +47,7 @@ require 'new_relic/agent/agent_helpers/transmit'
|
|
47
47
|
|
48
48
|
module NewRelic
|
49
49
|
module Agent
|
50
|
-
# The
|
50
|
+
# The agent is a singleton that is instantiated when the plugin is
|
51
51
|
# activated. It collects performance data from ruby applications
|
52
52
|
# in realtime as the application runs, and periodically sends that
|
53
53
|
# data to the NewRelic server.
|
@@ -10,7 +10,7 @@ module NewRelic
|
|
10
10
|
# requests, we need to wait until the children are forked
|
11
11
|
# before connecting, otherwise the parent process sends useless data
|
12
12
|
def using_forking_dispatcher?
|
13
|
-
if [:puma, :passenger, :unicorn].include?(Agent.config[:dispatcher])
|
13
|
+
if [:puma, :passenger, :unicorn, :falcon].include?(Agent.config[:dispatcher])
|
14
14
|
::NewRelic::Agent.logger.info('Deferring startup of agent reporting thread because ' \
|
15
15
|
"#{Agent.config[:dispatcher]} may fork.")
|
16
16
|
true
|
@@ -19,12 +19,12 @@ module NewRelic
|
|
19
19
|
# See #connect for a description of connection_options.
|
20
20
|
def start_worker_thread(connection_options = {})
|
21
21
|
if disable = NewRelic::Agent.config[:disable_harvest_thread]
|
22
|
-
NewRelic::Agent.logger.info('Not starting Ruby
|
22
|
+
NewRelic::Agent.logger.info('Not starting Ruby agent worker thread because :disable_harvest_thread is ' \
|
23
23
|
"#{disable}")
|
24
24
|
return
|
25
25
|
end
|
26
26
|
|
27
|
-
::NewRelic::Agent.logger.debug('Creating Ruby
|
27
|
+
::NewRelic::Agent.logger.debug('Creating Ruby agent worker thread.')
|
28
28
|
@worker_thread = Threading::AgentThread.create('Worker Loop') do
|
29
29
|
deferred_work!(connection_options)
|
30
30
|
end
|
@@ -103,7 +103,7 @@ module NewRelic
|
|
103
103
|
# so we can disambiguate processes in the log file and make
|
104
104
|
# sure they're running a reasonable version
|
105
105
|
def log_version_and_pid
|
106
|
-
::NewRelic::Agent.logger.debug("New Relic Ruby
|
106
|
+
::NewRelic::Agent.logger.debug("New Relic Ruby agent #{NewRelic::VERSION::STRING} initialized: pid = #{$$}")
|
107
107
|
end
|
108
108
|
|
109
109
|
# Logs the configured application names
|
@@ -180,7 +180,7 @@ module NewRelic
|
|
180
180
|
|
181
181
|
unless app_name_configured?
|
182
182
|
NewRelic::Agent.logger.error('No application name configured.',
|
183
|
-
'The
|
183
|
+
'The agent cannot start without at least one. Please check your ',
|
184
184
|
'newrelic.yml and ensure that it is valid and has at least one ',
|
185
185
|
"value set for app_name in the #{NewRelic::Control.instance.env} ",
|
186
186
|
'environment.')
|
@@ -2,7 +2,7 @@
|
|
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
|
-
# This class applies filtering rules as specified in the
|
5
|
+
# This class applies filtering rules as specified in the agent attributes
|
6
6
|
# cross-agent spec.
|
7
7
|
#
|
8
8
|
# Instances of it are constructed by deriving a set of rules from the agent
|
@@ -44,7 +44,7 @@
|
|
44
44
|
# 1. First, the names are compared lexicographically. This has the impact of
|
45
45
|
# forcing shorter (more general) rules towards the top of the list and longer
|
46
46
|
# (more specific) rules towards the bottom. This is important, because the
|
47
|
-
#
|
47
|
+
# agent Attributes spec stipulates that the most specific rule for a given
|
48
48
|
# destination should take precedence. Since rules are applied top-to-bottom,
|
49
49
|
# this sorting guarantees that the most specific rule will be applied last.
|
50
50
|
# 2. If the names are identical, we next examine the wildcard flag. Rules ending
|
@@ -274,7 +274,7 @@ module NewRelic
|
|
274
274
|
|
275
275
|
def initialize(attribute_name, destinations, is_include)
|
276
276
|
@attribute_name = attribute_name.sub(/\*$/, '')
|
277
|
-
@wildcard = attribute_name.end_with?(
|
277
|
+
@wildcard = attribute_name.end_with?(ASTERISK)
|
278
278
|
@is_include = is_include
|
279
279
|
@destinations = is_include ? destinations : ~destinations
|
280
280
|
end
|
@@ -313,6 +313,7 @@ module NewRelic
|
|
313
313
|
'webpacker:compile'
|
314
314
|
].join(',').freeze
|
315
315
|
|
316
|
+
# rubocop:disable Metrics/CollectionLiteralLength
|
316
317
|
DEFAULTS = {
|
317
318
|
# Critical
|
318
319
|
:agent_enabled => {
|
@@ -336,6 +337,7 @@ module NewRelic
|
|
336
337
|
:public => true,
|
337
338
|
:type => String,
|
338
339
|
:allowed_from_server => false,
|
340
|
+
:exclude_from_reported_settings => true,
|
339
341
|
:description => 'Your New Relic <InlinePopover type="licenseKey" />.'
|
340
342
|
},
|
341
343
|
:log_level => {
|
@@ -444,7 +446,7 @@ module NewRelic
|
|
444
446
|
'before shutting down to be installed regardless of detecting scenarios where it generally should not be. ' \
|
445
447
|
'Known use-case for this option is where Sinatra is running as an embedded service within another framework ' \
|
446
448
|
'and the agent is detecting the Sinatra app and skipping the `at_exit` handler as a result. Sinatra classically ' \
|
447
|
-
'runs the entire application in an `at_exit` block and would otherwise misbehave if the
|
449
|
+
'runs the entire application in an `at_exit` block and would otherwise misbehave if the agent\'s `at_exit` handler ' \
|
448
450
|
'was also installed in those circumstances. Note: `send_data_on_exit` should also be set to `true` in tandem with this setting.'
|
449
451
|
},
|
450
452
|
:high_security => {
|
@@ -1656,6 +1658,14 @@ module NewRelic
|
|
1656
1658
|
:allowed_from_server => false,
|
1657
1659
|
:description => 'Controls auto-instrumentation of Stripe at startup. May be one of: `enabled`, `disabled`.'
|
1658
1660
|
},
|
1661
|
+
:'instrumentation.view_component' => {
|
1662
|
+
:default => 'auto',
|
1663
|
+
:public => true,
|
1664
|
+
:type => String,
|
1665
|
+
:dynamic_name => true,
|
1666
|
+
:allowed_from_server => false,
|
1667
|
+
:description => 'Controls auto-instrumentation of ViewComponent at startup. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
|
1668
|
+
},
|
1659
1669
|
:'stripe.user_data.include' => {
|
1660
1670
|
default: NewRelic::EMPTY_ARRAY,
|
1661
1671
|
public: true,
|
@@ -2227,7 +2237,8 @@ module NewRelic
|
|
2227
2237
|
:public => false,
|
2228
2238
|
:type => String,
|
2229
2239
|
:allowed_from_server => true,
|
2230
|
-
:description => 'JavaScript agent loader content.'
|
2240
|
+
:description => 'JavaScript agent loader content.',
|
2241
|
+
:exclude_from_reported_settings => true
|
2231
2242
|
},
|
2232
2243
|
:keep_alive_timeout => {
|
2233
2244
|
:default => 60,
|
@@ -2403,6 +2414,7 @@ module NewRelic
|
|
2403
2414
|
:description => 'This value represents the total amount of memory available to the host (not the process), in mebibytes (1024 squared or 1,048,576 bytes).'
|
2404
2415
|
}
|
2405
2416
|
}.freeze
|
2417
|
+
# rubocop:enable Metrics/CollectionLiteralLength
|
2406
2418
|
end
|
2407
2419
|
end
|
2408
2420
|
end
|
@@ -230,7 +230,7 @@ module NewRelic
|
|
230
230
|
end
|
231
231
|
|
232
232
|
def to_collector_hash
|
233
|
-
DottedHash.new(apply_mask(flattened)).to_hash.delete_if do |k,
|
233
|
+
DottedHash.new(apply_mask(flattened)).to_hash.delete_if do |k, _v|
|
234
234
|
default = DEFAULTS[k]
|
235
235
|
if default
|
236
236
|
default[:exclude_from_reported_settings]
|
@@ -364,7 +364,7 @@ module NewRelic
|
|
364
364
|
def reset_cache
|
365
365
|
return new_cache unless defined?(@cache) && @cache
|
366
366
|
|
367
|
-
preserved = @cache.select { |_k, v| DEPENDENCY_DETECTION_VALUES.include?(v) }
|
367
|
+
preserved = @cache.dup.select { |_k, v| DEPENDENCY_DETECTION_VALUES.include?(v) }
|
368
368
|
new_cache
|
369
369
|
preserved.each { |k, v| @cache[k] = v }
|
370
370
|
|
@@ -376,12 +376,13 @@ module NewRelic
|
|
376
376
|
end
|
377
377
|
|
378
378
|
def log_config(direction, source)
|
379
|
-
# Just generating this log message (specifically calling
|
380
|
-
#
|
381
|
-
#
|
382
|
-
#
|
379
|
+
# Just generating this log message (specifically calling `flattened`)
|
380
|
+
# is expensive enough that we don't want to do it unless we're
|
381
|
+
# actually going to be logging the message based on our current log
|
382
|
+
# level, so use a `do` block.
|
383
383
|
::NewRelic::Agent.logger.debug do
|
384
|
-
|
384
|
+
hash = flattened.delete_if { |k, _h| DEFAULTS.fetch(k, {}).fetch(:exclude_from_reported_settings, false) }
|
385
|
+
"Updating config (#{direction}) from #{source.class}. Results: #{hash.inspect}"
|
385
386
|
end
|
386
387
|
end
|
387
388
|
|
@@ -128,7 +128,7 @@ module NewRelic
|
|
128
128
|
end
|
129
129
|
|
130
130
|
def self.drop_indexes?(name, payload)
|
131
|
-
name == :deleteIndexes && payload[:selector] && payload[:selector][:index] ==
|
131
|
+
name == :deleteIndexes && payload[:selector] && payload[:selector][:index] == ASTERISK
|
132
132
|
end
|
133
133
|
|
134
134
|
def self.drop_index?(name, payload)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# frozen_string_literal: true
|
4
4
|
|
5
5
|
require 'json'
|
6
|
-
require 'base64'
|
6
|
+
require 'new_relic/base64'
|
7
7
|
|
8
8
|
module NewRelic
|
9
9
|
module Agent
|
@@ -78,7 +78,7 @@ module NewRelic
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def from_http_safe(http_safe_payload)
|
81
|
-
decoded_payload = Base64.strict_decode64(http_safe_payload)
|
81
|
+
decoded_payload = NewRelic::Base64.strict_decode64(http_safe_payload)
|
82
82
|
from_json(decoded_payload)
|
83
83
|
end
|
84
84
|
|
@@ -156,7 +156,7 @@ module NewRelic
|
|
156
156
|
#
|
157
157
|
# @api public
|
158
158
|
def http_safe
|
159
|
-
Base64.strict_encode64(text)
|
159
|
+
NewRelic::Base64.strict_encode64(text)
|
160
160
|
end
|
161
161
|
end
|
162
162
|
end
|
@@ -156,7 +156,7 @@ module NewRelic
|
|
156
156
|
end
|
157
157
|
|
158
158
|
if !errors.empty?
|
159
|
-
::NewRelic::Agent.logger.error("#{errors.size} error(s) running task for event '#{event}' in
|
159
|
+
::NewRelic::Agent.logger.error("#{errors.size} error(s) running task for event '#{event}' in agent event loop:", *errors)
|
160
160
|
end
|
161
161
|
end
|
162
162
|
|
@@ -20,8 +20,6 @@ module NewRelic
|
|
20
20
|
|
21
21
|
class HTTPRequest < AbstractRequest
|
22
22
|
HTTP_RB = 'http.rb'
|
23
|
-
HOST = 'host'
|
24
|
-
COLON = ':'
|
25
23
|
|
26
24
|
def initialize(wrapped_request)
|
27
25
|
@wrapped_request = wrapped_request
|
@@ -36,7 +34,7 @@ module NewRelic
|
|
36
34
|
end
|
37
35
|
|
38
36
|
def host_from_header
|
39
|
-
if hostname = self[
|
37
|
+
if hostname = self[LHOST]
|
40
38
|
hostname.split(COLON).first
|
41
39
|
end
|
42
40
|
end
|
@@ -39,7 +39,7 @@ DependencyDetection.defer do
|
|
39
39
|
executes do
|
40
40
|
next unless Gem::Version.new(ActiveMerchant::VERSION) < Gem::Version.new('1.65.0')
|
41
41
|
|
42
|
-
deprecation_msg = 'The Ruby
|
42
|
+
deprecation_msg = 'The Ruby agent is dropping support for ActiveMerchant versions below 1.65.0 ' \
|
43
43
|
'in version 9.0.0. Please upgrade your ActiveMerchant version to continue receiving full support. ' \
|
44
44
|
|
45
45
|
NewRelic::Agent.logger.log_once(
|
@@ -56,7 +56,7 @@ module NewRelic::Agent::Instrumentation
|
|
56
56
|
return if nr_hosts.empty?
|
57
57
|
|
58
58
|
NewRelic::Agent.disable_all_tracing do
|
59
|
-
@nr_cluster_name ||= perform_request('GET', '
|
59
|
+
@nr_cluster_name ||= perform_request('GET', '/').body['cluster_name']
|
60
60
|
end
|
61
61
|
rescue StandardError => e
|
62
62
|
NewRelic::Agent.logger.error('Failed to get cluster name for elasticsearch', e)
|
@@ -14,10 +14,7 @@ module NewRelic::Agent::Instrumentation
|
|
14
14
|
def add_thread_tracing(&block)
|
15
15
|
return block if !NewRelic::Agent::Tracer.thread_tracing_enabled?
|
16
16
|
|
17
|
-
NewRelic::Agent::Tracer.thread_block_with_current_transaction(
|
18
|
-
segment_name: 'Ruby/Fiber',
|
19
|
-
&block
|
20
|
-
)
|
17
|
+
NewRelic::Agent::Tracer.thread_block_with_current_transaction(&block)
|
21
18
|
end
|
22
19
|
end
|
23
20
|
end
|
@@ -33,7 +33,7 @@ module NewRelic::Agent::Instrumentation
|
|
33
33
|
set(:newrelic_ignores, Hash.new([])) if !respond_to?(:newrelic_ignores)
|
34
34
|
|
35
35
|
# If we call an ignore without a route, it applies to the whole app
|
36
|
-
routes = [
|
36
|
+
routes = [::NewRelic::ASTERISK] if routes.empty?
|
37
37
|
|
38
38
|
settings.newrelic_ignores[type] += routes.map do |r|
|
39
39
|
# Ugly sending to private Base#compile, but we want to mimic
|
@@ -46,7 +46,7 @@ DependencyDetection.defer do
|
|
46
46
|
executes do
|
47
47
|
next unless Gem::Version.new(Sinatra::VERSION) < Gem::Version.new('2.0.0')
|
48
48
|
|
49
|
-
deprecation_msg = 'The Ruby
|
49
|
+
deprecation_msg = 'The Ruby agent is dropping support for Sinatra versions below 2.0.0 ' \
|
50
50
|
'in version 9.0.0. Please upgrade your Sinatra version to continue receiving full compatibility. ' \
|
51
51
|
|
52
52
|
NewRelic::Agent.logger.log_once(
|
@@ -16,10 +16,7 @@ module NewRelic
|
|
16
16
|
def add_thread_tracing(*args, &block)
|
17
17
|
return block if !NewRelic::Agent::Tracer.thread_tracing_enabled?
|
18
18
|
|
19
|
-
NewRelic::Agent::Tracer.thread_block_with_current_transaction(
|
20
|
-
segment_name: 'Ruby/Thread',
|
21
|
-
&block
|
22
|
-
)
|
19
|
+
NewRelic::Agent::Tracer.thread_block_with_current_transaction(&block)
|
23
20
|
end
|
24
21
|
end
|
25
22
|
end
|
@@ -0,0 +1,21 @@
|
|
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
|
+
module NewRelic::Agent::Instrumentation
|
6
|
+
module ViewComponent::Chain
|
7
|
+
def self.instrument!
|
8
|
+
::ViewComponent::Base.class_eval do
|
9
|
+
include NewRelic::Agent::Instrumentation::ViewComponent
|
10
|
+
|
11
|
+
alias_method(:render_in_without_tracing, :render_in)
|
12
|
+
|
13
|
+
def render_in(*args)
|
14
|
+
render_in_with_tracing(*args) do
|
15
|
+
render_in_without_tracing(*args)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,38 @@
|
|
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
|
+
module NewRelic::Agent::Instrumentation
|
6
|
+
module ViewComponent
|
7
|
+
INSTRUMENTATION_NAME = NewRelic::Agent.base_name(name)
|
8
|
+
|
9
|
+
def render_in_with_tracing(*args)
|
10
|
+
NewRelic::Agent.record_instrumentation_invocation(INSTRUMENTATION_NAME)
|
11
|
+
|
12
|
+
begin
|
13
|
+
segment = NewRelic::Agent::Tracer.start_segment(
|
14
|
+
name: metric_name(self.class.identifier, self.class.name)
|
15
|
+
)
|
16
|
+
yield
|
17
|
+
rescue => e
|
18
|
+
::NewRelic::Agent.logger.debug('Error capturing ViewComponent segment', e)
|
19
|
+
ensure
|
20
|
+
segment&.finish
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def metric_name(identifier, component)
|
25
|
+
"View/#{metric_path(identifier)}/#{component}"
|
26
|
+
end
|
27
|
+
|
28
|
+
def metric_path(identifier)
|
29
|
+
return 'component' unless identifier
|
30
|
+
|
31
|
+
if (parts = identifier.split('/')).size > 1
|
32
|
+
parts[-2..-1].join('/') # Get filepath by assuming the Rails' structure: app/components/home/example_component.rb
|
33
|
+
else
|
34
|
+
NewRelic::Agent::UNKNOWN_METRIC
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,13 @@
|
|
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
|
+
module NewRelic::Agent::Instrumentation
|
6
|
+
module ViewComponent::Prepend
|
7
|
+
include NewRelic::Agent::Instrumentation::ViewComponent
|
8
|
+
|
9
|
+
def render_in(*args)
|
10
|
+
render_in_with_tracing(*args) { super }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|