newrelic_rpm 9.12.0 → 9.14.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 +120 -0
- data/README.md +16 -20
- data/lib/new_relic/agent/configuration/default_source.rb +112 -3
- data/lib/new_relic/agent/configuration/environment_source.rb +5 -1
- data/lib/new_relic/agent/configuration/manager.rb +23 -0
- data/lib/new_relic/agent/database/obfuscation_helpers.rb +11 -11
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +0 -13
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +0 -19
- data/lib/new_relic/agent/instrumentation/dynamodb/instrumentation.rb +3 -2
- data/lib/new_relic/agent/instrumentation/excon.rb +0 -16
- data/lib/new_relic/agent/instrumentation/grape.rb +3 -1
- data/lib/new_relic/agent/instrumentation/opensearch/chain.rb +21 -0
- data/lib/new_relic/agent/instrumentation/opensearch/instrumentation.rb +66 -0
- data/lib/new_relic/agent/instrumentation/opensearch/prepend.rb +13 -0
- data/lib/new_relic/agent/instrumentation/opensearch.rb +25 -0
- data/lib/new_relic/agent/instrumentation/rdkafka/chain.rb +71 -0
- data/lib/new_relic/agent/instrumentation/rdkafka/instrumentation.rb +70 -0
- data/lib/new_relic/agent/instrumentation/rdkafka/prepend.rb +66 -0
- data/lib/new_relic/agent/instrumentation/rdkafka.rb +27 -0
- data/lib/new_relic/agent/instrumentation/redis.rb +7 -5
- 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 +50 -0
- data/lib/new_relic/agent/instrumentation/ruby_kafka.rb +27 -0
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +0 -14
- data/lib/new_relic/agent/instrumentation/sinatra.rb +0 -13
- data/lib/new_relic/agent/instrumentation/view_component/instrumentation.rb +4 -1
- data/lib/new_relic/agent/javascript_instrumentor.rb +2 -3
- data/lib/new_relic/agent/messaging.rb +11 -5
- data/lib/new_relic/agent/serverless_handler.rb +241 -12
- data/lib/new_relic/agent/serverless_handler_event_sources.json +155 -0
- data/lib/new_relic/agent/serverless_handler_event_sources.rb +49 -0
- data/lib/new_relic/agent/system_info.rb +14 -0
- data/lib/new_relic/agent/transaction/request_attributes.rb +13 -1
- data/lib/new_relic/agent/transaction/trace_context.rb +1 -1
- data/lib/new_relic/agent.rb +93 -0
- data/lib/new_relic/control/frameworks/grape.rb +14 -0
- data/lib/new_relic/control/frameworks/padrino.rb +14 -0
- data/lib/new_relic/control/frameworks/rails4.rb +4 -2
- data/lib/new_relic/environment_report.rb +6 -2
- data/lib/new_relic/language_support.rb +7 -1
- data/lib/new_relic/local_environment.rb +1 -4
- data/lib/new_relic/version.rb +1 -1
- data/lib/tasks/helpers/newrelicyml.rb +73 -11
- data/lib/tasks/instrumentation_generator/instrumentation.thor +1 -1
- data/lib/tasks/instrumentation_generator/templates/dependency_detection.tt +3 -3
- data/newrelic.yml +118 -54
- metadata +19 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0ade9f1a1a36e6382100a271c5e54a2c426c27b95884a15eac8d6740dcee29b
|
4
|
+
data.tar.gz: 18f728d4289bfda058bd54d7d7798a33c3a43d45de83f543b86dd573ff76283e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a463e150f83291e4ef1c55e23b155621694dc5cf0a709d78bf7ebd10aee7b801afaa1e76a4fd6d12858fba7806368bad7e6b5ca53bd21273f68e1f995b524edd
|
7
|
+
data.tar.gz: 9d0faa058f7810ce4edff5c91a57e584e1efaea99e6d4e533b2128727b0ccc7bb61dfa87ab0a82e134bce05010c7aec5ccef9b7960f72c502e68473885492434
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,125 @@
|
|
1
1
|
# New Relic Ruby Agent Release Notes
|
2
2
|
|
3
|
+
## v9.14.0
|
4
|
+
|
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 AcionDispatch 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
|
+
|
7
|
+
- **Feature: Add Apache Kafka instrumentation for the rdkafka and ruby-kafka gems**
|
8
|
+
|
9
|
+
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)
|
10
|
+
|
11
|
+
- **Feature: Add a configuration option to permit custom method tracers to be defined automatically**
|
12
|
+
|
13
|
+
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.
|
14
|
+
|
15
|
+
The list should be an array of `CLASS#METHOD` (for instance methods) and/or `CLASS.METHOD` (for class methods) strings.
|
16
|
+
|
17
|
+
Use fully qualified class names (using the `::` delimiter) that include any module or class namespacing.
|
18
|
+
|
19
|
+
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:
|
20
|
+
|
21
|
+
```
|
22
|
+
module MyCompany
|
23
|
+
class Image
|
24
|
+
def render_png
|
25
|
+
# code to render a PNG
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class User
|
30
|
+
def self.notify
|
31
|
+
# code to notify users
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
37
|
+
Given that source code, the `newrelic.yml` config file might request instrumentation for both of these methods like so:
|
38
|
+
|
39
|
+
```
|
40
|
+
automatic_custom_instrumentation_method_list:
|
41
|
+
- MyCompany::Image#render_png
|
42
|
+
- MyCompany::User.notify
|
43
|
+
```
|
44
|
+
|
45
|
+
That configuration example uses YAML array syntax to specify both methods. Alternatively, a comma-delimited string can be used instead:
|
46
|
+
|
47
|
+
```
|
48
|
+
automatic_custom_instrumentation_method_list: 'MyCompany::Image#render_png, MyCompany::User.notify'
|
49
|
+
```
|
50
|
+
|
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 should be used:
|
52
|
+
|
53
|
+
```
|
54
|
+
export NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST='MyCompany::Image#render_png, MyCompany::User.notify'
|
55
|
+
```
|
56
|
+
|
57
|
+
[PR#2851](https://github.com/newrelic/newrelic-ruby-agent/pull/2851)
|
58
|
+
|
59
|
+
- **Feature: Collect just MIME type for AcionDispatch 7.0+ requests**
|
60
|
+
|
61
|
+
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
|
+
|
63
|
+
- **Bugfix: Corrected Boolean coercion for `newrelic.yml` configuration**
|
64
|
+
|
65
|
+
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.
|
66
|
+
|
67
|
+
Now, the agent strictly interprets Boolean configuration values. It recognizes both actual Boolean values and certain Strings/Symbols:
|
68
|
+
- `'true'`, `'yes'`, or `'on'` (evaluates to `true`)
|
69
|
+
- `'false'`, `'no'`, or `'off'` (evaluates to `false`)
|
70
|
+
|
71
|
+
Any other inputs will revert to the setting's default configuration value. [PR#2847](https://github.com/newrelic/newrelic-ruby-agent/pull/2847)
|
72
|
+
|
73
|
+
- **Bugfix: JRuby not saving configuration values correctly in configuration manager**
|
74
|
+
|
75
|
+
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)
|
76
|
+
|
77
|
+
- **Bugfix: Update condition to verify Bundler.rubygems.installed_specs is available**
|
78
|
+
|
79
|
+
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)
|
80
|
+
|
81
|
+
- **Bugfix: Support view_component v3.15.0+**
|
82
|
+
|
83
|
+
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).
|
84
|
+
|
85
|
+
## v9.13.0
|
86
|
+
|
87
|
+
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.
|
88
|
+
|
89
|
+
- **Feature: Enhance AWS Lambda function instrumentation**
|
90
|
+
|
91
|
+
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.
|
92
|
+
* The agent's instrumentation for AWS Lambda functions now supports distributed tracing.
|
93
|
+
* 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.
|
94
|
+
* Web-based calls have the HTTP method, URI, and status code recorded.
|
95
|
+
* 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.
|
96
|
+
* 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.
|
97
|
+
[PR#2811](https://github.com/newrelic/newrelic-ruby-agent/pull/2811)
|
98
|
+
|
99
|
+
- **Feature: Add experimental OpenSearch instrumentation**
|
100
|
+
|
101
|
+
The agent will now automatically instrument the `opensearch-ruby` gem. We're marking this instrumentation as experimental because more work is needed to fully test it. OpenSearch instrumentation provides telemetry similar to Elasticsearch. Thank you, [@Earlopain](https://github.com/Earlopain) for reporting the issue and [@praveen-ks](https://github.com/praveen-ks) for an initial draft of the instrumentation. [Issue#2228](https://github.com/newrelic/newrelic-ruby-agent/issues/2228) [PR#2796](https://github.com/newrelic/newrelic-ruby-agent/pull/2796)
|
102
|
+
|
103
|
+
- **Feature: Improve framework detection accuracy for Grape and Padrino**
|
104
|
+
|
105
|
+
Previously, applications using the Grape framework would set `ruby` as their framework within the Environment Report. Now, Grape applications will be set to `grape`. Similarly, applications using the Padrino framework would be set to `sinatra`. Now, they will be set to `padrino`. This will help the New Relic security agent compatibility checks. Thank you, [@prateeksen](https://github.com/prateeksen) for making this change. [Issue#2777](https://github.com/newrelic/newrelic-ruby-agent/issues/2777) [PR#2789](https://github.com/newrelic/newrelic-ruby-agent/pull/2789)
|
106
|
+
|
107
|
+
- **Feature: Silence Bundler `all_specs` deprecation warning**
|
108
|
+
|
109
|
+
`Bundler.rubygems.all_specs` was deprecated in favor of `Bundler.rubygems.installed_specs` in Bundler versions 2+, causing the agent to emit deprecation warnings. The method has been updated when Bundler 2+ is detected and warnings are now silenced. Thanks to [@jcoyne](https://github.com/jcoyne) for reporting this issue. [Issue#2733](https://github.com/newrelic/newrelic-ruby-agent/issues/2733) [PR#2823](https://github.com/newrelic/newrelic-ruby-agent/pull/2823)
|
110
|
+
|
111
|
+
- **Bugfix: Fix Falcon dispatcher detection**
|
112
|
+
|
113
|
+
Previously, we tried to use the object space to determine whether the [Falcon web server](https://github.com/socketry/falcon) was in use. However, Falcon is not added to the object space until after the environment report is generated, resulting in a `nil` dispatcher. Now, we revert to an earlier strategy that discovered the dispatcher using `File.basename`. Thank you, [@prateeksen](https://github.com/prateeksen) for reporting this issue and researching the problem. [Issue#2778](https://github.com/newrelic/newrelic-ruby-agent/issues/2778) [PR#2795](https://github.com/newrelic/newrelic-ruby-agent/pull/2795)
|
114
|
+
|
115
|
+
- **Bugfix: Fix for a Redis instrumentation error when Redis::Cluster::Client is present**
|
116
|
+
|
117
|
+
The Redis instrumentation previously contained a bug that would cause it to error out when `Redis::Cluster::Client` was present, owing to the use of a Ruby `return` outside of a method. Thanks very much to [@jdelStrother](https://github.com/jdelStrother) for not only reporting this bug but pointing us to the root cause as well. [Issue#2814](https://github.com/newrelic/newrelic-ruby-agent/issues/2814) [PR#2816](https://github.com/newrelic/newrelic-ruby-agent/pull/2816)
|
118
|
+
|
119
|
+
- **Bugfix: Address JRuby concurrency issue with config hash accessing**
|
120
|
+
|
121
|
+
The agent's internal configuration class maintains a hash that occassionally gets rebuilt. During the rebuild, certain previously dynamically determined instrumentation values are preserved for the benefit of the [New Relic Ruby security agent](https://github.com/newrelic/csec-ruby-agent). After reports from JRuby customers regarding concurrency issues related to the hash being accessed while being modified, two separate fixes went into the hash rebuild logic previously: a `Hash#dup` operation and a `synchronize do` block. But errors were still reported. We ourselves remain unable to reproduce these concurrency errors despite using the same exact versions of JRuby and all reported software. After confirming that the hash access code in question is only needed for the Ruby security agent (which operates only in non-production dedicated security testing environments), we have introduced a new fix for JRuby customers that will simply skip over the troublesome code when JRuby is in play but the security agent is not. [PR#2798](https://github.com/newrelic/newrelic-ruby-agent/pull/2798)
|
122
|
+
|
3
123
|
## v9.12.0
|
4
124
|
|
5
125
|
Version 9.12.0 adds support for the `newrelic_security` agent, introduces instrumentation for the LogStasher gem, improves instrumentation for the `redis-clustering` gem, and updates the Elasticsearch instrumentation to only attempt to get the cluster name once per client, even if it fails.
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
<a href="https://opensource.newrelic.com/oss-category/#community-plus"><picture><source media="(prefers-color-scheme: dark)" srcset="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/dark/Community_Plus.png"><source media="(prefers-color-scheme: light)" srcset="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Community_Plus.png"><img alt="New Relic Open Source community plus project banner." src="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Community_Plus.png"></picture></a>
|
2
2
|
|
3
|
-
# New Relic Ruby
|
3
|
+
# New Relic Ruby agent
|
4
4
|
|
5
5
|
The New Relic Ruby agent monitors your applications to help you
|
6
6
|
[identify and solve performance issues](https://docs.newrelic.com/docs/agents/ruby-agent/getting-started/introduction-new-relic-ruby#monitor-performance).
|
@@ -15,7 +15,7 @@ This code is actively maintained by New Relic engineering teams and delivered he
|
|
15
15
|
|
16
16
|
[![Gem Version](https://badge.fury.io/rb/newrelic_rpm.svg)](https://badge.fury.io/rb/newrelic_rpm)
|
17
17
|
|
18
|
-
## Supported
|
18
|
+
## Supported environments
|
19
19
|
|
20
20
|
An up-to-date list of Ruby versions and frameworks for the latest agent
|
21
21
|
can be found on [our docs site](http://docs.newrelic.com/docs/ruby/supported-frameworks).
|
@@ -23,14 +23,11 @@ can be found on [our docs site](http://docs.newrelic.com/docs/ruby/supported-fra
|
|
23
23
|
You can also monitor non-web applications. Refer to the "Other
|
24
24
|
Environments" section below.
|
25
25
|
|
26
|
-
|
27
|
-
Details can be found on our [getting started guide](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/instrument-lambda-function/instrument-your-own/).
|
28
|
-
|
29
|
-
## Installing and Using
|
26
|
+
## Installing and using
|
30
27
|
|
31
28
|
The latest released gem for the Ruby agent can be found at [RubyGems.org](https://rubygems.org/gems/newrelic_rpm)
|
32
29
|
|
33
|
-
### Quick
|
30
|
+
### Quick start
|
34
31
|
|
35
32
|
#### With Bundler
|
36
33
|
|
@@ -56,7 +53,7 @@ and then require the New Relic Ruby agent in your Ruby start-up sequence:
|
|
56
53
|
require 'newrelic_rpm'
|
57
54
|
```
|
58
55
|
|
59
|
-
#### Other
|
56
|
+
#### Other environments
|
60
57
|
|
61
58
|
Assuming you have installed the agent per above, you may also need to tell the Ruby agent to start for some frameworks and non-framework environments. To do so, add the following to your Ruby start-up sequence start the agent:
|
62
59
|
|
@@ -64,29 +61,29 @@ Assuming you have installed the agent per above, you may also need to tell the R
|
|
64
61
|
NewRelic::Agent.manual_start
|
65
62
|
```
|
66
63
|
|
67
|
-
### Complete
|
64
|
+
### Complete install instructions
|
68
65
|
|
69
66
|
For complete documentation on installing the New Relic Ruby agent, see the following links:
|
70
67
|
|
71
68
|
* [Introduction](https://docs.newrelic.com/docs/agents/ruby-agent/getting-started/introduction-new-relic-ruby)
|
72
|
-
* [Install the New Relic Ruby agent](https://docs.newrelic.com/docs/agents/ruby-agent/installation/install-new-relic-ruby-agent)
|
69
|
+
* [Install the New Relic Ruby agent](https://docs.newrelic.com/docs/agents/ruby-agent/installation/install-new-relic-ruby-agent). See also these docs that cover specific install scenarios:
|
70
|
+
* [Rails plugin installation](https://docs.newrelic.com/docs/agents/ruby-agent/installation/ruby-agent-installation-rails-plugin)
|
71
|
+
* [AWS Lambda](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/instrument-lambda-function/instrument-your-own/)
|
72
|
+
* [GAE Flexible Environment](https://docs.newrelic.com/docs/agents/ruby-agent/installation/install-new-relic-ruby-agent-gae-flexible-environment)
|
73
|
+
* [Pure Rack apps](http://docs.newrelic.com/docs/ruby/rack-middlewares)
|
74
|
+
* [Ruby agent and Heroku](https://docs.newrelic.com/docs/agents/ruby-agent/installation/ruby-agent-heroku)
|
75
|
+
* [Background jobs](https://docs.newrelic.com/docs/agents/ruby-agent/background-jobs/monitor-ruby-background-processes)
|
73
76
|
* [Configure the agent](https://docs.newrelic.com/docs/agents/ruby-agent/configuration/ruby-agent-configuration)
|
74
77
|
* [Update the agent](https://docs.newrelic.com/docs/agents/ruby-agent/installation/update-ruby-agent)
|
75
|
-
* [Rails plugin installation](https://docs.newrelic.com/docs/agents/ruby-agent/installation/ruby-agent-installation-rails-plugin)
|
76
|
-
* [GAE Flexible Environment](https://docs.newrelic.com/docs/agents/ruby-agent/installation/install-new-relic-ruby-agent-gae-flexible-environment)
|
77
|
-
* [Pure Rack Apps](http://docs.newrelic.com/docs/ruby/rack-middlewares)
|
78
|
-
* [Ruby agent and Heroku](https://docs.newrelic.com/docs/agents/ruby-agent/installation/ruby-agent-heroku)
|
79
|
-
* [Background Jobs](https://docs.newrelic.com/docs/agents/ruby-agent/background-jobs/monitor-ruby-background-processes)
|
80
78
|
* [Uninstall the Ruby agent](https://docs.newrelic.com/docs/agents/ruby-agent/installation/uninstall-ruby-agent)
|
81
79
|
|
82
|
-
### Recording
|
80
|
+
### Recording deploys
|
83
81
|
|
84
82
|
The Ruby agent supports recording deployments in New Relic via a command line
|
85
83
|
tool or Capistrano recipes. For more information on these features, see
|
86
84
|
[our deployment documentation](http://docs.newrelic.com/docs/ruby/recording-deployments-with-the-ruby-agent)
|
87
85
|
for more information.
|
88
86
|
|
89
|
-
|
90
87
|
## Support
|
91
88
|
|
92
89
|
Should you need assistance with New Relic products, you are in good hands with several support diagnostic tools and support channels.
|
@@ -97,11 +94,10 @@ New Relic offers NRDiag, [a client-side diagnostic utility](https://docs.newreli
|
|
97
94
|
|
98
95
|
If the issue has been confirmed as a bug or is a Feature request, please file a GitHub issue.
|
99
96
|
|
100
|
-
**Support
|
97
|
+
**Support channels**
|
101
98
|
|
102
99
|
* [New Relic Documentation](https://docs.newrelic.com/docs/agents/ruby-agent): Comprehensive guidance for using our platform
|
103
100
|
* [New Relic Community](https://forum.newrelic.com): The best place to engage in troubleshooting questions
|
104
|
-
* [New Relic Developer](https://developer.newrelic.com/): Resources for building a custom observability applications
|
105
101
|
* [New Relic University](https://learn.newrelic.com/): A range of online training for New Relic users of every level
|
106
102
|
* [New Relic Technical Support](https://support.newrelic.com/) 24/7/365 ticketed support. Read more about our [Technical Support Offerings](https://docs.newrelic.com/docs/licenses/license-information/general-usage-licenses/support-plan).
|
107
103
|
|
@@ -135,7 +131,7 @@ As of version 6.12 (released July 16, 2020), the New Relic Ruby agent is license
|
|
135
131
|
|
136
132
|
The New Relic Ruby agent may use source code from third-party libraries. When used, these libraries will be outlined in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
|
137
133
|
|
138
|
-
## Thank
|
134
|
+
## Thank you
|
139
135
|
|
140
136
|
We always look forward to connecting with the community. We welcome [contributions](https://github.com/newrelic/newrelic-ruby-agent#contributing) to our source code and suggestions for improvements, and would love to hear about what you like and want to see in the future.
|
141
137
|
|
@@ -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
|
@@ -130,8 +145,10 @@ module NewRelic
|
|
130
145
|
::NewRelic::Agent.logger.warn("Detected untested Rails version #{Rails::VERSION::STRING}")
|
131
146
|
:rails_notifications
|
132
147
|
end
|
148
|
+
when defined?(::Padrino) && defined?(::Padrino::PathRouter::Router) then :padrino
|
133
149
|
when defined?(::Sinatra) && defined?(::Sinatra::Base) then :sinatra
|
134
150
|
when defined?(::Roda) then :roda
|
151
|
+
when defined?(::Grape) then :grape
|
135
152
|
when defined?(::NewRelic::IA) then :external
|
136
153
|
else :ruby
|
137
154
|
end
|
@@ -1135,6 +1152,56 @@ module NewRelic
|
|
1135
1152
|
:allowed_from_server => false,
|
1136
1153
|
:description => 'If `false`, custom attributes will not be sent on events.'
|
1137
1154
|
},
|
1155
|
+
:automatic_custom_instrumentation_method_list => {
|
1156
|
+
:default => NewRelic::EMPTY_ARRAY,
|
1157
|
+
:public => true,
|
1158
|
+
:type => Array,
|
1159
|
+
:allowed_from_server => false,
|
1160
|
+
:transform => proc { |arr| NewRelic::Agent.add_automatic_method_tracers(arr) },
|
1161
|
+
:description => <<~DESCRIPTION
|
1162
|
+
An array of `CLASS#METHOD` (for instance methods) and/or `CLASS.METHOD` (for class methods) strings representing Ruby methods for the agent to automatically add custom instrumentation to without the need for altering any of the source code that defines the methods.
|
1163
|
+
|
1164
|
+
Use fully qualified class names (using the `::` delimiter) that include any module or class namespacing.
|
1165
|
+
|
1166
|
+
Here is some Ruby source code that defines a `render_png` instance method for an `Image` class and a `notify` class method for a `User` class, both within a `MyCompany` module namespace:
|
1167
|
+
|
1168
|
+
```
|
1169
|
+
module MyCompany
|
1170
|
+
class Image
|
1171
|
+
def render_png
|
1172
|
+
# code to render a PNG
|
1173
|
+
end
|
1174
|
+
end
|
1175
|
+
|
1176
|
+
class User
|
1177
|
+
def self.notify
|
1178
|
+
# code to notify users
|
1179
|
+
end
|
1180
|
+
end
|
1181
|
+
end
|
1182
|
+
```
|
1183
|
+
|
1184
|
+
Given that source code, the `newrelic.yml` config file might request instrumentation for both of these methods like so:
|
1185
|
+
|
1186
|
+
```
|
1187
|
+
automatic_custom_instrumentation_method_list:
|
1188
|
+
- MyCompany::Image#render_png
|
1189
|
+
- MyCompany::User.notify
|
1190
|
+
```
|
1191
|
+
|
1192
|
+
That configuration example uses YAML array syntax to specify both methods. Alternatively, a comma-delimited string can be used instead:
|
1193
|
+
|
1194
|
+
```
|
1195
|
+
automatic_custom_instrumentation_method_list: 'MyCompany::Image#render_png, MyCompany::User.notify'
|
1196
|
+
```
|
1197
|
+
|
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 should be used:
|
1199
|
+
|
1200
|
+
```
|
1201
|
+
export NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST='MyCompany::Image#render_png, MyCompany::User.notify'
|
1202
|
+
```
|
1203
|
+
DESCRIPTION
|
1204
|
+
},
|
1138
1205
|
# Custom events
|
1139
1206
|
:'custom_insights_events.enabled' => {
|
1140
1207
|
:default => true,
|
@@ -1149,9 +1216,10 @@ module NewRelic
|
|
1149
1216
|
:type => Integer,
|
1150
1217
|
:allowed_from_server => true,
|
1151
1218
|
:dynamic_name => true,
|
1219
|
+
# Keep the extra two-space indent before the second bullet to appease translation tool
|
1152
1220
|
:description => <<~DESC
|
1153
1221
|
* Specify a maximum number of custom events to buffer in memory at a time.
|
1154
|
-
|
1222
|
+
* When configuring the agent for [AI monitoring](/docs/ai-monitoring/intro-to-ai-monitoring), \
|
1155
1223
|
set to max value `100000`. This ensures the agent captures the maximum amount of LLM events.
|
1156
1224
|
DESC
|
1157
1225
|
},
|
@@ -1460,6 +1528,31 @@ module NewRelic
|
|
1460
1528
|
:allowed_from_server => false,
|
1461
1529
|
:description => 'Controls auto-instrumentation of bunny at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
|
1462
1530
|
},
|
1531
|
+
:'instrumentation.ruby_kafka' => {
|
1532
|
+
:default => 'auto',
|
1533
|
+
:public => true,
|
1534
|
+
:type => String,
|
1535
|
+
:dynamic_name => true,
|
1536
|
+
:allowed_from_server => false,
|
1537
|
+
:description => 'Controls auto-instrumentation of the ruby-kafka library at start-up. May be one of `auto`, `prepend`, `chain`, `disabled`.'
|
1538
|
+
},
|
1539
|
+
:'instrumentation.opensearch' => {
|
1540
|
+
:default => 'auto',
|
1541
|
+
:documentation_default => 'auto',
|
1542
|
+
:public => true,
|
1543
|
+
:type => String,
|
1544
|
+
:dynamic_name => true,
|
1545
|
+
:allowed_from_server => false,
|
1546
|
+
:description => 'Controls auto-instrumentation of the opensearch-ruby library at start-up. May be one of `auto`, `prepend`, `chain`, `disabled`.'
|
1547
|
+
},
|
1548
|
+
:'instrumentation.rdkafka' => {
|
1549
|
+
:default => 'auto',
|
1550
|
+
:public => true,
|
1551
|
+
:type => String,
|
1552
|
+
:dynamic_name => true,
|
1553
|
+
:allowed_from_server => false,
|
1554
|
+
:description => 'Controls auto-instrumentation of the rdkafka library at start-up. May be one of `auto`, `prepend`, `chain`, `disabled`.'
|
1555
|
+
},
|
1463
1556
|
:'instrumentation.aws_sqs' => {
|
1464
1557
|
:default => 'auto',
|
1465
1558
|
:public => true,
|
@@ -1867,6 +1960,21 @@ module NewRelic
|
|
1867
1960
|
:allowed_from_server => true,
|
1868
1961
|
:description => 'If `true`, the agent obfuscates Mongo queries in transaction traces.'
|
1869
1962
|
},
|
1963
|
+
# OpenSearch
|
1964
|
+
:'opensearch.capture_queries' => {
|
1965
|
+
:default => true,
|
1966
|
+
:public => true,
|
1967
|
+
:type => Boolean,
|
1968
|
+
:allowed_from_server => true,
|
1969
|
+
:description => 'If `true`, the agent captures OpenSearch queries in transaction traces.'
|
1970
|
+
},
|
1971
|
+
:'opensearch.obfuscate_queries' => {
|
1972
|
+
:default => true,
|
1973
|
+
:public => true,
|
1974
|
+
:type => Boolean,
|
1975
|
+
:allowed_from_server => true,
|
1976
|
+
:description => 'If `true`, the agent obfuscates OpenSearch queries in transaction traces.'
|
1977
|
+
},
|
1870
1978
|
# Process host
|
1871
1979
|
:'process_host.display_name' => {
|
1872
1980
|
:default => proc { NewRelic::Agent::Hostname.get },
|
@@ -2022,9 +2130,10 @@ module NewRelic
|
|
2022
2130
|
:public => true,
|
2023
2131
|
:type => Integer,
|
2024
2132
|
:allowed_from_server => true,
|
2133
|
+
# Keep the extra two-space indent before the second bullet to appease translation tool
|
2025
2134
|
:description => <<~DESC
|
2026
2135
|
* Defines the maximum number of span events reported from a single harvest. Any Integer between `1` and `10000` is valid.'
|
2027
|
-
|
2136
|
+
* When configuring the agent for [AI monitoring](/docs/ai-monitoring/intro-to-ai-monitoring), set to max value `10000`.\
|
2028
2137
|
This ensures the agent captures the maximum amount of distributed traces.
|
2029
2138
|
DESC
|
2030
2139
|
},
|
@@ -2174,7 +2283,7 @@ module NewRelic
|
|
2174
2283
|
:description => 'Enable or disable debugging version of JavaScript agent loader for browser monitoring instrumentation.'
|
2175
2284
|
},
|
2176
2285
|
:'browser_monitoring.ssl_for_http' => {
|
2177
|
-
:default =>
|
2286
|
+
:default => false,
|
2178
2287
|
:allow_nil => true,
|
2179
2288
|
:public => false,
|
2180
2289
|
: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
|
+
return 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
|
@@ -382,6 +397,14 @@ module NewRelic
|
|
382
397
|
def reset_cache
|
383
398
|
return new_cache unless defined?(@cache) && @cache
|
384
399
|
|
400
|
+
# Modifying the @cache hash under JRuby - even with a `synchronize do`
|
401
|
+
# block and a `Hash#dup` operation - has been known to cause issues
|
402
|
+
# with JRuby for concurrent access of the hash while it is being
|
403
|
+
# modified. The hash really only needs to be modified for the benefit
|
404
|
+
# of the security agent, so if JRuby is in play and the security agent
|
405
|
+
# is not, don't attempt to modify the hash at all and return early.
|
406
|
+
return new_cache if NewRelic::LanguageSupport.jruby? && !Agent.config[:'security.agent.enabled']
|
407
|
+
|
385
408
|
@lock.synchronize do
|
386
409
|
preserved = @cache.dup.select { |_k, v| DEPENDENCY_DETECTION_VALUES.include?(v) }
|
387
410
|
new_cache
|
@@ -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,
|
@@ -35,17 +35,4 @@ DependencyDetection.defer do
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
38
|
-
|
39
|
-
executes do
|
40
|
-
next unless Gem::Version.new(ActiveMerchant::VERSION) < Gem::Version.new('1.65.0')
|
41
|
-
|
42
|
-
deprecation_msg = 'The Ruby agent is dropping support for ActiveMerchant versions below 1.65.0 ' \
|
43
|
-
'in version 9.0.0. Please upgrade your ActiveMerchant version to continue receiving full support. ' \
|
44
|
-
|
45
|
-
NewRelic::Agent.logger.log_once(
|
46
|
-
:warn,
|
47
|
-
:deprecated_active_merchant_version,
|
48
|
-
deprecation_msg
|
49
|
-
)
|
50
|
-
end
|
51
38
|
end
|
@@ -93,23 +93,4 @@ DependencyDetection.defer do
|
|
93
93
|
chain_instrument NewRelic::Agent::Instrumentation::DelayedJob::Chain
|
94
94
|
end
|
95
95
|
end
|
96
|
-
|
97
|
-
executes do
|
98
|
-
next unless delayed_job_version < Gem::Version.new('4.1.0')
|
99
|
-
|
100
|
-
deprecation_msg = 'Instrumentation for DelayedJob versions below 4.1.0 is deprecated.' \
|
101
|
-
'It will stop being monitored in version 9.0.0. ' \
|
102
|
-
'Please upgrade your DelayedJob version to continue receiving full support. ' \
|
103
|
-
|
104
|
-
NewRelic::Agent.logger.log_once(
|
105
|
-
:warn,
|
106
|
-
:deprecated_delayed_job_version,
|
107
|
-
deprecation_msg
|
108
|
-
)
|
109
|
-
end
|
110
|
-
|
111
|
-
def delayed_job_version
|
112
|
-
# the following line needs else branch coverage
|
113
|
-
Gem.loaded_specs['delayed_job'].version if Gem.loaded_specs['delayed_job'] # rubocop:disable Style/SafeNavigation
|
114
|
-
end
|
115
96
|
end
|
@@ -31,8 +31,9 @@ module NewRelic::Agent::Instrumentation
|
|
31
31
|
collection: args[0][:table_name]
|
32
32
|
)
|
33
33
|
|
34
|
-
|
35
|
-
|
34
|
+
# TODO: Update this when it has been decided how to handle account id for ARN
|
35
|
+
# arn = get_arn(args[0])
|
36
|
+
# segment&.add_agent_attribute('cloud.resource_id', arn) if arn
|
36
37
|
|
37
38
|
@nr_captured_request = nil # clear request just in case
|
38
39
|
begin
|
@@ -33,22 +33,6 @@ DependencyDetection.defer do
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
executes do
|
37
|
-
next unless Gem::Version.new(Excon::VERSION) < Gem::Version.new('0.56.0')
|
38
|
-
|
39
|
-
deprecation_msg = 'Instrumentation for Excon versions below 0.56.0 is deprecated.' \
|
40
|
-
'They will stop being monitored in version 9.0.0. ' \
|
41
|
-
'Please upgrade your Excon version to continue receiving full support. '
|
42
|
-
|
43
|
-
NewRelic::Agent.logger.log_once(
|
44
|
-
:warn,
|
45
|
-
:deprecated_excon_version,
|
46
|
-
deprecation_msg
|
47
|
-
)
|
48
|
-
|
49
|
-
NewRelic::Agent.record_metric('Supportability/Deprecated/Excon', 1)
|
50
|
-
end
|
51
|
-
|
52
36
|
def install_excon_instrumentation(excon_version)
|
53
37
|
require 'new_relic/agent/distributed_tracing/cross_app_tracing'
|
54
38
|
require 'new_relic/agent/http_clients/excon_wrappers'
|
@@ -19,7 +19,9 @@ DependencyDetection.defer do
|
|
19
19
|
|
20
20
|
depends_on do
|
21
21
|
begin
|
22
|
-
if defined?(Bundler) &&
|
22
|
+
if defined?(Bundler) &&
|
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'))
|
23
25
|
NewRelic::Agent.logger.info('Not installing New Relic supported Grape instrumentation because the third party newrelic-grape gem is present')
|
24
26
|
false
|
25
27
|
else
|
@@ -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 OpenSearch::Chain
|
7
|
+
def self.instrument!
|
8
|
+
::OpenSearch::Transport::Client.class_eval do
|
9
|
+
include NewRelic::Agent::Instrumentation::OpenSearch
|
10
|
+
|
11
|
+
alias_method(:perform_request_without_tracing, :perform_request)
|
12
|
+
|
13
|
+
def perform_request(*args)
|
14
|
+
perform_request_with_tracing(*args) do
|
15
|
+
perform_request_without_tracing(*args)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|