newrelic_rpm 6.6.0.358 → 6.11.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of newrelic_rpm might be problematic. Click here for more details.

Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +65 -5
  4. data/CHANGELOG.md +222 -0
  5. data/Gemfile +5 -2
  6. data/Guardfile +18 -1
  7. data/LICENSE +1 -1
  8. data/Rakefile +2 -0
  9. data/lib/new_relic/agent.rb +89 -7
  10. data/lib/new_relic/agent/agent.rb +114 -55
  11. data/lib/new_relic/agent/agent_logger.rb +4 -0
  12. data/lib/new_relic/agent/attribute_filter.rb +7 -7
  13. data/lib/new_relic/agent/attributes.rb +150 -0
  14. data/lib/new_relic/agent/autostart.rb +19 -14
  15. data/lib/new_relic/agent/configuration/default_source.rb +127 -9
  16. data/lib/new_relic/agent/configuration/event_harvest_config.rb +11 -5
  17. data/lib/new_relic/agent/configuration/manager.rb +0 -8
  18. data/lib/new_relic/agent/configuration/server_source.rb +3 -2
  19. data/lib/new_relic/agent/configuration/yaml_source.rb +11 -6
  20. data/lib/new_relic/agent/connect/request_builder.rb +5 -13
  21. data/lib/new_relic/agent/database.rb +1 -2
  22. data/lib/new_relic/agent/datastores/mongo.rb +1 -1
  23. data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +2 -2
  24. data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +8 -8
  25. data/lib/new_relic/agent/distributed_tracing.rb +155 -6
  26. data/lib/new_relic/agent/{cross_app_payload.rb → distributed_tracing/cross_app_payload.rb} +0 -0
  27. data/lib/new_relic/agent/{cross_app_tracing.rb → distributed_tracing/cross_app_tracing.rb} +60 -45
  28. data/lib/new_relic/agent/distributed_tracing/distributed_trace_intrinsics.rb +80 -0
  29. data/lib/new_relic/agent/distributed_tracing/distributed_trace_metrics.rb +75 -0
  30. data/lib/new_relic/agent/{distributed_trace_payload.rb → distributed_tracing/distributed_trace_payload.rb} +23 -99
  31. data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +39 -0
  32. data/lib/new_relic/agent/distributed_tracing/trace_context.rb +246 -0
  33. data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +126 -0
  34. data/lib/new_relic/agent/error_collector.rb +33 -16
  35. data/lib/new_relic/agent/error_event_aggregator.rb +7 -5
  36. data/lib/new_relic/agent/external.rb +7 -7
  37. data/lib/new_relic/agent/guid_generator.rb +28 -0
  38. data/lib/new_relic/agent/hostname.rb +7 -1
  39. data/lib/new_relic/agent/http_clients/abstract.rb +82 -0
  40. data/lib/new_relic/agent/http_clients/curb_wrappers.rb +24 -19
  41. data/lib/new_relic/agent/http_clients/excon_wrappers.rb +28 -13
  42. data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +17 -21
  43. data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +10 -11
  44. data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +16 -4
  45. data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +4 -6
  46. data/lib/new_relic/agent/http_clients/uri_util.rb +3 -2
  47. data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +5 -7
  48. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +4 -0
  49. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +11 -2
  50. data/lib/new_relic/agent/instrumentation/active_record.rb +4 -2
  51. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +7 -2
  52. data/lib/new_relic/agent/instrumentation/active_storage_subscriber.rb +8 -4
  53. data/lib/new_relic/agent/instrumentation/bunny.rb +45 -28
  54. data/lib/new_relic/agent/instrumentation/curb.rb +59 -18
  55. data/lib/new_relic/agent/instrumentation/data_mapper.rb +3 -1
  56. data/lib/new_relic/agent/instrumentation/excon.rb +1 -1
  57. data/lib/new_relic/agent/instrumentation/excon/connection.rb +6 -3
  58. data/lib/new_relic/agent/instrumentation/excon/middleware.rb +2 -1
  59. data/lib/new_relic/agent/instrumentation/grape.rb +5 -10
  60. data/lib/new_relic/agent/instrumentation/http.rb +6 -3
  61. data/lib/new_relic/agent/instrumentation/httpclient.rb +5 -3
  62. data/lib/new_relic/agent/instrumentation/memcache.rb +3 -1
  63. data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +6 -2
  64. data/lib/new_relic/agent/instrumentation/mongo.rb +9 -3
  65. data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +13 -0
  66. data/lib/new_relic/agent/instrumentation/net.rb +6 -3
  67. data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +25 -1
  68. data/lib/new_relic/agent/instrumentation/redis.rb +9 -3
  69. data/lib/new_relic/agent/instrumentation/resque.rb +3 -0
  70. data/lib/new_relic/agent/instrumentation/sidekiq.rb +0 -1
  71. data/lib/new_relic/agent/instrumentation/typhoeus.rb +23 -6
  72. data/lib/new_relic/agent/logging.rb +139 -0
  73. data/lib/new_relic/agent/messaging.rb +5 -73
  74. data/lib/new_relic/agent/method_tracer.rb +3 -2
  75. data/lib/new_relic/agent/method_tracer_helpers.rb +2 -2
  76. data/lib/new_relic/agent/monitors.rb +27 -0
  77. data/lib/new_relic/agent/monitors/cross_app_monitor.rb +110 -0
  78. data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +27 -0
  79. data/lib/new_relic/agent/{inbound_request_monitor.rb → monitors/inbound_request_monitor.rb} +1 -1
  80. data/lib/new_relic/agent/{synthetics_monitor.rb → monitors/synthetics_monitor.rb} +2 -4
  81. data/lib/new_relic/agent/new_relic_service.rb +7 -5
  82. data/lib/new_relic/agent/noticible_error.rb +22 -0
  83. data/lib/new_relic/agent/span_event_aggregator.rb +1 -0
  84. data/lib/new_relic/agent/span_event_primitive.rb +82 -53
  85. data/lib/new_relic/agent/sql_sampler.rb +3 -3
  86. data/lib/new_relic/agent/supported_versions.rb +2 -2
  87. data/lib/new_relic/agent/tracer.rb +65 -18
  88. data/lib/new_relic/agent/transaction.rb +84 -79
  89. data/lib/new_relic/agent/transaction/abstract_segment.rb +28 -2
  90. data/lib/new_relic/agent/transaction/distributed_tracer.rb +171 -0
  91. data/lib/new_relic/agent/transaction/distributed_tracing.rb +57 -146
  92. data/lib/new_relic/agent/transaction/external_request_segment.rb +29 -36
  93. data/lib/new_relic/agent/transaction/message_broker_segment.rb +3 -11
  94. data/lib/new_relic/agent/transaction/segment.rb +7 -1
  95. data/lib/new_relic/agent/transaction/trace.rb +2 -4
  96. data/lib/new_relic/agent/transaction/trace_context.rb +168 -0
  97. data/lib/new_relic/agent/transaction/trace_node.rb +10 -8
  98. data/lib/new_relic/agent/transaction_error_primitive.rb +10 -15
  99. data/lib/new_relic/agent/transaction_event_primitive.rb +28 -39
  100. data/lib/new_relic/cli/commands/deployments.rb +1 -1
  101. data/lib/new_relic/cli/commands/install.rb +3 -2
  102. data/lib/new_relic/coerce.rb +31 -6
  103. data/lib/new_relic/constants.rb +34 -0
  104. data/lib/new_relic/control/instance_methods.rb +10 -1
  105. data/lib/new_relic/dependency_detection.rb +4 -4
  106. data/lib/new_relic/noticed_error.rb +38 -17
  107. data/lib/new_relic/rack/browser_monitoring.rb +5 -0
  108. data/lib/new_relic/supportability_helper.rb +14 -0
  109. data/lib/new_relic/version.rb +1 -1
  110. data/lib/tasks/multiverse.rb +25 -0
  111. data/lib/tasks/tests.rake +6 -1
  112. data/newrelic_rpm.gemspec +18 -7
  113. data/test/agent_helper.rb +322 -70
  114. metadata +98 -32
  115. data/lib/new_relic/agent/cross_app_monitor.rb +0 -110
  116. data/lib/new_relic/agent/distributed_trace_monitor.rb +0 -40
  117. data/lib/new_relic/agent/http_clients/abstract_request.rb +0 -31
  118. data/lib/new_relic/agent/transaction/attributes.rb +0 -154
  119. data/lib/tasks/versions.html.erb +0 -28
  120. data/lib/tasks/versions.postface.html +0 -8
  121. data/lib/tasks/versions.preface.html +0 -9
  122. data/lib/tasks/versions.rake +0 -65
  123. data/lib/tasks/versions.txt.erb +0 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d39324de06656b928892edc72296e459eb2737929e20f054514c2ddc980bfb0
4
- data.tar.gz: 3752b1d5dbcd79b38a808460c68141926ae627f0c50ec8cc6ded103285719844
3
+ metadata.gz: f8e855ac8a67e4fbe5dcb17a57457786b1683513949a4cc9baa7f9055c6b74b6
4
+ data.tar.gz: 461cb1c9c3b4f68645ec460717864d17afd66d070e593cc1b5450307155dc77b
5
5
  SHA512:
6
- metadata.gz: 6f277cc9660dde4ef818de176ad156202ad1993594416882e678b31786386f547b200a96444be1a84bfa53e8385700f07b837d3c500a1e8529d2e4c5d9bbf3ab
7
- data.tar.gz: 258bd06b3feaf43c29e8007a6d97003d2d7879b719fc818ba1a374a2167f336f1b4b4352b31d938af24afb0c917751649e62eddaaab41a7955ef55e10f56e84d
6
+ metadata.gz: 64786c500d5315d42ec35b3d9003ff51d4de545fb1e44ac4ddb27b565570af0fdef2816ef8453fb8555cdc596c3cea12cd621a10d2b28fea0b0c252913120b9f
7
+ data.tar.gz: a6e008e1daba294f96030aa43302db129f45d1e718f251dc7a69d117dd5bc63891f7afb53e655b3b012942ec14f1653087d61d7749103702e92797b8c762fc33
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  Gemfile.lock
2
+ Guard*
2
3
  .DS\_Store
3
4
  .svn/
4
5
  *~
@@ -4,22 +4,29 @@ services:
4
4
  - memcached
5
5
  - rabbitmq
6
6
 
7
+ notifications:
8
+ slack:
9
+ secure: Ziq6vzXmc1S+SZnJF7DyjprRgzZKvVK5TXtnNJAoH4EFchziCqko+75hMxDZ/6Y2kShcijgbzZSkIIVSiuYyx0Jgxdsmwed7yrs91uv2WsUw2/l+taOTBIAMa/m9PZppsRqmkywxWeeTPL6cf65Vg3PYRuqzj83nczUFJo4UNrA=
10
+
7
11
  language: ruby
8
12
 
13
+ dist: precise
9
14
  sudo: required
15
+ jdk:
16
+ - oraclejdk8
10
17
 
11
18
  before_install:
12
19
  # RUBY-2072 Prevent Travis setup failure before our test even starts
13
20
  - jdk_switcher use oraclejdk8
14
21
  - sudo rm -f /etc/apt/sources.list.d/travis_ci_zeromq3.list
15
22
  - gem --version
16
- - ./test/script/before_install/update_rubygems.sh
17
- - rvm @global do gem uninstall bundler --all --executables || true
18
- - gem install bundler -v=1.17.3
23
+ - "echo 'gem: --no-rdoc --no-ri --no-document' > ~/.gemrc"
24
+ - ./test/script/before_install/conditionally_upgrade_rubygems.sh
19
25
  - ./test/script/before_install/gemstash_mirror.sh
26
+ - "echo GEMSTASH_MIRROR: $GEMSTASH_MIRROR"
20
27
  - bundle --version
21
28
 
22
- install: bundle install
29
+ install: bundle install --jobs 4
23
30
 
24
31
  addons:
25
32
  apt:
@@ -39,10 +46,12 @@ branches:
39
46
  - master
40
47
  - dev
41
48
  - release
49
+ - RUBY-2227_w3c_trace_context_poc
42
50
 
43
51
  rvm:
44
52
  # Run slowest builds first to try and optimize overall cycle time.
45
53
  - jruby-9.2.6.0
54
+ - 2.7.0
46
55
  - 2.6.1
47
56
  - 2.5.3
48
57
  - 2.4.2
@@ -51,11 +60,14 @@ rvm:
51
60
  - 2.1.10
52
61
  - 2.0.0-p648
53
62
 
63
+ jdk:
64
+ - oraclejdk8
65
+
54
66
  env:
55
67
  global:
56
68
  - BUNDLE_PATH=/home/travis/bundle
57
69
  - MONGODB=2.6.11
58
- - JAVA_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xmx640m"
70
+ - JAVA_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xmx1024m -XX:CICompilerCount=1 -Xshare:auto"
59
71
  - JRUBY_OPTS="-Xcompile.invokedynamic=false -J-Djruby.compile.mode=OFF"
60
72
  - RBXOPT="-Xcompiler.no_rbc -Xint"
61
73
  - SERIALIZE=1
@@ -70,6 +82,7 @@ env:
70
82
  - TYPE=UNIT ENVIRONMENT=rails42
71
83
  - TYPE=UNIT ENVIRONMENT=rails50
72
84
  - TYPE=UNIT ENVIRONMENT=rails51
85
+ - TYPE=UNIT ENVIRONMENT=rails52
73
86
  - TYPE=UNIT ENVIRONMENT=rails60
74
87
  - TYPE=UNIT ENVIRONMENT=norails
75
88
  - TYPE=FUNCTIONAL GROUP=agent
@@ -85,9 +98,50 @@ env:
85
98
  - TYPE=NULLVERSE
86
99
 
87
100
  matrix:
101
+ allow_failures:
102
+ - rvm: jruby-9.2.6.0
103
+ env: TYPE=FUNCTIONAL GROUP=agent
88
104
  fast_finish: true
89
105
  exclude:
90
106
  # Unsupported Rails/Ruby combinations
107
+ # 2.7
108
+ - rvm: 2.7.0
109
+ env: TYPE=UNIT ENVIRONMENT=rails30
110
+ - rvm: 2.7.0
111
+ env: TYPE=UNIT ENVIRONMENT=rails31
112
+ - rvm: 2.7.0
113
+ env: TYPE=UNIT ENVIRONMENT=rails32
114
+ - rvm: 2.7.0
115
+ env: TYPE=UNIT ENVIRONMENT=rails40
116
+ - rvm: 2.7.0
117
+ env: TYPE=UNIT ENVIRONMENT=rails41
118
+
119
+ - rvm: 2.7.0
120
+ env: TYPE=UNIT ENVIRONMENT=rails42 # rails (= 4.2.11) depends on bundler (< 2.0, >= 1.3.0)
121
+ - rvm: 2.7.0
122
+ env: TYPE=UNIT ENVIRONMENT=rails50 # rails (= 5.0.0) depends on bundler (< 2.0, >= 1.3.0)
123
+ - rvm: 2.7.0
124
+ env: TYPE=UNIT ENVIRONMENT=rails51 # rails (= 5.1.0) depends on bundler (< 2.0, >= 1.3.0)
125
+ - rvm: 2.7.0
126
+ env: TYPE=UNIT ENVIRONMENT=rails52 # rails (= 5.2.0) depends on bundler (< 2.0, >= 1.3.0)
127
+ - rvm: 2.7.0
128
+ env: TYPE=FUNCTIONAL GROUP=api # blocked: https://github.com/solnic/coercible/issues/27
129
+ - rvm: 2.7.0
130
+ env: TYPE=FUNCTIONAL GROUP=sinatra # padrino (~> 0.14.0) depends on bundler (~> 1.0)
131
+
132
+ - rvm: 2.7.0
133
+ env: TYPE=UNIT ENVIRONMENT=rails42 # rails (= 4.2.11) depends on bundler (< 2.0, >= 1.3.0)
134
+ - rvm: 2.7.0
135
+ env: TYPE=UNIT ENVIRONMENT=rails50 # rails (= 5.0.0) depends on bundler (< 2.0, >= 1.3.0)
136
+ - rvm: 2.7.0
137
+ env: TYPE=UNIT ENVIRONMENT=rails51 # rails (= 5.1.0) depends on bundler (< 2.0, >= 1.3.0)
138
+ - rvm: 2.7.0
139
+ env: TYPE=UNIT ENVIRONMENT=rails52 # rails (= 5.2.0) depends on bundler (< 2.0, >= 1.3.0)
140
+ - rvm: 2.7.0
141
+ env: TYPE=FUNCTIONAL GROUP=api # blocked: https://github.com/solnic/coercible/issues/27
142
+ - rvm: 2.7.0
143
+ env: TYPE=FUNCTIONAL GROUP=sinatra # padrino (~> 0.14.0) depends on bundler (~> 1.0)
144
+
91
145
  # 2.6
92
146
  - rvm: 2.6.1
93
147
  env: TYPE=UNIT ENVIRONMENT=rails30
@@ -139,6 +193,8 @@ matrix:
139
193
  env: TYPE=UNIT ENVIRONMENT=rails50
140
194
  - rvm: 2.1.10
141
195
  env: TYPE=UNIT ENVIRONMENT=rails51
196
+ - rvm: 2.1.10
197
+ env: TYPE=UNIT ENVIRONMENT=rails52
142
198
  - rvm: 2.1.10
143
199
  env: TYPE=UNIT ENVIRONMENT=rails60
144
200
 
@@ -147,6 +203,8 @@ matrix:
147
203
  env: TYPE=UNIT ENVIRONMENT=rails50
148
204
  - rvm: 2.0.0-p648
149
205
  env: TYPE=UNIT ENVIRONMENT=rails51
206
+ - rvm: 2.0.0-p648
207
+ env: TYPE=UNIT ENVIRONMENT=rails52
150
208
  - rvm: 2.0.0-p648
151
209
  env: TYPE=UNIT ENVIRONMENT=rails60
152
210
 
@@ -163,3 +221,5 @@ matrix:
163
221
  env: TYPE=UNIT ENVIRONMENT=rails41
164
222
  - rvm: jruby-9.2.6.0
165
223
  env: TYPE=UNIT ENVIRONMENT=rails60
224
+ - rvm: jruby-9.2.6.0
225
+ env: TYPE=UNIT ENVIRONMENT=rails52
@@ -1,5 +1,227 @@
1
1
  # New Relic Ruby Agent Release Notes #
2
2
 
3
+ ## v6.10.0
4
+
5
+ * **Error attributes now added to each span that exits with an error or exception**
6
+
7
+ Error attributes `error.class` and `error.message` are now included on the span event in which an error
8
+ or exception was noticed, and, in the case of unhandled exceptions, on any ancestor spans that also exit with an error.
9
+ The public API method `notice_error` now attaches these error attributes to the currently executing span.
10
+
11
+ <a href="https://docs.newrelic.com/docs/apm/distributed-tracing/ui-data/understand-use-distributed-tracing-data#rules-limits">Spans with error details are now highlighted red in the Distributed Tracing UI</a>, and error details will expose the associated
12
+ `error.class` and `error.message`. It is also now possible to see when an exception leaves the boundary of the span,
13
+ and if it is caught in an ancestor span without reaching the entry span. NOTE: This “bubbling up” of exceptions will impact
14
+ the error count when compared to prior behavior for the same trace. It is possible to have a trace that now has span errors
15
+ without the trace level showing an error.
16
+
17
+ If multiple errors occur on the same span, only the most recent error information is added to the attributes. Prior errors on the same span are overwritten.
18
+
19
+ These span event attributes conform to <a href="https://docs.newrelic.com/docs/agents/manage-apm-agents/agent-data/manage-errors-apm-collect-ignore-or-mark-expected#ignore">ignored errors</a> and <a href="https://docs.newrelic.com/docs/agents/manage-apm-agents/agent-data/manage-errors-apm-collect-ignore-or-mark-expected#expected">expected errors</a>.
20
+
21
+ * **Added tests for latest Grape / Rack combination**
22
+
23
+ For a short period of time, the latest versions of Grape and Rack had compatibility issues.
24
+ Generally, Rack 2.1.0 should be avoided in all cases due to breaking changes in many gems
25
+ reliant on Rack. We recommend using either Rack <= 2.0.9, or using latest Rack when using Grape
26
+ (2.2.2 at the time of this writing).
27
+
28
+ * **Bugfix: Calculate Content-Length in bytes**
29
+
30
+ Previously, the Content-Length HTTP header would be incorrect after injecting the Browser Monitoring
31
+ JS when the response contained Unicode characters because the value was not calculated in bytes.
32
+ The Content-Length is now correctly updated.
33
+
34
+ Thanks to thaim for the contribution!
35
+
36
+ * **Bugfix: Fix Content-Length calculation when response is nil**
37
+
38
+ Previously, calculating the Content-Length HTTP header would result in a `NoMethodError` in the case of
39
+ a nil response. These errors will no longer occur in such a case.
40
+
41
+ Thanks to Johan Van Ryseghem for the contribution!
42
+
43
+ * **Bugfix: DecoratingFormatter now logs timestamps as millisecond Integers**
44
+
45
+ Previously the agent sent timestamps as a Float with milliseconds as part of the
46
+ fractional value. Logs in Context was changed to only accept Integer values and this
47
+ release changes DecoratingFormatter to match.
48
+
49
+ * **Added --force option to `newrelic install` cli command to allow overwriting newrelic.yml**
50
+
51
+ * **Bugfix: The fully qualified hostname now works correctly for BSD and Solaris**
52
+
53
+ Previously, when running on systems such as BSD and Solaris, the agent was unable to determine the fully
54
+ qualified domain name, which is used to help link Ruby agent data with data from New Relic Infrastructure.
55
+ This information is now successfully collected on various BSD distros and Solaris.
56
+
57
+ ## v6.9.0
58
+
59
+ * **Added support for W3C Trace Context, with easy upgrade from New Relic trace context**
60
+
61
+ * [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
62
+ the W3C trace header format and the New Relic trace header format. This simplifies
63
+ agent upgrades, allowing trace context to be propagated between services with older
64
+ and newer releases of New Relic agents. W3C trace header format will always be
65
+ accepted and emitted. New Relic trace header format will be accepted, and you can
66
+ optionally disable emission of the New Relic trace header format.
67
+
68
+ * When distributed tracing is enabled by setting `distributed_tracing.enabled` to `true`,
69
+ the Ruby agent will now accept W3C's `traceparent` and `tracestate` headers when
70
+ calling `DistributedTracing.accept_distributed_trace_headers` or automatically via
71
+ `http` instrumentation. When calling `DistributedTracing.insert_distributed_trace_headers`,
72
+ or automatically via `http` instrumentation, the Ruby agent will include the W3C
73
+ headers along with the New Relic distributed tracing header, unless the New Relic
74
+ trace header format is disabled by setting `exclude_newrelic_header` setting to `true`.
75
+
76
+ * Added `DistributedTracing.accept_distributed_trace_headers` API for accepting both
77
+ New Relic and W3C TraceContext distributed traces.
78
+
79
+ * Deprecated `DistributedTracing.accept_distributed_trace_payload` which will be removed
80
+ in a future major release.
81
+
82
+ * Added `DistributedTracing.insert_distributed_trace_headers` API for adding outbound
83
+ distributed trace headers. Both W3C TraceContext and New Relic formats will be
84
+ included unless `distributed_tracing.exclude_newrelic_header: true`.
85
+
86
+ * Deprecated `DistributedTracing.create_distributed_trace_payload` which will be removed
87
+ in a future major release.
88
+
89
+ Known Issues and Workarounds
90
+
91
+ * If a .NET agent is initiating traces as the root service, do not upgrade your
92
+ downstream Ruby New Relic agents to this agent release.
93
+
94
+ * **Official Ruby 2.7 support**
95
+
96
+ The Ruby agent has been verified to run with Ruby 2.7.0.
97
+
98
+ * **Reduced allocations when tracing transactions using API calls**
99
+
100
+ Default empty hashes for `options` parameter were not frozen, leading to
101
+ excessive and unnecessary allocations when calling APIs for tracing transactions.
102
+
103
+ Thanks to Joel Turkel (jturkel) for the contribution!
104
+
105
+ * **Bugfix for Resque worker thread race conditions**
106
+
107
+ 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
108
+ is now fixed.
109
+
110
+ Thanks to Bertrand Paquet (bpaquet) for the contribution!
111
+
112
+ * **Bugfix for Content-Length when injecting Browser Monitoring JS**
113
+
114
+ The Content-Length HTTP header would be incorrect after injecting the Browser Monitoring
115
+ JS into the HEAD tag of the HTML source with Content-Length and lead to the HTML BODY content
116
+ being truncated in some cases. The Content-Length is now correctly updated after injecting the
117
+ Browser Monitoring JS script.
118
+
119
+ Thanks to Slava Kardakov (ojab) for the contribution!
120
+
121
+ ## v6.8.0
122
+
123
+ * **Initial Ruby 2.7 support**
124
+
125
+ The Ruby agent has been verified to run with Ruby 2.7.0-preview1.
126
+
127
+ * **New API method to add custom attributes to Spans**
128
+
129
+ New API method for adding custom attributes to spans. Previously, custom
130
+ attributes were only available at the Transaction level. Now, with Span
131
+ level custom attributes, more granular tagging of events is possible for
132
+ easier isolation and review of trace events. For more information:
133
+
134
+ * [`Agent#add_custom_span_attributes`](https://www.rubydoc.info/github/newrelic/rpm/NewRelic/Agent#add_custom_span_attributes)
135
+
136
+ * **Enables ability to migrate to Configurable Security Policies (CSP) on a per agent
137
+ basis for accounts already using High Security Mode (HSM).**
138
+
139
+ 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)
140
+ can successfully connect with either `high_security: true` or the appropriate
141
+ `security_policies_token` configured. `high_security` has been added as part of
142
+ the preconnect payload.
143
+
144
+ * **Bugfix for Logs in Context combined with act-fluent-logger-rails**
145
+
146
+ Previously, when using the Ruby agent's Logs in Context logger
147
+ to link logging data with trace and entity metadata for an
148
+ improved experience in the UI, customers who were also using
149
+ the `act-fluent-logger-rails` gem would see a `NoMethodError`
150
+ for `clear_tags!` that would interfere with the use of this
151
+ feature. This error no longer appears, allowing customers to
152
+ combine the use of Logs in Context with the use of this gem.
153
+
154
+ Please note that the Logs in Context logger does not support
155
+ tagged logging; if you are initializing your logger with a
156
+ `log_tags` argument, your custom tags may not appear on the
157
+ final version of your logs.
158
+
159
+ * **Bugfix for parsing invalid newrelic.yml**
160
+
161
+ Previously, if the newrelic.yml configuration file was invalid, and the agent
162
+ could not start as a result, the agent would not log any indication of
163
+ the problem.
164
+
165
+ This version of the agent will emit a FATAL message to STDOUT when this scenario
166
+ occurs so that customers can address issues with newrelic.yml that prevent startup.
167
+
168
+ * **Configuration options containing the terms "whitelist" and "blacklist" deprecated**
169
+
170
+ The following local configuration settings have been deprecated:
171
+
172
+ * `autostart.blacklisted_constants`: use `autostart.denylisted_constants` instead.
173
+ * `autostart.blacklisted_executables`: use `autostart.denylisted_executables` instead.
174
+ * `autostart.blacklisted_rake_tasks`: use `autostart.denylisted_rake_tasks` instead.
175
+ * `strip_exception_messages.whitelist`: use `strip_exception_messages.allowed_classes` instead.
176
+
177
+ * **Bugfix for module loading and constant resolution in Rails**
178
+
179
+ Starting in version 6.3, the Ruby agent has caused module loading and constant
180
+ resolution to sometimes fail, which caused errors in some Rails applications.
181
+ These errors were generally `NoMethodError` exceptions or I18n errors
182
+ `translation missing` or `invalid locale`. These errors would not appear if the agent
183
+ was removed from the application's Gemfile.
184
+ This version of the agent fixes these issues with module loading and constant
185
+ resolution, so these errors no longer occur.
186
+
187
+ * **Bugfix: failed to get urandom**
188
+
189
+ Previous versions of the agent would fail unexpectedly when the Ruby process used
190
+ every available file descriptor. The failures would include this message:
191
+ ```
192
+ ERROR : RuntimeError: failed to get urandom
193
+ ```
194
+ This version of the agent uses a different strategy for generating random IDs, and
195
+ will not fail in the same way when no file descriptors are available.
196
+
197
+ ## v6.7.0
198
+
199
+ * **Trace and Entity Metadata API**
200
+
201
+ Several new API methods have been added to the agent:
202
+ * [`Agent#linking_metadata`](https://www.rubydoc.info/github/newrelic/rpm/NewRelic/Agent#linking_metadata-instance_method)
203
+ * [`Tracer#trace_id`](https://www.rubydoc.info/github/newrelic/rpm/NewRelic/Agent/Tracer#trace_id-class_method)
204
+ * [`Tracer#span_id`](https://www.rubydoc.info/github/newrelic/rpm/NewRelic/Agent/Tracer#span_id-class_method)
205
+ * [`Tracer#sampled?`](https://www.rubydoc.info/github/newrelic/rpm/NewRelic/Agent/Tracer#sampled?-class_method)
206
+
207
+ These API methods allow you to access information that can be used to link data of your choosing to a trace or entity.
208
+
209
+ * **Logs in Context**
210
+
211
+ This version of the agent includes a logger, which can be used in place of `::Logger`
212
+ from the standard library, or `ActiveSupport::Logger` from Rails. This logger
213
+ leverages the new trace and entity metadata API to decorate log statements with entity
214
+ and trace metadata, so they can be correlated together in the New Relic UI.
215
+
216
+ For more information on how to use logs in context, see https://docs.newrelic.com/docs/enable-logs-context-ruby
217
+
218
+ * **Project metadata in Gemspec**
219
+
220
+ Project metadata has been added to the gemspec file. This means our Rubygems page will allow users to more easily
221
+ access the agent's source code, raise issues, and read the changelog.
222
+
223
+ Thanks to Orien Madgwick for the contribution!
224
+
3
225
  ## v6.6.0
4
226
 
5
227
  * **Bugfix for ActionCable Instrumentation**
data/Gemfile CHANGED
@@ -1,3 +1,6 @@
1
- source 'https://rubygems.org'
1
+ # encoding: utf-8
2
+ # This file is distributed under New Relic's license terms.
3
+ # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
2
4
 
3
- gemspec
5
+ source 'https://rubygems.org'
6
+ gemspec name: "newrelic_rpm"
data/Guardfile CHANGED
@@ -1,8 +1,25 @@
1
- guard :minitest, :test_folders => ['test/new_relic'], :all_after_pass => false do
1
+ require './test/multiverse/lib/multiverse/bundler_patch'
2
+
3
+ test_folders = Dir.glob("test/new_relic/*").select{|f| File.directory?(f)}
4
+ test_folders += Dir.glob("test/new_relic/**/*").select{|f| File.directory?(f)}
5
+
6
+ rake_lib_path = Bundler.with_unbundled_env{ `bundle exec gem which rake`.chomp.gsub("lib/rake.rb", "lib") }
7
+ ruby_options = %{-w -I"#{rake_lib_path}" "#{rake_lib_path}/rake/rake_test_loader.rb"}
8
+
9
+ guard_options = {
10
+ spring: "bundle exec ruby #{ruby_options} ",
11
+ test_folders: ['test/new_relic'] + test_folders,
12
+ all_after_pass: false,
13
+ all_on_start: false
14
+ }
15
+
16
+ guard :minitest, guard_options do
2
17
  watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
3
18
  watch(%r{^test/.+_test\.rb$})
4
19
  watch(%r{^test/rum/.*}) { "test/new_relic/rack/browser_monitoring_test.rb" }
20
+ watch(%r{^test/fixtures/cross_agent_tests/distributed_tracing/(.+).json}) { |m| "test/new_relic/agent/distributed_tracing/#{m[1]}_cross_agent_test.rb" }
5
21
  watch('test/test_helper.rb') { "test/new_relic" }
6
22
  watch('test/agent_helper.rb') { "test/new_relic" }
7
23
  watch('lib/new_relic/agent/configuration/default_source.rb') { "test/new_relic/agent/configuration/orphan_configuration_test.rb" }
24
+ watch(%r{^lib/new_relic/agent/transaction/(.+).rb}) { |m| "test/new_relic/agent/distributed_tracing/#{m[1]}_cross_agent_test.rb" }
8
25
  end
data/LICENSE CHANGED
@@ -1,5 +1,5 @@
1
1
  All components of this product are
2
- Copyright (c) 2008-2017 New Relic, Inc. All rights reserved.
2
+ Copyright (c) 2008-2020 New Relic, Inc. All rights reserved.
3
3
 
4
4
  Certain inventions disclosed in this file may be claimed within
5
5
  patents owned or patent applications filed by New Relic, Inc. or third
data/Rakefile CHANGED
@@ -2,6 +2,7 @@ require 'rubygems'
2
2
  require 'rake/testtask'
3
3
  require 'yard'
4
4
  require "#{File.dirname(__FILE__)}/lib/tasks/all.rb"
5
+ require "#{File.dirname(__FILE__)}/infinite_tracing/tasks/all.rb"
5
6
 
6
7
  YARD::Rake::YardocTask.new
7
8
 
@@ -136,3 +137,4 @@ task :console do
136
137
  ARGV.clear
137
138
  Pry.start
138
139
  end
140
+
@@ -30,12 +30,12 @@ module NewRelic
30
30
  require 'new_relic/metric_spec'
31
31
  require 'new_relic/metric_data'
32
32
  require 'new_relic/noticed_error'
33
+ require 'new_relic/agent/noticible_error'
33
34
  require 'new_relic/supportability_helper'
34
35
 
35
36
  require 'new_relic/agent/encoding_normalizer'
36
37
  require 'new_relic/agent/stats'
37
38
  require 'new_relic/agent/chained_call'
38
- require 'new_relic/agent/cross_app_monitor'
39
39
  require 'new_relic/agent/agent'
40
40
  require 'new_relic/agent/method_tracer'
41
41
  require 'new_relic/agent/worker_loop'
@@ -55,7 +55,9 @@ 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
-
58
+ require 'new_relic/agent/logging'
59
+ require 'new_relic/agent/distributed_tracing'
60
+
59
61
  require 'new_relic/agent/instrumentation/controller_instrumentation'
60
62
 
61
63
  require 'new_relic/agent/samplers/cpu_sampler'
@@ -350,10 +352,9 @@ module NewRelic
350
352
  # @api public
351
353
  #
352
354
  def manual_start(options={})
353
- record_api_supportability_metric(:manual_start)
354
-
355
355
  raise "Options must be a hash" unless Hash === options
356
356
  NewRelic::Control.instance.init_plugin({ :agent_enabled => true, :sync_startup => true }.merge(options))
357
+ record_api_supportability_metric(:manual_start)
357
358
  end
358
359
 
359
360
  # Register this method as a callback for processes that fork
@@ -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
@@ -588,7 +620,9 @@ module NewRelic
588
620
  # apply a reasonable default based on framework routing, but in
589
621
  # cases where this is insufficient, this can be used to manually
590
622
  # control the name of the transaction.
591
- # The category of transaction can be specified via the +:category+ option:
623
+ #
624
+ # The category of transaction can be specified via the +:category+ option.
625
+ # The following are the only valid categories:
592
626
  #
593
627
  # * <tt>:category => :controller</tt> indicates that this is a
594
628
  # controller action and will appear with all the other actions.
@@ -638,8 +672,8 @@ module NewRelic
638
672
  # @param [String] method the name of the finder method or other method to
639
673
  # identify the operation with.
640
674
  #
641
- def with_database_metric_name(model, method = nil, product = nil, &block) #THREAD_LOCAL_ACCESS
642
- if txn = Transaction.tl_current
675
+ def with_database_metric_name(model, method = nil, product = nil, &block)
676
+ if txn = Tracer.current_transaction
643
677
  txn.with_database_metric_name(model, method, product, &block)
644
678
  else
645
679
  yield
@@ -660,6 +694,54 @@ module NewRelic
660
694
  NewRelic::Agent.logger.debug "Ignoring exception during %p event notification" % [event_type]
661
695
  end
662
696
 
697
+ # @!group Trace and Entity metadata
698
+
699
+ TRACE_ID_KEY = 'trace.id'.freeze
700
+ SPAN_ID_KEY = 'span.id'.freeze
701
+ ENTITY_NAME_KEY = 'entity.name'.freeze
702
+ ENTITY_TYPE_KEY = 'entity.type'.freeze
703
+ ENTITY_GUID_KEY = 'entity.guid'.freeze
704
+ HOSTNAME_KEY = 'hostname'.freeze
705
+
706
+ ENTITY_TYPE = 'SERVICE'.freeze
707
+
708
+ # Returns a new hash containing trace and entity metadata that can be used
709
+ # to relate data to a trace or to an entity in APM.
710
+ #
711
+ # This hash includes:
712
+ # * trace.id - The current trace id, if there is a current trace id. This
713
+ # value may be omitted.
714
+ # * span.id - The current span id, if there is a current span. This
715
+ # value may be omitted.
716
+ # * entity.name - The name of the current application. This is read from
717
+ # the +app_name+ key in your config. If there are multiple application
718
+ # names, the first one is used.
719
+ # * entity.type - The entity type is hardcoded to the string +'SERVICE'+.
720
+ # * entity.guid - The guid of the current entity.
721
+ # * hostname - The fully qualified hostname.
722
+ #
723
+ # @api public
724
+ def linking_metadata
725
+ metadata = Hash.new
726
+ metadata[ENTITY_NAME_KEY] = config[:app_name][0]
727
+ metadata[ENTITY_TYPE_KEY] = ENTITY_TYPE
728
+ metadata[HOSTNAME_KEY] = Hostname.get
729
+
730
+ if entity_guid = config[:entity_guid]
731
+ metadata[ENTITY_GUID_KEY] = entity_guid
732
+ end
733
+
734
+ if trace_id = Tracer.current_trace_id
735
+ metadata[TRACE_ID_KEY] = trace_id
736
+ end
737
+ if span_id = Tracer.current_span_id
738
+ metadata[SPAN_ID_KEY] = span_id
739
+ end
740
+ metadata
741
+ end
742
+
743
+ #@!endgroup
744
+
663
745
  # @!group Manual browser monitoring configuration
664
746
 
665
747
  # This method returns a string suitable for inclusion in a page - known as