newrelic_rpm 6.3.0.355 → 6.8.0.360
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +50 -10
- data/CHANGELOG.md +198 -0
- data/Guardfile +7 -1
- data/lib/new_relic/agent.rb +80 -0
- data/lib/new_relic/agent/agent.rb +87 -26
- data/lib/new_relic/agent/agent_logger.rb +4 -0
- data/lib/new_relic/agent/attribute_filter.rb +7 -7
- data/lib/new_relic/agent/attributes.rb +152 -0
- data/lib/new_relic/agent/autostart.rb +19 -14
- data/lib/new_relic/agent/commands/agent_command_router.rb +2 -21
- data/lib/new_relic/agent/configuration/default_source.rb +129 -39
- data/lib/new_relic/agent/configuration/environment_source.rb +4 -2
- data/lib/new_relic/agent/configuration/event_harvest_config.rb +45 -0
- data/lib/new_relic/agent/configuration/high_security_source.rb +1 -0
- data/lib/new_relic/agent/configuration/manager.rb +13 -9
- data/lib/new_relic/agent/configuration/server_source.rb +33 -9
- data/lib/new_relic/agent/configuration/yaml_source.rb +10 -5
- data/lib/new_relic/agent/connect/request_builder.rb +11 -13
- data/lib/new_relic/agent/connect/response_handler.rb +1 -1
- data/lib/new_relic/agent/cross_app_monitor.rb +1 -1
- data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +2 -2
- data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +8 -8
- data/lib/new_relic/agent/distributed_trace_intrinsics.rb +90 -0
- data/lib/new_relic/agent/distributed_trace_metrics.rb +74 -0
- data/lib/new_relic/agent/distributed_trace_monitor.rb +2 -12
- data/lib/new_relic/agent/distributed_trace_payload.rb +9 -76
- data/lib/new_relic/agent/distributed_trace_transport_type.rb +43 -0
- data/lib/new_relic/agent/error_collector.rb +2 -2
- data/lib/new_relic/agent/error_event_aggregator.rb +2 -1
- data/lib/new_relic/agent/error_trace_aggregator.rb +1 -0
- data/lib/new_relic/agent/event_aggregator.rb +26 -32
- data/lib/new_relic/agent/guid_generator.rb +28 -0
- data/lib/new_relic/agent/inbound_request_monitor.rb +2 -2
- data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +24 -42
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +45 -69
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +70 -53
- data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +25 -18
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +33 -47
- data/lib/new_relic/agent/instrumentation/active_storage_subscriber.rb +4 -4
- data/lib/new_relic/agent/instrumentation/grape.rb +2 -3
- data/lib/new_relic/agent/instrumentation/{evented_subscriber.rb → notifications_subscriber.rb} +7 -66
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +2 -3
- data/lib/new_relic/agent/javascript_instrumentor.rb +1 -1
- data/lib/new_relic/agent/logging.rb +129 -0
- data/lib/new_relic/agent/new_relic_service.rb +7 -9
- data/lib/new_relic/agent/priority_sampled_buffer.rb +2 -0
- data/lib/new_relic/agent/span_event_aggregator.rb +2 -4
- data/lib/new_relic/agent/span_event_primitive.rb +29 -7
- data/lib/new_relic/agent/sql_sampler.rb +1 -1
- data/lib/new_relic/agent/threading/backtrace_service.rb +3 -3
- data/lib/new_relic/agent/threading/thread_profile.rb +9 -23
- data/lib/new_relic/agent/trace_context.rb +244 -0
- data/lib/new_relic/agent/trace_context_payload.rb +134 -0
- data/lib/new_relic/agent/trace_context_request_monitor.rb +42 -0
- data/lib/new_relic/agent/tracer.rb +32 -0
- data/lib/new_relic/agent/transaction.rb +26 -20
- data/lib/new_relic/agent/transaction/abstract_segment.rb +2 -2
- data/lib/new_relic/agent/transaction/distributed_tracing.rb +20 -101
- data/lib/new_relic/agent/transaction/external_request_segment.rb +18 -5
- data/lib/new_relic/agent/transaction/segment.rb +7 -1
- data/lib/new_relic/agent/transaction/trace.rb +3 -8
- data/lib/new_relic/agent/transaction/trace_builder.rb +0 -1
- data/lib/new_relic/agent/transaction/trace_context.rb +159 -0
- data/lib/new_relic/agent/transaction/trace_node.rb +8 -3
- data/lib/new_relic/agent/transaction_error_primitive.rb +4 -11
- data/lib/new_relic/agent/transaction_event_primitive.rb +3 -11
- data/lib/new_relic/agent/transaction_event_recorder.rb +3 -3
- data/lib/new_relic/agent/transaction_sampler.rb +1 -5
- data/lib/new_relic/cli/commands/deployments.rb +1 -1
- data/lib/new_relic/coerce.rb +29 -6
- data/lib/new_relic/control/instance_methods.rb +10 -1
- data/lib/new_relic/dependency_detection.rb +4 -4
- data/lib/new_relic/noticed_error.rb +8 -4
- data/lib/new_relic/rack/browser_monitoring.rb +10 -8
- data/lib/new_relic/version.rb +1 -1
- data/lib/tasks/config.rake +1 -2
- data/newrelic_rpm.gemspec +13 -4
- data/test/agent_helper.rb +95 -9
- data/true +0 -0
- metadata +58 -24
- data/lib/new_relic/agent/commands/xray_session.rb +0 -55
- data/lib/new_relic/agent/commands/xray_session_collection.rb +0 -161
- data/lib/new_relic/agent/configuration/event_data.rb +0 -39
- data/lib/new_relic/agent/transaction/attributes.rb +0 -154
- data/lib/new_relic/agent/transaction/xray_sample_buffer.rb +0 -64
- data/lib/tasks/versions.html.erb +0 -28
- data/lib/tasks/versions.postface.html +0 -8
- data/lib/tasks/versions.preface.html +0 -9
- data/lib/tasks/versions.rake +0 -65
- data/lib/tasks/versions.txt.erb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07ac800f099e868f4ac7fb9e86972f5533c48d87bd28cb54b1015b5dfe4af601
|
4
|
+
data.tar.gz: 0e1daf547dc945b5b57c8ff09f4866b26f907796ae654d9ebdf4c409cde8cfdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32b818ece7b0ac768d5ee8c8615633bc45ce6d7f3bc8e1a98ecc5632cc927c8dfa74266334f7fd6c55a468b6ff533deaed2773d90c1e32288598ea984f3e9aa0
|
7
|
+
data.tar.gz: a562491c09abeaaaf7de0fdb7b03e13706528144c004320b497bf214877831f221128bf92545ccac60bc02d4d696c2a6ecff5a3ca4091c3fba3bad8cba3ad287
|
data/.travis.yml
CHANGED
@@ -6,20 +6,23 @@ services:
|
|
6
6
|
|
7
7
|
language: ruby
|
8
8
|
|
9
|
+
dist: precise
|
9
10
|
sudo: required
|
11
|
+
jdk:
|
12
|
+
- oraclejdk8
|
10
13
|
|
11
14
|
before_install:
|
12
15
|
# RUBY-2072 Prevent Travis setup failure before our test even starts
|
13
16
|
- jdk_switcher use oraclejdk8
|
14
17
|
- sudo rm -f /etc/apt/sources.list.d/travis_ci_zeromq3.list
|
15
18
|
- gem --version
|
16
|
-
-
|
17
|
-
-
|
18
|
-
- gem install bundler -v=1.17.3
|
19
|
+
- "echo 'gem: --no-rdoc --no-ri --no-document' > ~/.gemrc"
|
20
|
+
- ./test/script/before_install/conditionally_upgrade_rubygems.sh
|
19
21
|
- ./test/script/before_install/gemstash_mirror.sh
|
22
|
+
- "echo GEMSTASH_MIRROR: $GEMSTASH_MIRROR"
|
20
23
|
- bundle --version
|
21
24
|
|
22
|
-
install: bundle install
|
25
|
+
install: bundle install --jobs 4
|
23
26
|
|
24
27
|
addons:
|
25
28
|
apt:
|
@@ -39,15 +42,12 @@ branches:
|
|
39
42
|
- master
|
40
43
|
- dev
|
41
44
|
- release
|
42
|
-
|
43
|
-
notifications:
|
44
|
-
webhooks: http://notifitron.herokuapp.com/
|
45
|
-
on_success: always
|
46
|
-
on_failure: always
|
45
|
+
- RUBY-2227_w3c_trace_context_poc
|
47
46
|
|
48
47
|
rvm:
|
49
48
|
# Run slowest builds first to try and optimize overall cycle time.
|
50
49
|
- jruby-9.2.6.0
|
50
|
+
- 2.7.0-preview1
|
51
51
|
- 2.6.1
|
52
52
|
- 2.5.3
|
53
53
|
- 2.4.2
|
@@ -56,11 +56,14 @@ rvm:
|
|
56
56
|
- 2.1.10
|
57
57
|
- 2.0.0-p648
|
58
58
|
|
59
|
+
jdk:
|
60
|
+
- oraclejdk8
|
61
|
+
|
59
62
|
env:
|
60
63
|
global:
|
61
64
|
- BUNDLE_PATH=/home/travis/bundle
|
62
65
|
- MONGODB=2.6.11
|
63
|
-
- JAVA_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1 -
|
66
|
+
- JAVA_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xmx1024m -XX:CICompilerCount=1 -Xshare:auto"
|
64
67
|
- JRUBY_OPTS="-Xcompile.invokedynamic=false -J-Djruby.compile.mode=OFF"
|
65
68
|
- RBXOPT="-Xcompiler.no_rbc -Xint"
|
66
69
|
- SERIALIZE=1
|
@@ -90,9 +93,46 @@ env:
|
|
90
93
|
- TYPE=NULLVERSE
|
91
94
|
|
92
95
|
matrix:
|
96
|
+
allow_failures:
|
97
|
+
- rvm: jruby-9.2.6.0
|
98
|
+
env: TYPE=FUNCTIONAL GROUP=agent
|
93
99
|
fast_finish: true
|
94
100
|
exclude:
|
95
101
|
# Unsupported Rails/Ruby combinations
|
102
|
+
# 2.7
|
103
|
+
- rvm: 2.7.0-preview1
|
104
|
+
env: TYPE=UNIT ENVIRONMENT=rails30
|
105
|
+
- rvm: 2.7.0-preview1
|
106
|
+
env: TYPE=UNIT ENVIRONMENT=rails31
|
107
|
+
- rvm: 2.7.0-preview1
|
108
|
+
env: TYPE=UNIT ENVIRONMENT=rails32
|
109
|
+
- rvm: 2.7.0-preview1
|
110
|
+
env: TYPE=UNIT ENVIRONMENT=rails40
|
111
|
+
- rvm: 2.7.0-preview1
|
112
|
+
env: TYPE=UNIT ENVIRONMENT=rails41
|
113
|
+
|
114
|
+
- rvm: 2.7.0-preview1
|
115
|
+
env: TYPE=UNIT ENVIRONMENT=rails42 # rails (= 4.2.11) depends on bundler (< 2.0, >= 1.3.0)
|
116
|
+
- rvm: 2.7.0-preview1
|
117
|
+
env: TYPE=UNIT ENVIRONMENT=rails50 # rails (= 5.0.0) depends on bundler (< 2.0, >= 1.3.0)
|
118
|
+
- rvm: 2.7.0-preview1
|
119
|
+
env: TYPE=UNIT ENVIRONMENT=rails51 # rails (= 5.1.0) depends on bundler (< 2.0, >= 1.3.0)
|
120
|
+
- rvm: 2.7.0-preview1
|
121
|
+
env: TYPE=FUNCTIONAL GROUP=api # blocked: https://github.com/solnic/coercible/issues/27
|
122
|
+
- rvm: 2.7.0-preview1
|
123
|
+
env: TYPE=FUNCTIONAL GROUP=sinatra # padrino (~> 0.14.0) depends on bundler (~> 1.0)
|
124
|
+
|
125
|
+
- rvm: 2.7.0-preview1
|
126
|
+
env: TYPE=UNIT ENVIRONMENT=rails42 # rails (= 4.2.11) depends on bundler (< 2.0, >= 1.3.0)
|
127
|
+
- rvm: 2.7.0-preview1
|
128
|
+
env: TYPE=UNIT ENVIRONMENT=rails50 # rails (= 5.0.0) depends on bundler (< 2.0, >= 1.3.0)
|
129
|
+
- rvm: 2.7.0-preview1
|
130
|
+
env: TYPE=UNIT ENVIRONMENT=rails51 # rails (= 5.1.0) depends on bundler (< 2.0, >= 1.3.0)
|
131
|
+
- rvm: 2.7.0-preview1
|
132
|
+
env: TYPE=FUNCTIONAL GROUP=api # blocked: https://github.com/solnic/coercible/issues/27
|
133
|
+
- rvm: 2.7.0-preview1
|
134
|
+
env: TYPE=FUNCTIONAL GROUP=sinatra # padrino (~> 0.14.0) depends on bundler (~> 1.0)
|
135
|
+
|
96
136
|
# 2.6
|
97
137
|
- rvm: 2.6.1
|
98
138
|
env: TYPE=UNIT ENVIRONMENT=rails30
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,203 @@
|
|
1
1
|
# New Relic Ruby Agent Release Notes #
|
2
2
|
|
3
|
+
## v6.8.0
|
4
|
+
|
5
|
+
* **Initial Ruby 2.7 support**
|
6
|
+
|
7
|
+
The Ruby agent has been verified to run with Ruby 2.7.0-preview1.
|
8
|
+
|
9
|
+
* **New API method to add custom attributes to Spans**
|
10
|
+
|
11
|
+
New API method for adding custom attributes to spans. Previously, custom
|
12
|
+
attributes were only available at the Transaction level. Now, with Span
|
13
|
+
level custom attributes, more granular tagging of events is possible for
|
14
|
+
easier isolation and review of trace events. For more information:
|
15
|
+
|
16
|
+
* [`Agent#add_custom_span_attributes`](https://www.rubydoc.info/github/newrelic/rpm/NewRelic/Agent#add_custom_span_attributes)
|
17
|
+
|
18
|
+
* **Enables ability to migrate to Configurable Security Policies (CSP) on a per agent
|
19
|
+
basis for accounts already using High Security Mode (HSM).**
|
20
|
+
|
21
|
+
When both [HSM](https://docs.newrelic.com/docs/agents/manage-apm-agents/configuration/high-security-mode) and [CSP](https://docs.newrelic.com/docs/agents/manage-apm-agents/configuration/enable-configurable-security-policies) are enabled for an account, an agent (this version or later)
|
22
|
+
can successfully connect with either `high_security: true` or the appropriate
|
23
|
+
`security_policies_token` configured. `high_security` has been added as part of
|
24
|
+
the preconnect payload.
|
25
|
+
|
26
|
+
* **Bugfix for Logs in Context combined with act-fluent-logger-rails**
|
27
|
+
|
28
|
+
Previously, when using the Ruby agent's Logs in Context logger
|
29
|
+
to link logging data with trace and entity metadata for an
|
30
|
+
improved experience in the UI, customers who were also using
|
31
|
+
the `act-fluent-logger-rails` gem would see a `NoMethodError`
|
32
|
+
for `clear_tags!` that would interfere with the use of this
|
33
|
+
feature. This error no longer appears, allowing customers to
|
34
|
+
combine the use of Logs in Context with the use of this gem.
|
35
|
+
|
36
|
+
Please note that the Logs in Context logger does not support
|
37
|
+
tagged logging; if you are initializing your logger with a
|
38
|
+
`log_tags` argument, your custom tags may not appear on the
|
39
|
+
final version of your logs.
|
40
|
+
|
41
|
+
* **Bugfix for parsing invalid newrelic.yml**
|
42
|
+
|
43
|
+
Previously, if the newrelic.yml configuration file was invalid, and the agent
|
44
|
+
could not start as a result, the agent would not log any indication of
|
45
|
+
the problem.
|
46
|
+
|
47
|
+
This version of the agent will emit a FATAL message to STDOUT when this scenario
|
48
|
+
occurs so that customers can address issues with newrelic.yml that prevent startup.
|
49
|
+
|
50
|
+
* **Configuration options containing the terms "whitelist" and "blacklist" deprecated**
|
51
|
+
|
52
|
+
The following local configuration settings have been deprecated:
|
53
|
+
|
54
|
+
* `autostart.blacklisted_constants`: use `autostart.denylisted_constants` instead.
|
55
|
+
* `autostart.blacklisted_executables`: use `autostart.denylisted_executables` instead.
|
56
|
+
* `autostart.blacklisted_rake_tasks`: use `autostart.denylisted_rake_tasks` instead.
|
57
|
+
* `strip_exception_messages.whitelist`: use `strip_exception_messages.allowed_classes` instead.
|
58
|
+
|
59
|
+
* **Bugfix for module loading and constant resolution in Rails**
|
60
|
+
|
61
|
+
Starting in version 6.3, the Ruby agent has caused module loading and constant
|
62
|
+
resolution to sometimes fail, which caused errors in some Rails applications.
|
63
|
+
These errors were generally `NoMethodError` exceptions or I18n errors
|
64
|
+
`translation missing` or `invalid locale`. These errors would not appear if the agent
|
65
|
+
was removed from the application's Gemfile.
|
66
|
+
This version of the agent fixes these issues with module loading and constant
|
67
|
+
resolution, so these errors no longer occur.
|
68
|
+
|
69
|
+
* **Bugfix: failed to get urandom**
|
70
|
+
|
71
|
+
Previous versions of the agent would fail unexpectedly when the Ruby process used
|
72
|
+
every available file descriptor. The failures would include this message:
|
73
|
+
```
|
74
|
+
ERROR : RuntimeError: failed to get urandom
|
75
|
+
```
|
76
|
+
This version of the agent uses a different strategy for generating random IDs, and
|
77
|
+
will not fail in the same way when no file descriptors are available.
|
78
|
+
|
79
|
+
## v6.7.0
|
80
|
+
|
81
|
+
* **Trace and Entity Metadata API**
|
82
|
+
|
83
|
+
Several new API methods have been added to the agent:
|
84
|
+
* [`Agent#linking_metadata`](https://www.rubydoc.info/github/newrelic/rpm/NewRelic/Agent#linking_metadata-instance_method)
|
85
|
+
* [`Tracer#trace_id`](https://www.rubydoc.info/github/newrelic/rpm/NewRelic/Agent/Tracer#trace_id-class_method)
|
86
|
+
* [`Tracer#span_id`](https://www.rubydoc.info/github/newrelic/rpm/NewRelic/Agent/Tracer#span_id-class_method)
|
87
|
+
* [`Tracer#sampled?`](https://www.rubydoc.info/github/newrelic/rpm/NewRelic/Agent/Tracer#sampled?-class_method)
|
88
|
+
|
89
|
+
These API methods allow you to access information that can be used to link data of your choosing to a trace or entity.
|
90
|
+
|
91
|
+
* **Logs in Context**
|
92
|
+
|
93
|
+
This version of the agent includes a logger, which can be used in place of `::Logger`
|
94
|
+
from the standard library, or `ActiveSupport::Logger` from Rails. This logger
|
95
|
+
leverages the new trace and entity metadata API to decorate log statements with entity
|
96
|
+
and trace metadata, so they can be correlated together in the New Relic UI.
|
97
|
+
|
98
|
+
For more information on how to use logs in context, see https://docs.newrelic.com/docs/enable-logs-context-ruby
|
99
|
+
|
100
|
+
* **Project metadata in Gemspec**
|
101
|
+
|
102
|
+
Project metadata has been added to the gemspec file. This means our Rubygems page will allow users to more easily
|
103
|
+
access the agent's source code, raise issues, and read the changelog.
|
104
|
+
|
105
|
+
Thanks to Orien Madgwick for the contribution!
|
106
|
+
|
107
|
+
## v6.6.0
|
108
|
+
|
109
|
+
* **Bugfix for ActionCable Instrumentation**
|
110
|
+
|
111
|
+
Previous versions of the agent sometimes caused application crashes with some versions
|
112
|
+
of ActionCable. The application would exit quickly after startup with the error:
|
113
|
+
`uninitialized constant ActionCable::Engine`.
|
114
|
+
|
115
|
+
Version 6.6.0 of the agent no longer crashes in this way.
|
116
|
+
|
117
|
+
|
118
|
+
* **Handling of disabling Error Collection**
|
119
|
+
|
120
|
+
When the agent first starts, it begins collecting Error Events and Traces before
|
121
|
+
fetching configuration from New Relic. In previous versions of the agent, those
|
122
|
+
events or traces would be sent to New Relic, even if _Error Collection_ is disabled in
|
123
|
+
the application's server-side configuration.
|
124
|
+
|
125
|
+
Version 6.6.0 of the agent drops all collected Error Events and Traces if the
|
126
|
+
configuration from the server disables _Error Collection_.
|
127
|
+
|
128
|
+
## v6.5.0
|
129
|
+
|
130
|
+
* **Change to default setting for ActiveRecord connection resolution**
|
131
|
+
|
132
|
+
Due to incompatibilities between the faster ActiveRecord connection resolution
|
133
|
+
released in v6.3.0 of the agent and other gems which patch ActiveRecord,
|
134
|
+
`backport_fast_active_record_connection_lookup` will now be set to `false` by default.
|
135
|
+
Because it results in a significant performance improvement, we recommend customers
|
136
|
+
whose environments include ActiveRecord change this setting to `true`
|
137
|
+
_unless_ they are using other gems which measure ActiveRecord performance, which may
|
138
|
+
lose functionality when combined with this setting. If unsure whether to enable
|
139
|
+
`backport_fast_active_record_connection_lookup`, we recommend enabling it in a
|
140
|
+
development environment to make sure other gems which patch ActiveRecord are still
|
141
|
+
working as expected.
|
142
|
+
|
143
|
+
* **Bugfix for ActiveStorage instrumentation error**
|
144
|
+
|
145
|
+
Version 6.4.0 of the agent introduced a bug that interfered with ActiveStorage
|
146
|
+
callbacks, resulting in the agent being unable to instrument ActiveStorage operations.
|
147
|
+
ActiveStorage segments are now correctly recorded.
|
148
|
+
|
149
|
+
* **Bugfix for ActiveRecord 4.1 and 4.2 exception logging**
|
150
|
+
|
151
|
+
Version 6.3.0 of the agent introduced a bug that prevented ActiveRecord versions 4.1
|
152
|
+
and 4.2 from logging exceptions that occurred within a database transaction. This
|
153
|
+
version of the agent restores the exception logging functionality from previous agent
|
154
|
+
versions.
|
155
|
+
Thanks to Oleksiy Kovyrin for the contribution!
|
156
|
+
|
157
|
+
## v6.4.0
|
158
|
+
|
159
|
+
* **Custom Metadata Collection**
|
160
|
+
|
161
|
+
The agent now collects environment variables prefixed by `NEW_RELIC_METADATA_`. These
|
162
|
+
may be added to transaction events to provide context between your Kubernetes cluster
|
163
|
+
and your services. For details on the behavior, see
|
164
|
+
[this blog post](https://blog.newrelic.com/engineering/monitoring-application-performance-in-kubernetes/).
|
165
|
+
|
166
|
+
* **Bugfix for faster ActiveRecord connection resolution**
|
167
|
+
|
168
|
+
Version 6.3.0 of the agent backported the faster ActiveRecord connection resolution
|
169
|
+
from Rails 6.0 to previous versions, but the implementation caused certain other gems
|
170
|
+
which measured ActiveRecord performance to stop working. This version of the agent
|
171
|
+
changes the implementation of this performance improvement so no such conflicts occur.
|
172
|
+
|
173
|
+
* **Bugfix for Grape instrumentation error**
|
174
|
+
|
175
|
+
Previous versions of the agent would fail to install Grape instrumentation in Grape
|
176
|
+
versions 1.2.0 and up if the API being instrumented subclassed `Grape::API::Instance`
|
177
|
+
rather than `Grape::API`. A warning would also print to the newrelic_agent log:
|
178
|
+
```
|
179
|
+
WARN : Error in Grape instrumentation
|
180
|
+
WARN : NoMethodError: undefined method `name' for nil:NilClass
|
181
|
+
```
|
182
|
+
|
183
|
+
This version of the agent successfully installs instrumentation for subclasses
|
184
|
+
of `Grape::API::Instance`, and these log messages should no longer appear.
|
185
|
+
|
186
|
+
* **Bugfix for streaming responses**
|
187
|
+
|
188
|
+
Previous versions of the agent would attempt to insert JavaScript instrumentation into
|
189
|
+
any streaming response that did not make use of `ActionController::Live`. This resulted
|
190
|
+
in an empty, non-streamed response being sent to the client.
|
191
|
+
|
192
|
+
This version of the agent will not attempt to insert JavaScript instrumentation into
|
193
|
+
a response which includes the header `Transfer-Encoding=chunked`, which indicates a
|
194
|
+
streaming response.
|
195
|
+
|
196
|
+
This should exclude JavaScript instrumentation for all streamed responses. To include
|
197
|
+
this instrumentation manually, see
|
198
|
+
[Manually instrument via agent API](https://docs.newrelic.com/docs/agents/ruby-agent/features/new-relic-browser-ruby-agent#manual_instrumentation)
|
199
|
+
in our documentation.
|
200
|
+
|
3
201
|
## v6.3.0
|
4
202
|
|
5
203
|
* **Official Rails 6.0 support**
|
data/Guardfile
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
|
1
|
+
guard_options = {
|
2
|
+
spring: "bundle exec ruby",
|
3
|
+
test_folders: ['test/new_relic', 'test'],
|
4
|
+
all_after_pass: false
|
5
|
+
}
|
6
|
+
|
7
|
+
guard :minitest, guard_options do
|
2
8
|
watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
|
3
9
|
watch(%r{^test/.+_test\.rb$})
|
4
10
|
watch(%r{^test/rum/.*}) { "test/new_relic/rack/browser_monitoring_test.rb" }
|
data/lib/new_relic/agent.rb
CHANGED
@@ -55,6 +55,7 @@ module NewRelic
|
|
55
55
|
require 'new_relic/agent/system_info'
|
56
56
|
require 'new_relic/agent/external'
|
57
57
|
require 'new_relic/agent/deprecator'
|
58
|
+
require 'new_relic/agent/logging'
|
58
59
|
|
59
60
|
require 'new_relic/agent/instrumentation/controller_instrumentation'
|
60
61
|
|
@@ -567,6 +568,12 @@ module NewRelic
|
|
567
568
|
# these custom attributes will also be present in the script injected into
|
568
569
|
# the response body, making them available on Insights PageView events.
|
569
570
|
#
|
571
|
+
#
|
572
|
+
# @param [Hash] params A Hash of attributes to be attached to the transaction event.
|
573
|
+
# Keys should be strings or symbols, and values
|
574
|
+
# may be strings, symbols, numeric values or
|
575
|
+
# booleans.
|
576
|
+
#
|
570
577
|
# @api public
|
571
578
|
#
|
572
579
|
def add_custom_attributes(params) #THREAD_LOCAL_ACCESS
|
@@ -580,6 +587,31 @@ module NewRelic
|
|
580
587
|
end
|
581
588
|
end
|
582
589
|
|
590
|
+
# Add custom attributes to the span event for the current span. Attributes will be visible on spans in the
|
591
|
+
# New Relic Distributed Tracing UI and on span events in New Relic Insights.
|
592
|
+
#
|
593
|
+
# Custom attributes will not be transmitted when +high_security+ setting is enabled or
|
594
|
+
# +custom_attributes+ setting is disabled.
|
595
|
+
#
|
596
|
+
# @param [Hash] params A Hash of attributes to be attached to the span event.
|
597
|
+
# Keys should be strings or symbols, and values
|
598
|
+
# may be strings, symbols, numeric values or
|
599
|
+
# booleans.
|
600
|
+
#
|
601
|
+
# @see https://docs.newrelic.com/docs/using-new-relic/welcome-new-relic/get-started/glossary#span
|
602
|
+
# @api public
|
603
|
+
def add_custom_span_attributes params
|
604
|
+
record_api_supportability_metric :add_custom_span_attributes
|
605
|
+
|
606
|
+
if params.is_a? Hash
|
607
|
+
if segment = NewRelic::Agent::Tracer.current_segment
|
608
|
+
segment.add_custom_attributes params
|
609
|
+
end
|
610
|
+
else
|
611
|
+
::NewRelic::Agent.logger.warn "Bad argument passed to #add_custom_span_attributes. Expected Hash but got #{params.class}"
|
612
|
+
end
|
613
|
+
end
|
614
|
+
|
583
615
|
# @!endgroup
|
584
616
|
|
585
617
|
# @!group Transaction naming
|
@@ -660,6 +692,54 @@ module NewRelic
|
|
660
692
|
NewRelic::Agent.logger.debug "Ignoring exception during %p event notification" % [event_type]
|
661
693
|
end
|
662
694
|
|
695
|
+
# @!group Trace and Entity metadata
|
696
|
+
|
697
|
+
TRACE_ID_KEY = 'trace.id'.freeze
|
698
|
+
SPAN_ID_KEY = 'span.id'.freeze
|
699
|
+
ENTITY_NAME_KEY = 'entity.name'.freeze
|
700
|
+
ENTITY_TYPE_KEY = 'entity.type'.freeze
|
701
|
+
ENTITY_GUID_KEY = 'entity.guid'.freeze
|
702
|
+
HOSTNAME_KEY = 'hostname'.freeze
|
703
|
+
|
704
|
+
ENTITY_TYPE = 'SERVICE'.freeze
|
705
|
+
|
706
|
+
# Returns a new hash containing trace and entity metadata that can be used
|
707
|
+
# to relate data to a trace or to an entity in APM.
|
708
|
+
#
|
709
|
+
# This hash includes:
|
710
|
+
# * trace.id - The current trace id, if there is a current trace id. This
|
711
|
+
# value may be omitted.
|
712
|
+
# * span.id - The current span id, if there is a current span. This
|
713
|
+
# value may be omitted.
|
714
|
+
# * entity.name - The name of the current application. This is read from
|
715
|
+
# the +app_name+ key in your config. If there are multiple application
|
716
|
+
# names, the first one is used.
|
717
|
+
# * entity.type - The entity type is hardcoded to the string +'SERVICE'+.
|
718
|
+
# * entity.guid - The guid of the current entity.
|
719
|
+
# * hostname - The fully qualified hostname.
|
720
|
+
#
|
721
|
+
# @api public
|
722
|
+
def linking_metadata
|
723
|
+
metadata = Hash.new
|
724
|
+
metadata[ENTITY_NAME_KEY] = config[:app_name][0]
|
725
|
+
metadata[ENTITY_TYPE_KEY] = ENTITY_TYPE
|
726
|
+
metadata[HOSTNAME_KEY] = Hostname.get
|
727
|
+
|
728
|
+
if entity_guid = config[:entity_guid]
|
729
|
+
metadata[ENTITY_GUID_KEY] = entity_guid
|
730
|
+
end
|
731
|
+
|
732
|
+
if trace_id = Tracer.current_trace_id
|
733
|
+
metadata[TRACE_ID_KEY] = trace_id
|
734
|
+
end
|
735
|
+
if span_id = Tracer.current_span_id
|
736
|
+
metadata[SPAN_ID_KEY] = span_id
|
737
|
+
end
|
738
|
+
metadata
|
739
|
+
end
|
740
|
+
|
741
|
+
#@!endgroup
|
742
|
+
|
663
743
|
# @!group Manual browser monitoring configuration
|
664
744
|
|
665
745
|
# This method returns a string suitable for inclusion in a page - known as
|