newrelic_rpm 8.4.0 → 8.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +8 -6
- data/CHANGELOG.md +44 -0
- data/CONTRIBUTING.md +4 -0
- data/DOCKER.md +167 -0
- data/Dockerfile +10 -0
- data/Rakefile +8 -1
- data/docker-compose.yml +85 -0
- data/lib/new_relic/agent/configuration/default_source.rb +28 -3
- data/lib/new_relic/agent/configuration/event_harvest_config.rb +9 -2
- data/lib/new_relic/agent/configuration/manager.rb +17 -6
- data/lib/new_relic/agent/configuration/server_source.rb +2 -2
- data/lib/new_relic/agent/hostname.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_job.rb +1 -2
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +1 -1
- data/lib/new_relic/agent/messaging.rb +1 -2
- data/lib/new_relic/agent/method_tracer.rb +2 -2
- data/lib/new_relic/agent/parameter_filtering.rb +3 -3
- data/lib/new_relic/agent/synthetics_event_aggregator.rb +1 -1
- data/lib/new_relic/agent/transaction/trace_context.rb +1 -1
- data/lib/new_relic/agent/transaction_event_aggregator.rb +2 -2
- data/lib/new_relic/agent/transaction_event_recorder.rb +1 -1
- data/lib/new_relic/agent/utilization/aws.rb +32 -2
- data/lib/new_relic/agent/utilization/vendor.rb +15 -2
- data/lib/new_relic/language_support.rb +2 -1
- data/lib/new_relic/version.rb +2 -12
- data/newrelic.yml +3 -3
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff4bb770c2546249bd596030077d4bd4b6d8da0ec6fb219dfa4e0990ed4de01f
|
4
|
+
data.tar.gz: 07541c66a40a3aad42080456cf14e4614d2047961ab25b69ba78cbbf89e01a15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz: '
|
6
|
+
metadata.gz: 68f9b48eb971dec54dfcb0c95f8e870f2b04e77835b04e48a87dfdbd9e0d2b16ffbdf8c823be84ebe9faccd60e7dfbb9a6f7343af92a0976d978687ed342a87c
|
7
|
+
data.tar.gz: '0689a97e70e353df30773421725ceb217ea62202dc5f6299b1058afc03449c5b6e26383335ce0245e1611e5ac12760e5e23647aee7427ce487f07f4b7bc0661f'
|
data/.rubocop.yml
CHANGED
@@ -3,7 +3,7 @@ require:
|
|
3
3
|
|
4
4
|
AllCops:
|
5
5
|
# Prevent RuboCop from exploding when it finds an older-than-2.4 .ruby-version
|
6
|
-
TargetRubyVersion: 2.
|
6
|
+
TargetRubyVersion: 2.7
|
7
7
|
Exclude: []
|
8
8
|
|
9
9
|
Bundler/DuplicatedGem:
|
@@ -638,7 +638,7 @@ Lint/NumberedParameterAssignment:
|
|
638
638
|
Enabled: true
|
639
639
|
|
640
640
|
Lint/OrAssignmentToConstant:
|
641
|
-
Enabled:
|
641
|
+
Enabled: false
|
642
642
|
|
643
643
|
Lint/OrderedMagicComments:
|
644
644
|
Enabled: true
|
@@ -940,8 +940,9 @@ Performance/ArraySemiInfiniteRangeSlice:
|
|
940
940
|
Performance/BigDecimalWithNumericArgument:
|
941
941
|
Enabled: true
|
942
942
|
|
943
|
+
# Disabled for support of older ruby versions
|
943
944
|
Performance/BindCall:
|
944
|
-
Enabled:
|
945
|
+
Enabled: false
|
945
946
|
|
946
947
|
# Disabling for now
|
947
948
|
Performance/BlockGivenWithExplicitBlock:
|
@@ -1136,9 +1137,9 @@ Style/Alias:
|
|
1136
1137
|
Style/AndOr:
|
1137
1138
|
Enabled: false
|
1138
1139
|
|
1140
|
+
# Disabled for support of older ruby versions
|
1139
1141
|
Style/ArgumentsForwarding:
|
1140
|
-
Enabled:
|
1141
|
-
AllowOnlyRestArgument: true
|
1142
|
+
Enabled: false
|
1142
1143
|
|
1143
1144
|
Style/ArrayCoercion:
|
1144
1145
|
Enabled: false
|
@@ -1766,8 +1767,9 @@ Style/SingleLineMethods:
|
|
1766
1767
|
Enabled: false
|
1767
1768
|
# AllowIfMethodIsEmpty: false
|
1768
1769
|
|
1770
|
+
# Disabled for support of older ruby versions
|
1769
1771
|
Style/SlicingWithRange:
|
1770
|
-
Enabled:
|
1772
|
+
Enabled: false
|
1771
1773
|
|
1772
1774
|
Style/SoleNestedConditional:
|
1773
1775
|
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,49 @@
|
|
1
1
|
# New Relic Ruby Agent Release Notes #
|
2
2
|
|
3
|
+
## v8.5.0
|
4
|
+
|
5
|
+
* **AWS: Support IMDSv2 by using a token with metadata API calls**
|
6
|
+
|
7
|
+
When querying AWS for instance metadata, include a token in the request headers. If an AWS user configures instances to require a token, the agent will now work. For instances that do not require the inclusion of a token, the agent will continue to work in that context as well.
|
8
|
+
|
9
|
+
* **Muffle anticipated stderr warnings for "hostname" calls**
|
10
|
+
|
11
|
+
When using the `hostname` binary to obtain hostname information, redirect STDERR to /dev/null. Thanks very much to @frenkel for raising this issue on behalf of OpenBSD users everywhere and for providing a solution with [PR #965](https://github.com/newrelic/newrelic-ruby-agent/pull/965).
|
12
|
+
|
13
|
+
* **Added updated configuration options for transaction events and deprecated previous configs**
|
14
|
+
This release deprecates and replaces the following configuration options:
|
15
|
+
| Deprecated | Replacement |
|
16
|
+
| ----------- | ----------- |
|
17
|
+
| event_report_period.analytic_event_data | event_report_period.transaction_event_data |
|
18
|
+
| analytics_events.enabled | transaction_events.enabled |
|
19
|
+
| analytics_events.max_samples_stored | transaction_events.max_samples_stored |
|
20
|
+
|
21
|
+
* **Eliminated warnings for redefined constants in ParameterFiltering**
|
22
|
+
|
23
|
+
Fixed the ParameterFiltering constant definitions so that they are not redefined on multiple reloads of the module. Thank you to @TonyArra for bringing this issue to our attention.
|
24
|
+
|
25
|
+
* **Docker for development**
|
26
|
+
|
27
|
+
Docker and Docker Compose may now be used for local development and testing with the provided `Dockerfile` and `docker-compose.yml` files in the project root. See [DOCKER.md](DOCKER.md) for usage instructions.
|
28
|
+
|
29
|
+
|
30
|
+
* **Bugfix: Rails 5 + Puma errors in rack "can't add a new key into hash during iteration"**
|
31
|
+
|
32
|
+
When using rails 5 with puma, the agent would intermittently cause rack to raise a `RuntimeError: can't add a new key into hash during iteration`. We have identified the source of the error in our instrumentation and corrected the behavior so it no longer interferes with rack. Thanks to @sasharevzin for bringing attention to this error and providing a reproduction of the issue for us to investigate.
|
33
|
+
|
34
|
+
* **CI: target JRuby 9.3.3.0**
|
35
|
+
|
36
|
+
Many thanks to @ahorek for [PR #919](https://github.com/newrelic/newrelic-ruby-agent/pull/919), [PR #921](https://github.com/newrelic/newrelic-ruby-agent/pull/921), and [PR #922](https://github.com/newrelic/newrelic-ruby-agent/pull/922) to keep us up to date on the JRuby side of things. The agent is now actively being tested against JRuby 9.3.3.0. NOTE that this release does not contain any non-CI related changes for JRuby. Old agent versions are still expected to work with newer JRubies and the newest agent version is still expected to work with older JRubies.
|
37
|
+
|
38
|
+
* **CI: Update unit tests for Rails 7.0.2**
|
39
|
+
|
40
|
+
Ensure that the 7.0.2 release of Rails is fully compatible with all relevant tests.
|
41
|
+
|
42
|
+
* **CI: Ubuntu 20.04 LTS**
|
43
|
+
|
44
|
+
To stay current and secure, our CI automation is now backed by version 20.04 of Ubuntu's long term support offering (previously 18.04).
|
45
|
+
|
46
|
+
|
3
47
|
## v8.4.0
|
4
48
|
|
5
49
|
* **Provide basic support for Rails 7.0**
|
data/CONTRIBUTING.md
CHANGED
@@ -164,6 +164,10 @@ These tests can be run by invoking:
|
|
164
164
|
More details are available in
|
165
165
|
[test/multiverse/README.md](https://github.com/newrelic/newrelic-ruby-agent/blob/main/test/multiverse/README.md).
|
166
166
|
|
167
|
+
### Leveraging Docker for Development and/or Testing
|
168
|
+
|
169
|
+
See [DOCKER.md](DOCKER.md).
|
170
|
+
|
167
171
|
## Contributor License Agreement
|
168
172
|
|
169
173
|
Keep in mind that when you submit your Pull Request, you'll need to sign the CLA
|
data/DOCKER.md
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
# Using Docker with the New Relic Ruby Agent
|
2
|
+
|
3
|
+
These instructions will guide you through the process of setting up Docker for
|
4
|
+
use with developing the New Relic Ruby Agent. The use of Docker containers can
|
5
|
+
provide for a consistent experience free from machine specific issues.
|
6
|
+
|
7
|
+
## Quick Start
|
8
|
+
|
9
|
+
```shell
|
10
|
+
# unit tests (Ruby only)
|
11
|
+
$ docker build -t newrelic_rpm .
|
12
|
+
$ docker run --rm newrelic_rpm
|
13
|
+
|
14
|
+
# or
|
15
|
+
|
16
|
+
# functional tests (MySQL, PostgreSQL, Redis, etc.)
|
17
|
+
$ docker-compose up
|
18
|
+
$ docker-compose exec app bundle exec rake test:all
|
19
|
+
```
|
20
|
+
|
21
|
+
|
22
|
+
## Install Docker
|
23
|
+
|
24
|
+
You will need to have [Docker Desktop](https://www.docker.com/) installed and
|
25
|
+
running on your machine.
|
26
|
+
|
27
|
+
If you are using on macOS and using [Homebrew](https://brew.sh/), Docker can be
|
28
|
+
installed as a cask via:
|
29
|
+
|
30
|
+
```shell
|
31
|
+
$ brew install --cask docker
|
32
|
+
```
|
33
|
+
|
34
|
+
and then launched via the `/Applications/Docker.app` launcher that is installed.
|
35
|
+
|
36
|
+
For alternatives to using macOS with Homebrew, see Docker's
|
37
|
+
[Get Started Guide](https://www.docker.com/get-started).
|
38
|
+
|
39
|
+
|
40
|
+
## Clone the project
|
41
|
+
|
42
|
+
Use git to clone the [newrelic/newrelic-ruby-agent](https://github.com/newrelic/newrelic-ruby-agent)
|
43
|
+
project.
|
44
|
+
|
45
|
+
The [Dockerfile](Dockerfile) and [docker-compose.yml](docker-compose.yml)
|
46
|
+
files are located in the root of the project, where this `DOCKER.md`
|
47
|
+
document resides.
|
48
|
+
|
49
|
+
|
50
|
+
## Using just the Dockerfile (unit tests and standalone dev only)
|
51
|
+
|
52
|
+
The project `Dockerfile` can be used by itself to run the project unit tests.
|
53
|
+
Docker Compose and the project `docker-compose.yml` file will be needed to
|
54
|
+
run functional tests which involve communicating with data systems such as
|
55
|
+
PostgreSQL and Redis.
|
56
|
+
|
57
|
+
To run the unit tests using `Dockerfile` by itself, first change
|
58
|
+
directories to the root of the project, then build an image, and
|
59
|
+
finally run a container from the image:
|
60
|
+
|
61
|
+
```shell
|
62
|
+
$ cd /path/to/project/git/clone
|
63
|
+
$ docker build -t newrelic_rpm .
|
64
|
+
$ docker run --rm newrelic_rpm
|
65
|
+
```
|
66
|
+
|
67
|
+
The `Dockerfile` specifies a default Ruby version to test with. To override this
|
68
|
+
version, pass the `ruby_version` build arg like so when building the image:
|
69
|
+
|
70
|
+
```shell
|
71
|
+
docker build --build-arg ruby_version=2.7 .
|
72
|
+
```
|
73
|
+
|
74
|
+
**Legend:**
|
75
|
+
* `build -t <TAG>` applies a tag to the image during building.
|
76
|
+
* `.` indicates "here" and tells Docker that the `Dockerfile` file can be found
|
77
|
+
in the current directory
|
78
|
+
* `run --rm` tells Docker to remove the container after the tests complete.
|
79
|
+
* `--build-arg ruby_version=<RUBY VERSION>` specifies that a given Ruby version should be used (use MAJOR.MINOR or optionally MAJOR.MINOR.PATCH)
|
80
|
+
|
81
|
+
|
82
|
+
## Using Docker Compose (for functional tests and developing with services)
|
83
|
+
|
84
|
+
Docker Compose launches multiple containers simultaneously to support the
|
85
|
+
running of the functional tests that require a variety of data handling
|
86
|
+
server applications such as PostgreSQL, Redis, memcached, etc. Each one of
|
87
|
+
these server applications uses its own container and then there's a Ruby
|
88
|
+
container (referred to as the "app" container) that runs the Minitest tests
|
89
|
+
while connecting to the other containers.
|
90
|
+
|
91
|
+
In one shell session, change to the root of the project and then bring up all
|
92
|
+
containers with Docker Compose:
|
93
|
+
|
94
|
+
```shell
|
95
|
+
$ docker-compose up
|
96
|
+
```
|
97
|
+
|
98
|
+
By default, `docker-compose` will use the default Ruby version specified in the
|
99
|
+
`Dockerfile` file. To override this version with a custom desired version, set
|
100
|
+
the `RUBY_VERSION` environment variable before calling `docker-compose`,
|
101
|
+
like so:
|
102
|
+
|
103
|
+
```shell
|
104
|
+
RUBY_VERSION=3.0 docker-compose up
|
105
|
+
```
|
106
|
+
|
107
|
+
In a separate shell session (probably in a separate terminal split, tab, or
|
108
|
+
window), execute the 'test:all' rake task to test all standard, environment,
|
109
|
+
and multiverse tests:
|
110
|
+
|
111
|
+
```shell
|
112
|
+
$ docker-compose exec app bundle exec rake test:all
|
113
|
+
```
|
114
|
+
|
115
|
+
In lieu of running the tests, an interactive Bash shell can be
|
116
|
+
launched against the running Ruby app container for development and/or
|
117
|
+
debugging. While the `docker-compose up` shell session is still running,
|
118
|
+
bring up an additional local shell session and run the following:
|
119
|
+
|
120
|
+
```shell
|
121
|
+
$ docker-compose exec app bash
|
122
|
+
```
|
123
|
+
|
124
|
+
You will be dropped at a Bash prompt as the "relic" user, with "ruby" and
|
125
|
+
"bundle" in your PATH.
|
126
|
+
|
127
|
+
|
128
|
+
## Output
|
129
|
+
|
130
|
+
When using Docker Compose, one shell session will produce STDOUT output that
|
131
|
+
pertains to all of the services (MySQL, MongoDB, etc.) and the other shell
|
132
|
+
session will produce STDOUT output related to the Ruby based functional tests.
|
133
|
+
Both streams of output may provide information about any errors or warnings
|
134
|
+
that take place.
|
135
|
+
|
136
|
+
|
137
|
+
## Cleanup
|
138
|
+
|
139
|
+
If the project `Dockerfile` is being used without Docker Compose, then use
|
140
|
+
`docker ps` to show information about containers and `docker images`
|
141
|
+
for information about images. The `docker stop`, `docker kill`, `docker rm`
|
142
|
+
and `docker rmi` commands can be used with the appropriate container and image
|
143
|
+
ids. Run `docker --help` or read through the hosted [CLI documentation](https://docs.docker.com/engine/reference/commandline/docker/).
|
144
|
+
|
145
|
+
When Docker Compose is used, invoking `ctrl-c` in the shell session that is
|
146
|
+
running the `docker-compose up` command should suffice to prompt Docker Compose
|
147
|
+
to shut down all running containers. Otherwise, `docker-compose down` can be
|
148
|
+
ran after the `docker-compose up` process has been stopped. All relevant
|
149
|
+
containers and images can then be optionally discarded using the `docker` CLI
|
150
|
+
commands described in the previous paragraph.
|
151
|
+
|
152
|
+
Use `docker ps -a` to show a list of all containers. Pass a container id to
|
153
|
+
`docker rm` (ex: `docker rm 5c15ee2f1c4f`) to remove it.
|
154
|
+
|
155
|
+
Use `docker images` to show a list of all images. Typically, you'll want to
|
156
|
+
keep these images if you plan on running Docker with them again in the future.
|
157
|
+
If you are done with them, you can pass an image id to `docker rmi` to remove
|
158
|
+
an image (ex: `docker rmi 4253856b2570`).
|
159
|
+
|
160
|
+
## Questions, Feature Requests, Contributions, etc.
|
161
|
+
|
162
|
+
The maintainers of New Relic's Ruby agent project are hopeful that the use of
|
163
|
+
containers and these instructions can provide consistency and a lowered barrier
|
164
|
+
of entry when it comes to providing contributions to the agent project itself.
|
165
|
+
|
166
|
+
For questions, feature requests, proposals to support Podman, PRs to improve
|
167
|
+
behavior or documentation, etc., please see [CONTRIBUTING.md](CONTRIBUTING.md).
|
data/Dockerfile
ADDED
data/Rakefile
CHANGED
@@ -10,7 +10,7 @@ task :test => ['test:newrelic']
|
|
10
10
|
|
11
11
|
namespace :test do
|
12
12
|
desc "Run all tests"
|
13
|
-
task :all => %w[newrelic multiverse]
|
13
|
+
task :all => %w[newrelic multiverse all_compatible_envs]
|
14
14
|
|
15
15
|
begin
|
16
16
|
require 'test_bisect'
|
@@ -37,6 +37,13 @@ namespace :test do
|
|
37
37
|
Environments::Runner.new(args.to_a).run_and_report
|
38
38
|
end
|
39
39
|
|
40
|
+
desc "Run all mini environment tests known to work with the current Ruby version"
|
41
|
+
task :all_compatible_envs do |t, args|
|
42
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'test', 'helpers', 'ruby_rails_mappings'))
|
43
|
+
rails_versions = rails_versions_for_ruby_version(RUBY_VERSION)
|
44
|
+
Rake::Task['test:env'].invoke(*rails_versions)
|
45
|
+
end
|
46
|
+
|
40
47
|
Rake::TestTask.new(:intentional_fail) do |t|
|
41
48
|
t.libs << "#{agent_home}/test"
|
42
49
|
t.libs << "#{agent_home}/lib"
|
data/docker-compose.yml
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
version: "3.9"
|
2
|
+
services:
|
3
|
+
mysql:
|
4
|
+
image: mysql:5.7
|
5
|
+
restart: always
|
6
|
+
environment:
|
7
|
+
MYSQL_ROOT_PASSWORD: mysql_root_password
|
8
|
+
MYSQL_DATABASE: app
|
9
|
+
expose:
|
10
|
+
- "3306"
|
11
|
+
volumes:
|
12
|
+
- mysql:/var/lib/mysql
|
13
|
+
rabbitmq:
|
14
|
+
image: rabbitmq:3.9.12
|
15
|
+
restart: always
|
16
|
+
environment:
|
17
|
+
RABBITMQ_NODENAME: rabbit
|
18
|
+
expose:
|
19
|
+
- "5672"
|
20
|
+
- "15672"
|
21
|
+
- "25672"
|
22
|
+
- "4369"
|
23
|
+
memcached:
|
24
|
+
image: memcached:1.6.12
|
25
|
+
restart: always
|
26
|
+
expose:
|
27
|
+
- "11211"
|
28
|
+
mongodb:
|
29
|
+
image: mongo:5.0.4
|
30
|
+
restart: always
|
31
|
+
volumes:
|
32
|
+
- /data/db
|
33
|
+
expose:
|
34
|
+
- "27017"
|
35
|
+
postgres:
|
36
|
+
image: postgres:14.2
|
37
|
+
restart: always
|
38
|
+
environment:
|
39
|
+
POSTGRES_USER: admin
|
40
|
+
POSTGRES_PASSWORD: postgres_password
|
41
|
+
volumes:
|
42
|
+
- postgres:/var/lib/postgresql/data
|
43
|
+
expose:
|
44
|
+
- "5432"
|
45
|
+
redis:
|
46
|
+
image: redis:6.2.6
|
47
|
+
restart: always
|
48
|
+
volumes:
|
49
|
+
- /var/lib/redis
|
50
|
+
expose:
|
51
|
+
- "6379"
|
52
|
+
app:
|
53
|
+
build:
|
54
|
+
context: .
|
55
|
+
args:
|
56
|
+
- ruby_version=${RUBY_VERSION}
|
57
|
+
image: newrelic_rpm
|
58
|
+
tty: true
|
59
|
+
stdin_open: true
|
60
|
+
environment:
|
61
|
+
MYSQL_USERNAME: root
|
62
|
+
MYSQL_PASSWORD: mysql_root_password
|
63
|
+
DATABASE_NAME: app
|
64
|
+
MYSQL_HOST: mysql
|
65
|
+
POSTGRES_USERNAME: admin
|
66
|
+
POSTGRES_PASSWORD: postgres_password
|
67
|
+
command: ["irb"]
|
68
|
+
volumes:
|
69
|
+
- ".:/usr/src/app"
|
70
|
+
depends_on:
|
71
|
+
- mysql
|
72
|
+
- memcached
|
73
|
+
- mongodb
|
74
|
+
- postgres
|
75
|
+
- rabbitmq
|
76
|
+
- redis
|
77
|
+
sysctls:
|
78
|
+
- "net.ipv6.conf.all.disable_ipv6=0"
|
79
|
+
volumes:
|
80
|
+
mongodb:
|
81
|
+
driver: local
|
82
|
+
mysql:
|
83
|
+
driver: local
|
84
|
+
postgres:
|
85
|
+
driver: local
|
@@ -652,8 +652,17 @@ module NewRelic
|
|
652
652
|
:public => false,
|
653
653
|
:type => Integer,
|
654
654
|
:dynamic_name => true,
|
655
|
+
:deprecated => true,
|
656
|
+
:allowed_from_server => true,
|
657
|
+
:description => deprecated_description(:'event_report_period.transaction_event_data', 'Number of seconds betwixt connections to the New Relic transaction event collection services.')
|
658
|
+
},
|
659
|
+
:'event_report_period.transaction_event_data' => {
|
660
|
+
:default => value_of(:'event_report_period.analytic_event_data'),
|
661
|
+
:public => false,
|
662
|
+
:type => Integer,
|
663
|
+
:dynamic_name => true,
|
655
664
|
:allowed_from_server => true,
|
656
|
-
:description => 'Number of seconds betwixt connections to the New Relic
|
665
|
+
:description => 'Number of seconds betwixt connections to the New Relic transaction event collection services.'
|
657
666
|
},
|
658
667
|
:'event_report_period.custom_event_data' => {
|
659
668
|
:default => 60,
|
@@ -1550,15 +1559,31 @@ module NewRelic
|
|
1550
1559
|
:default => true,
|
1551
1560
|
:public => true,
|
1552
1561
|
:type => Boolean,
|
1562
|
+
:deprecated => true,
|
1553
1563
|
:allowed_from_server => true,
|
1554
|
-
:description => 'If `true`, enables analytics event sampling.'
|
1564
|
+
:description => deprecated_description(:'transaction_events.enabled', 'If `true`, enables analytics event sampling.')
|
1555
1565
|
},
|
1556
1566
|
:'analytics_events.max_samples_stored' => {
|
1557
1567
|
:default => 1200,
|
1558
1568
|
:public => true,
|
1559
1569
|
:type => Integer,
|
1570
|
+
:deprecated => true,
|
1571
|
+
:allowed_from_server => true,
|
1572
|
+
:description => deprecated_description(:'transaction_events.max_samples_stored', 'Defines the maximum number of request events reported from a single harvest.')
|
1573
|
+
},
|
1574
|
+
:'transaction_events.enabled' => {
|
1575
|
+
:default => value_of(:'analytics_events.enabled'),
|
1576
|
+
:public => true,
|
1577
|
+
:type => Boolean,
|
1578
|
+
:allowed_from_server => true,
|
1579
|
+
:description => 'If `true`, enables transaction event sampling.'
|
1580
|
+
},
|
1581
|
+
:'transaction_events.max_samples_stored' => {
|
1582
|
+
:default => value_of(:'analytics_events.max_samples_stored'),
|
1583
|
+
:public => true,
|
1584
|
+
:type => Integer,
|
1560
1585
|
:allowed_from_server => true,
|
1561
|
-
:description => 'Defines the maximum number of
|
1586
|
+
:description => 'Defines the maximum number of transaction events reported from a single harvest.'
|
1562
1587
|
},
|
1563
1588
|
:'analytics_events.capture_attributes' => {
|
1564
1589
|
:default => true,
|
@@ -9,11 +9,18 @@ module NewRelic
|
|
9
9
|
extend self
|
10
10
|
|
11
11
|
EVENT_HARVEST_CONFIG_KEY_MAPPING = {
|
12
|
-
:analytic_event_data => :'
|
12
|
+
:analytic_event_data => :'transaction_events.max_samples_stored',
|
13
13
|
:custom_event_data => :'custom_insights_events.max_samples_stored',
|
14
14
|
:error_event_data => :'error_collector.max_event_samples_stored'
|
15
15
|
}
|
16
16
|
|
17
|
+
# not including span_event_data here because spans are handled separately in transform_span_event_harvest_config
|
18
|
+
EVENT_HARVEST_EVENT_REPORT_PERIOD_KEY_MAPPING = {
|
19
|
+
:analytic_event_data => :'transaction_event_data',
|
20
|
+
:custom_event_data => :'custom_event_data',
|
21
|
+
:error_event_data => :'error_event_data'
|
22
|
+
}
|
23
|
+
|
17
24
|
def from_config(config)
|
18
25
|
{:harvest_limits =>
|
19
26
|
EVENT_HARVEST_CONFIG_KEY_MAPPING.merge(
|
@@ -38,7 +45,7 @@ module NewRelic
|
|
38
45
|
EVENT_HARVEST_CONFIG_KEY_MAPPING.inject({}) do |event_harvest_config, (connect_payload_key, config_key)|
|
39
46
|
if harvest_limit = connect_reply['event_harvest_config']['harvest_limits'][connect_payload_key.to_s]
|
40
47
|
event_harvest_config[config_key] = harvest_limit
|
41
|
-
report_period_key = :"event_report_period.#{connect_payload_key}"
|
48
|
+
report_period_key = :"event_report_period.#{EVENT_HARVEST_EVENT_REPORT_PERIOD_KEY_MAPPING[connect_payload_key]}"
|
42
49
|
event_harvest_config[report_period_key] = event_harvest_interval
|
43
50
|
end
|
44
51
|
event_harvest_config
|
@@ -113,10 +113,8 @@ module NewRelic
|
|
113
113
|
accessor = key.to_sym
|
114
114
|
|
115
115
|
if config.has_key?(accessor)
|
116
|
-
evaluated = evaluate_procs(config[accessor])
|
117
|
-
|
118
116
|
begin
|
119
|
-
return
|
117
|
+
return evaluate_and_apply_transformations(accessor, config[accessor])
|
120
118
|
rescue
|
121
119
|
next
|
122
120
|
end
|
@@ -134,6 +132,10 @@ module NewRelic
|
|
134
132
|
end
|
135
133
|
end
|
136
134
|
|
135
|
+
def evaluate_and_apply_transformations(key, value)
|
136
|
+
apply_transformations(key, evaluate_procs(value))
|
137
|
+
end
|
138
|
+
|
137
139
|
def apply_transformations(key, value)
|
138
140
|
if transform = transform_from_default(key)
|
139
141
|
begin
|
@@ -159,12 +161,21 @@ module NewRelic
|
|
159
161
|
def invoke_callbacks(direction, source)
|
160
162
|
return unless source
|
161
163
|
source.keys.each do |key|
|
162
|
-
|
164
|
+
begin
|
165
|
+
# we need to evaluate and apply transformations for the value to deal with procs as values
|
166
|
+
# this is usually done by the fetch method when accessing config, however the callbacks bypass that
|
167
|
+
evaluated_cache = evaluate_and_apply_transformations(key, @cache[key])
|
168
|
+
evaluated_source = evaluate_and_apply_transformations(key, source[key])
|
169
|
+
rescue
|
170
|
+
next
|
171
|
+
end
|
172
|
+
|
173
|
+
if evaluated_cache != evaluated_source
|
163
174
|
@callbacks[key].each do |proc|
|
164
175
|
if direction == :add
|
165
|
-
proc.call(
|
176
|
+
proc.call(evaluated_source)
|
166
177
|
else
|
167
|
-
proc.call(
|
178
|
+
proc.call(evaluated_cache)
|
168
179
|
end
|
169
180
|
end
|
170
181
|
end
|
@@ -76,7 +76,7 @@ module NewRelic
|
|
76
76
|
end
|
77
77
|
|
78
78
|
EVENT_HARVEST_CONFIG_SUPPORTABILITY_METRIC_NAMES = {
|
79
|
-
:'
|
79
|
+
:'transaction_events.max_samples_stored' => 'Supportability/EventHarvest/AnalyticEventData/HarvestLimit',
|
80
80
|
:'custom_insights_events.max_samples_stored' => 'Supportability/EventHarvest/CustomEventData/HarvestLimit',
|
81
81
|
:'error_collector.max_event_samples_stored' => 'Supportability/EventHarvest/ErrorEventData/HarvestLimit',
|
82
82
|
:'span_events.max_samples_stored' => 'Supportability/SpanEvent/Limit',
|
@@ -136,7 +136,7 @@ module NewRelic
|
|
136
136
|
'transaction_tracer.enabled' => 'collect_traces',
|
137
137
|
'slow_sql.enabled' => 'collect_traces',
|
138
138
|
'error_collector.enabled' => 'collect_errors',
|
139
|
-
'
|
139
|
+
'transaction_events.enabled' => 'collect_analytics_events',
|
140
140
|
'custom_insights_events.enabled' => 'collect_custom_events',
|
141
141
|
'error_collector.capture_events' => 'collect_error_events',
|
142
142
|
'span_events.enabled' => 'collect_span_events'
|
@@ -22,7 +22,7 @@ module NewRelic
|
|
22
22
|
# we get back empty string. So, solution here is to check for non-zero
|
23
23
|
# exit status and retry the command without the -f flag.
|
24
24
|
def self.get_fqdn
|
25
|
-
fqdn = %x(hostname -f).chomp!
|
25
|
+
fqdn = %x(hostname -f 2>/dev/null).chomp!
|
26
26
|
fqdn = %x(hostname).chomp! unless $?.exitstatus.zero?
|
27
27
|
fqdn
|
28
28
|
rescue => e
|
@@ -45,7 +45,7 @@ module NewRelic
|
|
45
45
|
opts[:apdex_start_time] = QueueTime.parse_frontend_timestamp(env)
|
46
46
|
# this case is for the rare occasion that an app is using Puma::Rack
|
47
47
|
# without having ::Rack as a dependency
|
48
|
-
opts[:request] = ::Rack::Request.new(env) if defined? ::Rack
|
48
|
+
opts[:request] = ::Rack::Request.new(env.dup) if defined? ::Rack
|
49
49
|
opts
|
50
50
|
end
|
51
51
|
|
@@ -316,8 +316,7 @@ module NewRelic
|
|
316
316
|
queue_name: queue_name,
|
317
317
|
exchange_type: exchange_type,
|
318
318
|
headers: message_properties[:headers],
|
319
|
-
correlation_id: message_properties[:correlation_id],
|
320
|
-
&block
|
319
|
+
correlation_id: message_properties[:correlation_id], &block
|
321
320
|
end
|
322
321
|
|
323
322
|
private
|
@@ -273,8 +273,8 @@ module NewRelic
|
|
273
273
|
scoped_metric, unscoped_metrics = _nr_scoped_unscoped_metrics(metric_name, method_name, push_scope: options[:push_scope])
|
274
274
|
|
275
275
|
_nr_define_traced_method(method_name, scoped_metric: scoped_metric, unscoped_metrics: unscoped_metrics,
|
276
|
-
|
277
|
-
|
276
|
+
code_header: options[:code_header], code_footer: options[:code_footer],
|
277
|
+
record_metrics: options[:metric], visibility: visibility)
|
278
278
|
|
279
279
|
prepend(_nr_traced_method_module)
|
280
280
|
|
@@ -7,18 +7,18 @@ module NewRelic
|
|
7
7
|
module ParameterFiltering
|
8
8
|
extend self
|
9
9
|
|
10
|
-
ACTION_DISPATCH_PARAMETER_FILTER
|
10
|
+
ACTION_DISPATCH_PARAMETER_FILTER ||= "action_dispatch.parameter_filter".freeze
|
11
11
|
|
12
12
|
if defined?(Rails) && Gem::Version.new(::Rails::VERSION::STRING) >= Gem::Version.new('5.0.0')
|
13
13
|
Rails.application.config.to_prepare do
|
14
|
-
RAILS_FILTER_CLASS
|
14
|
+
RAILS_FILTER_CLASS ||= if defined?(ActiveSupport::ParameterFilter)
|
15
15
|
ActiveSupport::ParameterFilter
|
16
16
|
elsif defined?(ActionDispatch::Http::ParameterFilter)
|
17
17
|
ActionDispatch::Http::ParameterFilter
|
18
18
|
end
|
19
19
|
end
|
20
20
|
else
|
21
|
-
RAILS_FILTER_CLASS
|
21
|
+
RAILS_FILTER_CLASS ||= if defined?(ActiveSupport::ParameterFilter)
|
22
22
|
ActiveSupport::ParameterFilter
|
23
23
|
elsif defined?(ActionDispatch::Http::ParameterFilter)
|
24
24
|
ActionDispatch::Http::ParameterFilter
|
@@ -99,7 +99,7 @@ module NewRelic
|
|
99
99
|
end
|
100
100
|
|
101
101
|
span_guid = Agent.config[:'span_events.enabled'] ? transaction.current_segment.guid : nil
|
102
|
-
transaction_guid = Agent.config[:'
|
102
|
+
transaction_guid = Agent.config[:'transaction_events.enabled'] ? transaction.guid : nil
|
103
103
|
|
104
104
|
TraceContextPayload.create \
|
105
105
|
parent_account_id: Agent.config[:account_id],
|
@@ -12,8 +12,8 @@ module NewRelic
|
|
12
12
|
module Agent
|
13
13
|
class TransactionEventAggregator < EventAggregator
|
14
14
|
named :TransactionEventAggregator
|
15
|
-
capacity_key :'
|
16
|
-
enabled_key :'
|
15
|
+
capacity_key :'transaction_events.max_samples_stored'
|
16
|
+
enabled_key :'transaction_events.enabled'
|
17
17
|
buffer_class PrioritySampledBuffer
|
18
18
|
|
19
19
|
def record priority: nil, event: nil, &blk
|
@@ -8,9 +8,39 @@ module NewRelic
|
|
8
8
|
module Agent
|
9
9
|
module Utilization
|
10
10
|
class AWS < Vendor
|
11
|
+
IMDS_BASE_URL = 'http://169.254.169.254/latest'.freeze
|
12
|
+
IMDS_KEYS = %w[instanceId instanceType availabilityZone].freeze
|
13
|
+
IMDS_TOKEN_TTL_SECS = '60'.freeze
|
14
|
+
TOKEN_OPEN_TIMEOUT_SECS = 1.freeze
|
15
|
+
TOKEN_READ_TIMEOUT_SECS = 1.freeze
|
16
|
+
|
17
|
+
class << self
|
18
|
+
def imds_token
|
19
|
+
uri = URI.parse("#{IMDS_BASE_URL}/api/token")
|
20
|
+
http = Net::HTTP.new(uri.hostname)
|
21
|
+
http.open_timeout = TOKEN_OPEN_TIMEOUT_SECS
|
22
|
+
http.read_timeout = TOKEN_READ_TIMEOUT_SECS
|
23
|
+
response = http.send_request('PUT',
|
24
|
+
uri.path,
|
25
|
+
'',
|
26
|
+
{'X-aws-ec2-metadata-token-ttl-seconds' => IMDS_TOKEN_TTL_SECS})
|
27
|
+
unless response.code == Vendor::SUCCESS
|
28
|
+
NewRelic::Agent.logger.debug 'Failed to obtain an AWS token for use with IMDS - encountered ' \
|
29
|
+
"#{response.class} with HTTP response code #{response.code} - " \
|
30
|
+
'assuming non AWS'
|
31
|
+
return
|
32
|
+
end
|
33
|
+
|
34
|
+
response.body
|
35
|
+
rescue Net::OpenTimeout
|
36
|
+
NewRelic::Agent.logger.debug 'Timed out waiting for AWS IMDS - assuming non AWS'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
11
40
|
vendor_name "aws"
|
12
|
-
endpoint "
|
13
|
-
keys
|
41
|
+
endpoint "#{IMDS_BASE_URL}/dynamic/instance-identity/document"
|
42
|
+
keys IMDS_KEYS
|
43
|
+
headers 'X-aws-ec2-metadata-token' => -> { imds_token }
|
14
44
|
key_transforms :to_sym
|
15
45
|
end
|
16
46
|
end
|
@@ -18,7 +18,7 @@ module NewRelic
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def headers headers = nil
|
21
|
-
headers ? @headers = headers.freeze :
|
21
|
+
headers ? @headers = headers.freeze : processed_headers
|
22
22
|
end
|
23
23
|
|
24
24
|
def keys keys = nil
|
@@ -28,6 +28,16 @@ module NewRelic
|
|
28
28
|
def key_transforms key_transforms = nil
|
29
29
|
key_transforms ? @key_transforms = Array(key_transforms).freeze : @key_transforms
|
30
30
|
end
|
31
|
+
|
32
|
+
def processed_headers
|
33
|
+
return unless @headers
|
34
|
+
|
35
|
+
@headers.each_with_object({}) do |(key, value), processed_hash|
|
36
|
+
# Header lambdas are expected to return string values. If nil comes back, replace it with :error
|
37
|
+
# to signify that the call failed.
|
38
|
+
processed_hash[key] = value.class.eql?(Proc) ? value.call || :error : value
|
39
|
+
end
|
40
|
+
end
|
31
41
|
end
|
32
42
|
|
33
43
|
attr_reader :metadata
|
@@ -62,10 +72,13 @@ module NewRelic
|
|
62
72
|
private
|
63
73
|
|
64
74
|
def request_metadata
|
75
|
+
processed_headers = headers
|
76
|
+
raise if processed_headers.values.include?(:error)
|
77
|
+
|
65
78
|
Timeout.timeout 1 do
|
66
79
|
response = nil
|
67
80
|
Net::HTTP.start endpoint.host, endpoint.port do |http|
|
68
|
-
req = Net::HTTP::Get.new endpoint,
|
81
|
+
req = Net::HTTP::Get.new endpoint, processed_headers
|
69
82
|
response = http.request req
|
70
83
|
end
|
71
84
|
response
|
data/lib/new_relic/version.rb
CHANGED
@@ -5,20 +5,10 @@
|
|
5
5
|
|
6
6
|
module NewRelic
|
7
7
|
module VERSION # :nodoc:
|
8
|
-
def self.build_version_string(*parts)
|
9
|
-
parts.compact.join('.')
|
10
|
-
end
|
11
|
-
|
12
8
|
MAJOR = 8
|
13
|
-
MINOR =
|
9
|
+
MINOR = 5
|
14
10
|
TINY = 0
|
15
11
|
|
16
|
-
|
17
|
-
require File.join(File.dirname(__FILE__), 'build')
|
18
|
-
rescue LoadError
|
19
|
-
BUILD = nil
|
20
|
-
end
|
21
|
-
|
22
|
-
STRING = build_version_string(MAJOR, MINOR, TINY, BUILD)
|
12
|
+
STRING = "#{MAJOR}.#{MINOR}.#{TINY}"
|
23
13
|
end
|
24
14
|
end
|
data/newrelic.yml
CHANGED
@@ -26,11 +26,11 @@ common: &default_settings
|
|
26
26
|
# All of the following configuration options are optional. Review them, and
|
27
27
|
# uncomment or edit them if they appear relevant to your application needs.
|
28
28
|
|
29
|
-
# If true, enables
|
30
|
-
#
|
29
|
+
# If true, enables transaction event sampling.
|
30
|
+
# transaction_events.enabled: true
|
31
31
|
|
32
32
|
# Defines the maximum number of request events reported from a single harvest.
|
33
|
-
#
|
33
|
+
# transaction_events.max_samples_stored: 1200
|
34
34
|
|
35
35
|
# Prefix of attributes to exclude from all destinations. Allows * as wildcard at
|
36
36
|
# end.
|
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: 8.
|
4
|
+
version: 8.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tanna McClure
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-
|
13
|
+
date: 2022-02-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
@@ -236,6 +236,8 @@ files:
|
|
236
236
|
- Brewfile
|
237
237
|
- CHANGELOG.md
|
238
238
|
- CONTRIBUTING.md
|
239
|
+
- DOCKER.md
|
240
|
+
- Dockerfile
|
239
241
|
- Gemfile
|
240
242
|
- Guardfile
|
241
243
|
- LICENSE
|
@@ -249,6 +251,7 @@ files:
|
|
249
251
|
- bin/nrdebug
|
250
252
|
- config.dot
|
251
253
|
- config/database.yml
|
254
|
+
- docker-compose.yml
|
252
255
|
- init.rb
|
253
256
|
- install.rb
|
254
257
|
- lefthook.yml
|