newrelic_rpm 6.4.0.356 → 6.9.0.363
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 -5
- data/CHANGELOG.md +218 -0
- data/Guardfile +16 -1
- data/lib/new_relic/agent.rb +86 -5
- data/lib/new_relic/agent/agent.rb +124 -56
- 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 +150 -0
- data/lib/new_relic/agent/autostart.rb +19 -14
- data/lib/new_relic/agent/configuration/default_source.rb +133 -14
- data/lib/new_relic/agent/configuration/event_harvest_config.rb +45 -0
- data/lib/new_relic/agent/configuration/manager.rb +13 -9
- data/lib/new_relic/agent/configuration/server_source.rb +34 -10
- data/lib/new_relic/agent/configuration/yaml_source.rb +11 -6
- data/lib/new_relic/agent/connect/request_builder.rb +8 -15
- data/lib/new_relic/agent/connect/response_handler.rb +1 -1
- data/lib/new_relic/agent/database.rb +1 -2
- 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_tracing.rb +155 -6
- data/lib/new_relic/agent/{cross_app_payload.rb → distributed_tracing/cross_app_payload.rb} +0 -0
- data/lib/new_relic/agent/{cross_app_tracing.rb → distributed_tracing/cross_app_tracing.rb} +60 -45
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_intrinsics.rb +80 -0
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_metrics.rb +75 -0
- data/lib/new_relic/agent/{distributed_trace_payload.rb → distributed_tracing/distributed_trace_payload.rb} +23 -99
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +39 -0
- data/lib/new_relic/agent/distributed_tracing/trace_context.rb +246 -0
- data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +126 -0
- data/lib/new_relic/agent/error_collector.rb +5 -7
- data/lib/new_relic/agent/error_event_aggregator.rb +5 -2
- 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/external.rb +7 -7
- data/lib/new_relic/agent/guid_generator.rb +28 -0
- data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +1 -2
- data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +24 -38
- data/lib/new_relic/agent/instrumentation/active_storage_subscriber.rb +2 -2
- data/lib/new_relic/agent/instrumentation/bunny.rb +1 -1
- data/lib/new_relic/agent/instrumentation/curb.rb +1 -1
- data/lib/new_relic/agent/instrumentation/excon.rb +1 -1
- data/lib/new_relic/agent/instrumentation/grape.rb +5 -10
- data/lib/new_relic/agent/instrumentation/http.rb +1 -1
- data/lib/new_relic/agent/instrumentation/httpclient.rb +1 -1
- data/lib/new_relic/agent/instrumentation/net.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +2 -3
- data/lib/new_relic/agent/instrumentation/resque.rb +3 -0
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +1 -1
- data/lib/new_relic/agent/javascript_instrumentor.rb +1 -1
- data/lib/new_relic/agent/logging.rb +139 -0
- data/lib/new_relic/agent/messaging.rb +5 -73
- data/lib/new_relic/agent/method_tracer.rb +3 -2
- data/lib/new_relic/agent/method_tracer_helpers.rb +1 -1
- data/lib/new_relic/agent/monitors.rb +27 -0
- data/lib/new_relic/agent/monitors/cross_app_monitor.rb +110 -0
- data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +27 -0
- data/lib/new_relic/agent/{inbound_request_monitor.rb → monitors/inbound_request_monitor.rb} +3 -3
- data/lib/new_relic/agent/{synthetics_monitor.rb → monitors/synthetics_monitor.rb} +2 -4
- data/lib/new_relic/agent/new_relic_service.rb +7 -5
- 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 +43 -25
- data/lib/new_relic/agent/sql_sampler.rb +3 -3
- data/lib/new_relic/agent/supported_versions.rb +2 -2
- data/lib/new_relic/agent/tracer.rb +35 -3
- data/lib/new_relic/agent/transaction.rb +37 -36
- data/lib/new_relic/agent/transaction/abstract_segment.rb +2 -2
- data/lib/new_relic/agent/transaction/distributed_tracer.rb +171 -0
- data/lib/new_relic/agent/transaction/distributed_tracing.rb +57 -146
- data/lib/new_relic/agent/transaction/external_request_segment.rb +8 -31
- data/lib/new_relic/agent/transaction/message_broker_segment.rb +3 -11
- data/lib/new_relic/agent/transaction/segment.rb +7 -1
- data/lib/new_relic/agent/transaction/trace.rb +2 -4
- data/lib/new_relic/agent/transaction/trace_context.rb +168 -0
- data/lib/new_relic/agent/transaction/trace_node.rb +10 -8
- data/lib/new_relic/agent/transaction_error_primitive.rb +5 -12
- data/lib/new_relic/agent/transaction_event_primitive.rb +28 -39
- data/lib/new_relic/agent/transaction_event_recorder.rb +3 -3
- data/lib/new_relic/cli/commands/deployments.rb +1 -1
- data/lib/new_relic/coerce.rb +31 -6
- data/lib/new_relic/constants.rb +34 -0
- 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 +10 -8
- data/lib/new_relic/rack/browser_monitoring.rb +4 -0
- data/lib/new_relic/supportability_helper.rb +14 -0
- data/lib/new_relic/version.rb +1 -1
- data/lib/tasks/tests.rake +6 -1
- data/newrelic_rpm.gemspec +16 -5
- data/test/agent_helper.rb +115 -9
- data/true +0 -0
- metadata +97 -30
- data/lib/new_relic/agent/configuration/event_data.rb +0 -39
- data/lib/new_relic/agent/cross_app_monitor.rb +0 -110
- data/lib/new_relic/agent/distributed_trace_monitor.rb +0 -40
- data/lib/new_relic/agent/transaction/attributes.rb +0 -154
- 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: 3eb269d5c36e6139c7b617d3083418a8c8acf85e94c4f1005b1241aafc9471dd
|
4
|
+
data.tar.gz: da6387b811e5402cd2a0da7b80acc5b88338768cf36e01b1c86d7576c2592f3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 077d136a9c8e3771f506ee67422983ae4782e23b9118e9cb070f35fdf3af7b8a9d9ed125725db34945d8195529c0c22bbde0a7ab313d1fae9488485e40f7398d
|
7
|
+
data.tar.gz: c577d7a04fac1e22f043156635d4d2eeb3674707a2f50f7b11756855f4b4ae7e3479a6783d45decdc1a4950ce2b69e8d1d691bad6ebe67b504b098838fa6c86f
|
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,10 +42,12 @@ branches:
|
|
39
42
|
- master
|
40
43
|
- dev
|
41
44
|
- release
|
45
|
+
- RUBY-2227_w3c_trace_context_poc
|
42
46
|
|
43
47
|
rvm:
|
44
48
|
# Run slowest builds first to try and optimize overall cycle time.
|
45
49
|
- jruby-9.2.6.0
|
50
|
+
- 2.7.0
|
46
51
|
- 2.6.1
|
47
52
|
- 2.5.3
|
48
53
|
- 2.4.2
|
@@ -51,11 +56,14 @@ rvm:
|
|
51
56
|
- 2.1.10
|
52
57
|
- 2.0.0-p648
|
53
58
|
|
59
|
+
jdk:
|
60
|
+
- oraclejdk8
|
61
|
+
|
54
62
|
env:
|
55
63
|
global:
|
56
64
|
- BUNDLE_PATH=/home/travis/bundle
|
57
65
|
- MONGODB=2.6.11
|
58
|
-
- JAVA_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1 -
|
66
|
+
- JAVA_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xmx1024m -XX:CICompilerCount=1 -Xshare:auto"
|
59
67
|
- JRUBY_OPTS="-Xcompile.invokedynamic=false -J-Djruby.compile.mode=OFF"
|
60
68
|
- RBXOPT="-Xcompiler.no_rbc -Xint"
|
61
69
|
- SERIALIZE=1
|
@@ -85,9 +93,46 @@ env:
|
|
85
93
|
- TYPE=NULLVERSE
|
86
94
|
|
87
95
|
matrix:
|
96
|
+
allow_failures:
|
97
|
+
- rvm: jruby-9.2.6.0
|
98
|
+
env: TYPE=FUNCTIONAL GROUP=agent
|
88
99
|
fast_finish: true
|
89
100
|
exclude:
|
90
101
|
# Unsupported Rails/Ruby combinations
|
102
|
+
# 2.7
|
103
|
+
- rvm: 2.7.0
|
104
|
+
env: TYPE=UNIT ENVIRONMENT=rails30
|
105
|
+
- rvm: 2.7.0
|
106
|
+
env: TYPE=UNIT ENVIRONMENT=rails31
|
107
|
+
- rvm: 2.7.0
|
108
|
+
env: TYPE=UNIT ENVIRONMENT=rails32
|
109
|
+
- rvm: 2.7.0
|
110
|
+
env: TYPE=UNIT ENVIRONMENT=rails40
|
111
|
+
- rvm: 2.7.0
|
112
|
+
env: TYPE=UNIT ENVIRONMENT=rails41
|
113
|
+
|
114
|
+
- rvm: 2.7.0
|
115
|
+
env: TYPE=UNIT ENVIRONMENT=rails42 # rails (= 4.2.11) depends on bundler (< 2.0, >= 1.3.0)
|
116
|
+
- rvm: 2.7.0
|
117
|
+
env: TYPE=UNIT ENVIRONMENT=rails50 # rails (= 5.0.0) depends on bundler (< 2.0, >= 1.3.0)
|
118
|
+
- rvm: 2.7.0
|
119
|
+
env: TYPE=UNIT ENVIRONMENT=rails51 # rails (= 5.1.0) depends on bundler (< 2.0, >= 1.3.0)
|
120
|
+
- rvm: 2.7.0
|
121
|
+
env: TYPE=FUNCTIONAL GROUP=api # blocked: https://github.com/solnic/coercible/issues/27
|
122
|
+
- rvm: 2.7.0
|
123
|
+
env: TYPE=FUNCTIONAL GROUP=sinatra # padrino (~> 0.14.0) depends on bundler (~> 1.0)
|
124
|
+
|
125
|
+
- rvm: 2.7.0
|
126
|
+
env: TYPE=UNIT ENVIRONMENT=rails42 # rails (= 4.2.11) depends on bundler (< 2.0, >= 1.3.0)
|
127
|
+
- rvm: 2.7.0
|
128
|
+
env: TYPE=UNIT ENVIRONMENT=rails50 # rails (= 5.0.0) depends on bundler (< 2.0, >= 1.3.0)
|
129
|
+
- rvm: 2.7.0
|
130
|
+
env: TYPE=UNIT ENVIRONMENT=rails51 # rails (= 5.1.0) depends on bundler (< 2.0, >= 1.3.0)
|
131
|
+
- rvm: 2.7.0
|
132
|
+
env: TYPE=FUNCTIONAL GROUP=api # blocked: https://github.com/solnic/coercible/issues/27
|
133
|
+
- rvm: 2.7.0
|
134
|
+
env: TYPE=FUNCTIONAL GROUP=sinatra # padrino (~> 0.14.0) depends on bundler (~> 1.0)
|
135
|
+
|
91
136
|
# 2.6
|
92
137
|
- rvm: 2.6.1
|
93
138
|
env: TYPE=UNIT ENVIRONMENT=rails30
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,223 @@
|
|
1
1
|
# New Relic Ruby Agent Release Notes #
|
2
2
|
|
3
|
+
## v6.9.0
|
4
|
+
|
5
|
+
* **Added support for W3C Trace Context, with easy upgrade from New Relic trace context**
|
6
|
+
|
7
|
+
* [Distributed Tracing now supports W3C Trace Context headers](https://docs.newrelic.com/docs/understand-dependencies/distributed-tracing/get-started/introduction-distributed-tracing#w3c-support) for HTTP protocols when distributed tracing is enabled. Our implementation can accept and emit both
|
8
|
+
the W3C trace header format and the New Relic trace header format. This simplifies
|
9
|
+
agent upgrades, allowing trace context to be propagated between services with older
|
10
|
+
and newer releases of New Relic agents. W3C trace header format will always be
|
11
|
+
accepted and emitted. New Relic trace header format will be accepted, and you can
|
12
|
+
optionally disable emission of the New Relic trace header format.
|
13
|
+
|
14
|
+
* When distributed tracing is enabled by setting `distributed_tracing.enabled` to `true`,
|
15
|
+
the Ruby agent will now accept W3C's `traceparent` and `tracestate` headers when
|
16
|
+
calling `DistributedTracing.accept_distributed_trace_headers` or automatically via
|
17
|
+
`http` instrumentation. When calling `DistributedTracing.insert_distributed_trace_headers`,
|
18
|
+
or automatically via `http` instrumentation, the Ruby agent will include the W3C
|
19
|
+
headers along with the New Relic distributed tracing header, unless the New Relic
|
20
|
+
trace header format is disabled by setting `exclude_newrelic_header` setting to `true`.
|
21
|
+
|
22
|
+
* Added `DistributedTracing.accept_distributed_trace_headers` API for accepting both
|
23
|
+
New Relic and W3C TraceContext distributed traces.
|
24
|
+
|
25
|
+
* Deprecated `DistributedTracing.accept_distributed_trace_payload` which will be removed
|
26
|
+
in a future major release.
|
27
|
+
|
28
|
+
* Added `DistributedTracing.insert_distributed_trace_headers` API for adding outbound
|
29
|
+
distributed trace headers. Both W3C TraceContext and New Relic formats will be
|
30
|
+
included unless `distributed_tracing.exclude_newrelic_header: true`.
|
31
|
+
|
32
|
+
* Deprecated `DistributedTracing.create_distributed_trace_payload` which will be removed
|
33
|
+
in a future major release.
|
34
|
+
|
35
|
+
Known Issues and Workarounds
|
36
|
+
|
37
|
+
* If a .NET agent is initiating traces as the root service, do not upgrade your
|
38
|
+
downstream Ruby New Relic agents to this agent release.
|
39
|
+
|
40
|
+
* **Official Ruby 2.7 support**
|
41
|
+
|
42
|
+
The Ruby agent has been verified to run with Ruby 2.7.0.
|
43
|
+
|
44
|
+
* **Reduced allocations when tracing transactions using API calls**
|
45
|
+
|
46
|
+
Default empty hashes for `options` parameter were not frozen, leading to
|
47
|
+
excessive and unnecessary allocations when calling APIs for tracing transactions.
|
48
|
+
|
49
|
+
Thanks to Joel Turkel (jturkel) for the contribution!
|
50
|
+
|
51
|
+
* **Bugfix for Resque worker thread race conditions**
|
52
|
+
|
53
|
+
Recent changes in Rack surfaced issues marshalling data for resque, surfaced a potential race-condition with closing out the worker-threads before flushing the data pipe. This
|
54
|
+
is now fixed.
|
55
|
+
|
56
|
+
Thanks to Bertrand Paquet (bpaquet) for the contribution!
|
57
|
+
|
58
|
+
* **Bugfix for Content-Length when injecting Browser Monitoring JS**
|
59
|
+
|
60
|
+
The Content-Length HTTP header would be incorrect after injecting the Browser Monitoring
|
61
|
+
JS into the HEAD tag of the HTML source with Content-Length and lead to the HTML BODY content
|
62
|
+
being truncated in some cases. The Content-Length is now correctly updated after injecting the
|
63
|
+
Browser Monitoring JS script.
|
64
|
+
|
65
|
+
Thanks to Slava Kardakov (ojab) for the contribution!
|
66
|
+
|
67
|
+
## v6.8.0
|
68
|
+
|
69
|
+
* **Initial Ruby 2.7 support**
|
70
|
+
|
71
|
+
The Ruby agent has been verified to run with Ruby 2.7.0-preview1.
|
72
|
+
|
73
|
+
* **New API method to add custom attributes to Spans**
|
74
|
+
|
75
|
+
New API method for adding custom attributes to spans. Previously, custom
|
76
|
+
attributes were only available at the Transaction level. Now, with Span
|
77
|
+
level custom attributes, more granular tagging of events is possible for
|
78
|
+
easier isolation and review of trace events. For more information:
|
79
|
+
|
80
|
+
* [`Agent#add_custom_span_attributes`](https://www.rubydoc.info/github/newrelic/rpm/NewRelic/Agent#add_custom_span_attributes)
|
81
|
+
|
82
|
+
* **Enables ability to migrate to Configurable Security Policies (CSP) on a per agent
|
83
|
+
basis for accounts already using High Security Mode (HSM).**
|
84
|
+
|
85
|
+
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)
|
86
|
+
can successfully connect with either `high_security: true` or the appropriate
|
87
|
+
`security_policies_token` configured. `high_security` has been added as part of
|
88
|
+
the preconnect payload.
|
89
|
+
|
90
|
+
* **Bugfix for Logs in Context combined with act-fluent-logger-rails**
|
91
|
+
|
92
|
+
Previously, when using the Ruby agent's Logs in Context logger
|
93
|
+
to link logging data with trace and entity metadata for an
|
94
|
+
improved experience in the UI, customers who were also using
|
95
|
+
the `act-fluent-logger-rails` gem would see a `NoMethodError`
|
96
|
+
for `clear_tags!` that would interfere with the use of this
|
97
|
+
feature. This error no longer appears, allowing customers to
|
98
|
+
combine the use of Logs in Context with the use of this gem.
|
99
|
+
|
100
|
+
Please note that the Logs in Context logger does not support
|
101
|
+
tagged logging; if you are initializing your logger with a
|
102
|
+
`log_tags` argument, your custom tags may not appear on the
|
103
|
+
final version of your logs.
|
104
|
+
|
105
|
+
* **Bugfix for parsing invalid newrelic.yml**
|
106
|
+
|
107
|
+
Previously, if the newrelic.yml configuration file was invalid, and the agent
|
108
|
+
could not start as a result, the agent would not log any indication of
|
109
|
+
the problem.
|
110
|
+
|
111
|
+
This version of the agent will emit a FATAL message to STDOUT when this scenario
|
112
|
+
occurs so that customers can address issues with newrelic.yml that prevent startup.
|
113
|
+
|
114
|
+
* **Configuration options containing the terms "whitelist" and "blacklist" deprecated**
|
115
|
+
|
116
|
+
The following local configuration settings have been deprecated:
|
117
|
+
|
118
|
+
* `autostart.blacklisted_constants`: use `autostart.denylisted_constants` instead.
|
119
|
+
* `autostart.blacklisted_executables`: use `autostart.denylisted_executables` instead.
|
120
|
+
* `autostart.blacklisted_rake_tasks`: use `autostart.denylisted_rake_tasks` instead.
|
121
|
+
* `strip_exception_messages.whitelist`: use `strip_exception_messages.allowed_classes` instead.
|
122
|
+
|
123
|
+
* **Bugfix for module loading and constant resolution in Rails**
|
124
|
+
|
125
|
+
Starting in version 6.3, the Ruby agent has caused module loading and constant
|
126
|
+
resolution to sometimes fail, which caused errors in some Rails applications.
|
127
|
+
These errors were generally `NoMethodError` exceptions or I18n errors
|
128
|
+
`translation missing` or `invalid locale`. These errors would not appear if the agent
|
129
|
+
was removed from the application's Gemfile.
|
130
|
+
This version of the agent fixes these issues with module loading and constant
|
131
|
+
resolution, so these errors no longer occur.
|
132
|
+
|
133
|
+
* **Bugfix: failed to get urandom**
|
134
|
+
|
135
|
+
Previous versions of the agent would fail unexpectedly when the Ruby process used
|
136
|
+
every available file descriptor. The failures would include this message:
|
137
|
+
```
|
138
|
+
ERROR : RuntimeError: failed to get urandom
|
139
|
+
```
|
140
|
+
This version of the agent uses a different strategy for generating random IDs, and
|
141
|
+
will not fail in the same way when no file descriptors are available.
|
142
|
+
|
143
|
+
## v6.7.0
|
144
|
+
|
145
|
+
* **Trace and Entity Metadata API**
|
146
|
+
|
147
|
+
Several new API methods have been added to the agent:
|
148
|
+
* [`Agent#linking_metadata`](https://www.rubydoc.info/github/newrelic/rpm/NewRelic/Agent#linking_metadata-instance_method)
|
149
|
+
* [`Tracer#trace_id`](https://www.rubydoc.info/github/newrelic/rpm/NewRelic/Agent/Tracer#trace_id-class_method)
|
150
|
+
* [`Tracer#span_id`](https://www.rubydoc.info/github/newrelic/rpm/NewRelic/Agent/Tracer#span_id-class_method)
|
151
|
+
* [`Tracer#sampled?`](https://www.rubydoc.info/github/newrelic/rpm/NewRelic/Agent/Tracer#sampled?-class_method)
|
152
|
+
|
153
|
+
These API methods allow you to access information that can be used to link data of your choosing to a trace or entity.
|
154
|
+
|
155
|
+
* **Logs in Context**
|
156
|
+
|
157
|
+
This version of the agent includes a logger, which can be used in place of `::Logger`
|
158
|
+
from the standard library, or `ActiveSupport::Logger` from Rails. This logger
|
159
|
+
leverages the new trace and entity metadata API to decorate log statements with entity
|
160
|
+
and trace metadata, so they can be correlated together in the New Relic UI.
|
161
|
+
|
162
|
+
For more information on how to use logs in context, see https://docs.newrelic.com/docs/enable-logs-context-ruby
|
163
|
+
|
164
|
+
* **Project metadata in Gemspec**
|
165
|
+
|
166
|
+
Project metadata has been added to the gemspec file. This means our Rubygems page will allow users to more easily
|
167
|
+
access the agent's source code, raise issues, and read the changelog.
|
168
|
+
|
169
|
+
Thanks to Orien Madgwick for the contribution!
|
170
|
+
|
171
|
+
## v6.6.0
|
172
|
+
|
173
|
+
* **Bugfix for ActionCable Instrumentation**
|
174
|
+
|
175
|
+
Previous versions of the agent sometimes caused application crashes with some versions
|
176
|
+
of ActionCable. The application would exit quickly after startup with the error:
|
177
|
+
`uninitialized constant ActionCable::Engine`.
|
178
|
+
|
179
|
+
Version 6.6.0 of the agent no longer crashes in this way.
|
180
|
+
|
181
|
+
|
182
|
+
* **Handling of disabling Error Collection**
|
183
|
+
|
184
|
+
When the agent first starts, it begins collecting Error Events and Traces before
|
185
|
+
fetching configuration from New Relic. In previous versions of the agent, those
|
186
|
+
events or traces would be sent to New Relic, even if _Error Collection_ is disabled in
|
187
|
+
the application's server-side configuration.
|
188
|
+
|
189
|
+
Version 6.6.0 of the agent drops all collected Error Events and Traces if the
|
190
|
+
configuration from the server disables _Error Collection_.
|
191
|
+
|
192
|
+
## v6.5.0
|
193
|
+
|
194
|
+
* **Change to default setting for ActiveRecord connection resolution**
|
195
|
+
|
196
|
+
Due to incompatibilities between the faster ActiveRecord connection resolution
|
197
|
+
released in v6.3.0 of the agent and other gems which patch ActiveRecord,
|
198
|
+
`backport_fast_active_record_connection_lookup` will now be set to `false` by default.
|
199
|
+
Because it results in a significant performance improvement, we recommend customers
|
200
|
+
whose environments include ActiveRecord change this setting to `true`
|
201
|
+
_unless_ they are using other gems which measure ActiveRecord performance, which may
|
202
|
+
lose functionality when combined with this setting. If unsure whether to enable
|
203
|
+
`backport_fast_active_record_connection_lookup`, we recommend enabling it in a
|
204
|
+
development environment to make sure other gems which patch ActiveRecord are still
|
205
|
+
working as expected.
|
206
|
+
|
207
|
+
* **Bugfix for ActiveStorage instrumentation error**
|
208
|
+
|
209
|
+
Version 6.4.0 of the agent introduced a bug that interfered with ActiveStorage
|
210
|
+
callbacks, resulting in the agent being unable to instrument ActiveStorage operations.
|
211
|
+
ActiveStorage segments are now correctly recorded.
|
212
|
+
|
213
|
+
* **Bugfix for ActiveRecord 4.1 and 4.2 exception logging**
|
214
|
+
|
215
|
+
Version 6.3.0 of the agent introduced a bug that prevented ActiveRecord versions 4.1
|
216
|
+
and 4.2 from logging exceptions that occurred within a database transaction. This
|
217
|
+
version of the agent restores the exception logging functionality from previous agent
|
218
|
+
versions.
|
219
|
+
Thanks to Oleksiy Kovyrin for the contribution!
|
220
|
+
|
3
221
|
## v6.4.0
|
4
222
|
|
5
223
|
* **Custom Metadata Collection**
|
data/Guardfile
CHANGED
@@ -1,8 +1,23 @@
|
|
1
|
-
|
1
|
+
test_folders = Dir.glob("test/new_relic/*").select{|f| File.directory?(f)}
|
2
|
+
test_folders += Dir.glob("test/new_relic/**/*").select{|f| File.directory?(f)}
|
3
|
+
|
4
|
+
rake_lib_path = Bundler.with_unbundled_env{ `bundle exec gem which rake`.chomp.gsub("lib/rake.rb", "lib") }
|
5
|
+
ruby_options = %{-w -I"#{rake_lib_path}" "#{rake_lib_path}/rake/rake_test_loader.rb"}
|
6
|
+
|
7
|
+
guard_options = {
|
8
|
+
spring: "bundle exec ruby #{ruby_options} ",
|
9
|
+
test_folders: ['test/new_relic'] + test_folders,
|
10
|
+
all_after_pass: false,
|
11
|
+
all_on_start: false
|
12
|
+
}
|
13
|
+
|
14
|
+
guard :minitest, guard_options do
|
2
15
|
watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
|
3
16
|
watch(%r{^test/.+_test\.rb$})
|
4
17
|
watch(%r{^test/rum/.*}) { "test/new_relic/rack/browser_monitoring_test.rb" }
|
18
|
+
watch(%r{^test/fixtures/cross_agent_tests/distributed_tracing/(.+).json}) { |m| "test/new_relic/agent/distributed_tracing/#{m[1]}_cross_agent_test.rb" }
|
5
19
|
watch('test/test_helper.rb') { "test/new_relic" }
|
6
20
|
watch('test/agent_helper.rb') { "test/new_relic" }
|
7
21
|
watch('lib/new_relic/agent/configuration/default_source.rb') { "test/new_relic/agent/configuration/orphan_configuration_test.rb" }
|
22
|
+
watch(%r{^lib/new_relic/agent/transaction/(.+).rb}) { |m| "test/new_relic/agent/distributed_tracing/#{m[1]}_cross_agent_test.rb" }
|
8
23
|
end
|
data/lib/new_relic/agent.rb
CHANGED
@@ -35,7 +35,6 @@ module NewRelic
|
|
35
35
|
require 'new_relic/agent/encoding_normalizer'
|
36
36
|
require 'new_relic/agent/stats'
|
37
37
|
require 'new_relic/agent/chained_call'
|
38
|
-
require 'new_relic/agent/cross_app_monitor'
|
39
38
|
require 'new_relic/agent/agent'
|
40
39
|
require 'new_relic/agent/method_tracer'
|
41
40
|
require 'new_relic/agent/worker_loop'
|
@@ -55,7 +54,9 @@ module NewRelic
|
|
55
54
|
require 'new_relic/agent/system_info'
|
56
55
|
require 'new_relic/agent/external'
|
57
56
|
require 'new_relic/agent/deprecator'
|
58
|
-
|
57
|
+
require 'new_relic/agent/logging'
|
58
|
+
require 'new_relic/agent/distributed_tracing'
|
59
|
+
|
59
60
|
require 'new_relic/agent/instrumentation/controller_instrumentation'
|
60
61
|
|
61
62
|
require 'new_relic/agent/samplers/cpu_sampler'
|
@@ -350,10 +351,9 @@ module NewRelic
|
|
350
351
|
# @api public
|
351
352
|
#
|
352
353
|
def manual_start(options={})
|
353
|
-
record_api_supportability_metric(:manual_start)
|
354
|
-
|
355
354
|
raise "Options must be a hash" unless Hash === options
|
356
355
|
NewRelic::Control.instance.init_plugin({ :agent_enabled => true, :sync_startup => true }.merge(options))
|
356
|
+
record_api_supportability_metric(:manual_start)
|
357
357
|
end
|
358
358
|
|
359
359
|
# Register this method as a callback for processes that fork
|
@@ -567,6 +567,12 @@ module NewRelic
|
|
567
567
|
# these custom attributes will also be present in the script injected into
|
568
568
|
# the response body, making them available on Insights PageView events.
|
569
569
|
#
|
570
|
+
#
|
571
|
+
# @param [Hash] params A Hash of attributes to be attached to the transaction event.
|
572
|
+
# Keys should be strings or symbols, and values
|
573
|
+
# may be strings, symbols, numeric values or
|
574
|
+
# booleans.
|
575
|
+
#
|
570
576
|
# @api public
|
571
577
|
#
|
572
578
|
def add_custom_attributes(params) #THREAD_LOCAL_ACCESS
|
@@ -580,6 +586,31 @@ module NewRelic
|
|
580
586
|
end
|
581
587
|
end
|
582
588
|
|
589
|
+
# Add custom attributes to the span event for the current span. Attributes will be visible on spans in the
|
590
|
+
# New Relic Distributed Tracing UI and on span events in New Relic Insights.
|
591
|
+
#
|
592
|
+
# Custom attributes will not be transmitted when +high_security+ setting is enabled or
|
593
|
+
# +custom_attributes+ setting is disabled.
|
594
|
+
#
|
595
|
+
# @param [Hash] params A Hash of attributes to be attached to the span event.
|
596
|
+
# Keys should be strings or symbols, and values
|
597
|
+
# may be strings, symbols, numeric values or
|
598
|
+
# booleans.
|
599
|
+
#
|
600
|
+
# @see https://docs.newrelic.com/docs/using-new-relic/welcome-new-relic/get-started/glossary#span
|
601
|
+
# @api public
|
602
|
+
def add_custom_span_attributes params
|
603
|
+
record_api_supportability_metric :add_custom_span_attributes
|
604
|
+
|
605
|
+
if params.is_a? Hash
|
606
|
+
if segment = NewRelic::Agent::Tracer.current_segment
|
607
|
+
segment.add_custom_attributes params
|
608
|
+
end
|
609
|
+
else
|
610
|
+
::NewRelic::Agent.logger.warn "Bad argument passed to #add_custom_span_attributes. Expected Hash but got #{params.class}"
|
611
|
+
end
|
612
|
+
end
|
613
|
+
|
583
614
|
# @!endgroup
|
584
615
|
|
585
616
|
# @!group Transaction naming
|
@@ -588,7 +619,9 @@ module NewRelic
|
|
588
619
|
# apply a reasonable default based on framework routing, but in
|
589
620
|
# cases where this is insufficient, this can be used to manually
|
590
621
|
# control the name of the transaction.
|
591
|
-
#
|
622
|
+
#
|
623
|
+
# The category of transaction can be specified via the +:category+ option.
|
624
|
+
# The following are the only valid categories:
|
592
625
|
#
|
593
626
|
# * <tt>:category => :controller</tt> indicates that this is a
|
594
627
|
# controller action and will appear with all the other actions.
|
@@ -660,6 +693,54 @@ module NewRelic
|
|
660
693
|
NewRelic::Agent.logger.debug "Ignoring exception during %p event notification" % [event_type]
|
661
694
|
end
|
662
695
|
|
696
|
+
# @!group Trace and Entity metadata
|
697
|
+
|
698
|
+
TRACE_ID_KEY = 'trace.id'.freeze
|
699
|
+
SPAN_ID_KEY = 'span.id'.freeze
|
700
|
+
ENTITY_NAME_KEY = 'entity.name'.freeze
|
701
|
+
ENTITY_TYPE_KEY = 'entity.type'.freeze
|
702
|
+
ENTITY_GUID_KEY = 'entity.guid'.freeze
|
703
|
+
HOSTNAME_KEY = 'hostname'.freeze
|
704
|
+
|
705
|
+
ENTITY_TYPE = 'SERVICE'.freeze
|
706
|
+
|
707
|
+
# Returns a new hash containing trace and entity metadata that can be used
|
708
|
+
# to relate data to a trace or to an entity in APM.
|
709
|
+
#
|
710
|
+
# This hash includes:
|
711
|
+
# * trace.id - The current trace id, if there is a current trace id. This
|
712
|
+
# value may be omitted.
|
713
|
+
# * span.id - The current span id, if there is a current span. This
|
714
|
+
# value may be omitted.
|
715
|
+
# * entity.name - The name of the current application. This is read from
|
716
|
+
# the +app_name+ key in your config. If there are multiple application
|
717
|
+
# names, the first one is used.
|
718
|
+
# * entity.type - The entity type is hardcoded to the string +'SERVICE'+.
|
719
|
+
# * entity.guid - The guid of the current entity.
|
720
|
+
# * hostname - The fully qualified hostname.
|
721
|
+
#
|
722
|
+
# @api public
|
723
|
+
def linking_metadata
|
724
|
+
metadata = Hash.new
|
725
|
+
metadata[ENTITY_NAME_KEY] = config[:app_name][0]
|
726
|
+
metadata[ENTITY_TYPE_KEY] = ENTITY_TYPE
|
727
|
+
metadata[HOSTNAME_KEY] = Hostname.get
|
728
|
+
|
729
|
+
if entity_guid = config[:entity_guid]
|
730
|
+
metadata[ENTITY_GUID_KEY] = entity_guid
|
731
|
+
end
|
732
|
+
|
733
|
+
if trace_id = Tracer.current_trace_id
|
734
|
+
metadata[TRACE_ID_KEY] = trace_id
|
735
|
+
end
|
736
|
+
if span_id = Tracer.current_span_id
|
737
|
+
metadata[SPAN_ID_KEY] = span_id
|
738
|
+
end
|
739
|
+
metadata
|
740
|
+
end
|
741
|
+
|
742
|
+
#@!endgroup
|
743
|
+
|
663
744
|
# @!group Manual browser monitoring configuration
|
664
745
|
|
665
746
|
# This method returns a string suitable for inclusion in a page - known as
|