newrelic_rpm 5.5.0.348 → 6.2.0.354

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +36 -84
  4. data/.yardopts +1 -0
  5. data/CHANGELOG.md +149 -0
  6. data/README.md +1 -1
  7. data/config.dot +1 -0
  8. data/lib/new_relic/agent/agent.rb +15 -11
  9. data/lib/new_relic/agent/attribute_filter.rb +77 -17
  10. data/lib/new_relic/agent/configuration/default_source.rb +71 -1
  11. data/lib/new_relic/agent/configuration/security_policy_source.rb +14 -0
  12. data/lib/new_relic/agent/configuration/server_source.rb +2 -1
  13. data/lib/new_relic/agent/cross_app_monitor.rb +3 -3
  14. data/lib/new_relic/agent/datastores/metric_helper.rb +1 -2
  15. data/lib/new_relic/agent/datastores.rb +6 -8
  16. data/lib/new_relic/agent/distributed_trace_monitor.rb +1 -2
  17. data/lib/new_relic/agent/distributed_trace_payload.rb +7 -11
  18. data/lib/new_relic/agent/error_collector.rb +4 -6
  19. data/lib/new_relic/agent/external.rb +6 -4
  20. data/lib/new_relic/agent/hostname.rb +8 -0
  21. data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +8 -5
  22. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +12 -8
  23. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +1 -1
  24. data/lib/new_relic/agent/instrumentation/active_job.rb +6 -7
  25. data/lib/new_relic/agent/instrumentation/active_record.rb +2 -2
  26. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +3 -3
  27. data/lib/new_relic/agent/instrumentation/active_storage.rb +23 -0
  28. data/lib/new_relic/agent/instrumentation/active_storage_subscriber.rb +59 -0
  29. data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +1 -1
  30. data/lib/new_relic/agent/instrumentation/bunny.rb +16 -12
  31. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +9 -3
  32. data/lib/new_relic/agent/instrumentation/curb.rb +18 -5
  33. data/lib/new_relic/agent/instrumentation/data_mapper.rb +1 -1
  34. data/lib/new_relic/agent/instrumentation/evented_subscriber.rb +1 -1
  35. data/lib/new_relic/agent/instrumentation/excon/connection.rb +1 -1
  36. data/lib/new_relic/agent/instrumentation/grape.rb +17 -4
  37. data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +1 -1
  38. data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +11 -4
  39. data/lib/new_relic/agent/instrumentation/net.rb +1 -1
  40. data/lib/new_relic/agent/instrumentation/rake.rb +2 -3
  41. data/lib/new_relic/agent/instrumentation/sequel.rb +1 -1
  42. data/lib/new_relic/agent/instrumentation/typhoeus.rb +3 -3
  43. data/lib/new_relic/agent/javascript_instrumentor.rb +1 -1
  44. data/lib/new_relic/agent/messaging.rb +9 -8
  45. data/lib/new_relic/agent/method_tracer_helpers.rb +2 -2
  46. data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +0 -1
  47. data/lib/new_relic/agent/new_relic_service/marshaller.rb +5 -26
  48. data/lib/new_relic/agent/new_relic_service.rb +69 -25
  49. data/lib/new_relic/agent/span_event_primitive.rb +26 -16
  50. data/lib/new_relic/agent/sql_sampler.rb +3 -3
  51. data/lib/new_relic/agent/stats_engine.rb +2 -2
  52. data/lib/new_relic/agent/synthetics_monitor.rb +1 -2
  53. data/lib/new_relic/agent/system_info.rb +5 -0
  54. data/lib/new_relic/agent/threading/agent_thread.rb +1 -1
  55. data/lib/new_relic/agent/tracer.rb +462 -0
  56. data/lib/new_relic/agent/transaction/abstract_segment.rb +1 -1
  57. data/lib/new_relic/agent/transaction/datastore_segment.rb +0 -2
  58. data/lib/new_relic/agent/transaction/distributed_tracing.rb +1 -2
  59. data/lib/new_relic/agent/transaction/trace_node.rb +4 -2
  60. data/lib/new_relic/agent/transaction/tracing.rb +0 -99
  61. data/lib/new_relic/agent/transaction.rb +43 -88
  62. data/lib/new_relic/agent/transaction_time_aggregator.rb +49 -25
  63. data/lib/new_relic/agent/utilization_data.rb +36 -1
  64. data/lib/new_relic/agent.rb +8 -4
  65. data/lib/new_relic/build.rb +2 -2
  66. data/lib/new_relic/control/frameworks/rails6.rb +14 -0
  67. data/lib/new_relic/latest_changes.rb +2 -2
  68. data/lib/new_relic/rack/agent_middleware.rb +1 -1
  69. data/lib/new_relic/version.rb +2 -2
  70. data/newrelic_rpm.gemspec +2 -9
  71. data/test/agent_helper.rb +2 -2
  72. metadata +13 -39
  73. data/lib/new_relic/agent/transaction_state.rb +0 -186
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b17c73d708623383395fecf3a60a063566a12b59a10d2b18d686deef72f31773
4
- data.tar.gz: f9b9275cf1f9f980175454d8ed5f06a4fa2d173c4edf52e136580c96b2e05eda
3
+ metadata.gz: 61ee707dd3738565b01b05857ed9ae7de00a6ab3e9cc0522ba5d651819c24634
4
+ data.tar.gz: e8b630ad8f1c69a51dae797a046f90bd8d87683dcc4a2fb97f2960dcf6f90b4b
5
5
  SHA512:
6
- metadata.gz: 8cc16f8281e2e00829add33da0ba8053afbfe29e56b9e901c40d40cd44be982df5859492a26041aed7593b687316848113dcc02b646816e2812132bda4a86db5
7
- data.tar.gz: 7eecd067c7606152a08e6485c6f0a642f5e73081812b011f89ba8d2b3fdd74df66ee0686e385d078ec4a4286e396a1ee9206bbc9c2585925596b9b7e90101015
6
+ metadata.gz: 9ee286b42523ceca71287a9463a6e6a66e825f27956fd460c72aacb640780a20db0e5c688951f2d0a4bb648a4d8bd5dad98220d1f5a98e9abcc51843bd71aa1e
7
+ data.tar.gz: 1a5070f668fd0b4f802ee71fe3909c123d0b38a53a1491ec07a496177cf9f392015c95ae62284b086a4fd27952fa0e62a7d720813de09449f5b4b8b8c4331a5e
data/.gitignore CHANGED
@@ -25,4 +25,5 @@ lib/new_relic/build.rb
25
25
  .bundle
26
26
  .yardoc
27
27
  artifacts/
28
+ test/performance/log/
28
29
  test/performance/script/log/
data/.travis.yml CHANGED
@@ -9,9 +9,13 @@ language: ruby
9
9
  sudo: required
10
10
 
11
11
  before_install:
12
- - sudo apt-get update && sudo apt-get install --only-upgrade openssl && sudo apt-get install --only-upgrade libssl-dev
12
+ # RUBY-2072 Prevent Travis setup failure before our test even starts
13
+ - jdk_switcher use oraclejdk8
14
+ - sudo rm -f /etc/apt/sources.list.d/travis_ci_zeromq3.list
13
15
  - gem --version
14
- - gem update --system
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
15
19
  - ./test/script/before_install/gemstash_mirror.sh
16
20
  - bundle --version
17
21
 
@@ -19,7 +23,11 @@ install: bundle install
19
23
 
20
24
  addons:
21
25
  apt:
26
+ update: true
22
27
  packages:
28
+ - openssl
29
+ - libssl-dev
30
+ - build-essential
23
31
  - haveged
24
32
 
25
33
  before_script: ./test/script/before_script/install_mongodb.sh
@@ -39,8 +47,9 @@ notifications:
39
47
 
40
48
  rvm:
41
49
  # Run slowest builds first to try and optimize overall cycle time.
42
- - jruby-9.1.13.0
43
- - 2.5.0
50
+ - jruby-9.2.6.0
51
+ - 2.6.1
52
+ - 2.5.3
44
53
  - 2.4.2
45
54
  - 2.3.5
46
55
  - 2.2.8
@@ -58,11 +67,6 @@ env:
58
67
  - TESTOPTS="-v"
59
68
  - VERBOSE = 1
60
69
  matrix:
61
- # RUBY-1668 rails21, rails22, and rails23 are all excluded below
62
- - TYPE=UNIT ENVIRONMENT=rails21
63
- - TYPE=UNIT ENVIRONMENT=rails22
64
- - TYPE=UNIT ENVIRONMENT=rails23
65
-
66
70
  - TYPE=UNIT ENVIRONMENT=rails30
67
71
  - TYPE=UNIT ENVIRONMENT=rails31
68
72
  - TYPE=UNIT ENVIRONMENT=rails32
@@ -88,31 +92,31 @@ matrix:
88
92
  fast_finish: true
89
93
  exclude:
90
94
  # Unsupported Rails/Ruby combinations
95
+ # 2.6
96
+ - rvm: 2.6.1
97
+ env: TYPE=UNIT ENVIRONMENT=rails30
98
+ - rvm: 2.6.1
99
+ env: TYPE=UNIT ENVIRONMENT=rails31
100
+ - rvm: 2.6.1
101
+ env: TYPE=UNIT ENVIRONMENT=rails32
102
+ - rvm: 2.6.1
103
+ env: TYPE=UNIT ENVIRONMENT=rails40
104
+ - rvm: 2.6.1
105
+ env: TYPE=UNIT ENVIRONMENT=rails41
106
+
91
107
  # 2.5
92
- - rvm: 2.5.0
93
- env: TYPE=UNIT ENVIRONMENT=rails21
94
- - rvm: 2.5.0
95
- env: TYPE=UNIT ENVIRONMENT=rails22
96
- - rvm: 2.5.0
97
- env: TYPE=UNIT ENVIRONMENT=rails23
98
- - rvm: 2.5.0
108
+ - rvm: 2.5.3
99
109
  env: TYPE=UNIT ENVIRONMENT=rails30
100
- - rvm: 2.5.0
110
+ - rvm: 2.5.3
101
111
  env: TYPE=UNIT ENVIRONMENT=rails31
102
- - rvm: 2.5.0
112
+ - rvm: 2.5.3
103
113
  env: TYPE=UNIT ENVIRONMENT=rails32
104
- - rvm: 2.5.0
114
+ - rvm: 2.5.3
105
115
  env: TYPE=UNIT ENVIRONMENT=rails40
106
- - rvm: 2.5.0
116
+ - rvm: 2.5.3
107
117
  env: TYPE=UNIT ENVIRONMENT=rails41
108
118
 
109
119
  # 2.4
110
- - rvm: 2.4.2
111
- env: TYPE=UNIT ENVIRONMENT=rails21
112
- - rvm: 2.4.2
113
- env: TYPE=UNIT ENVIRONMENT=rails22
114
- - rvm: 2.4.2
115
- env: TYPE=UNIT ENVIRONMENT=rails23
116
120
  - rvm: 2.4.2
117
121
  env: TYPE=UNIT ENVIRONMENT=rails30
118
122
  - rvm: 2.4.2
@@ -124,78 +128,26 @@ matrix:
124
128
  - rvm: 2.4.2
125
129
  env: TYPE=UNIT ENVIRONMENT=rails41
126
130
 
127
- # 2.3
128
- - rvm: 2.3.5
129
- env: TYPE=UNIT ENVIRONMENT=rails21
130
- - rvm: 2.3.5
131
- env: TYPE=UNIT ENVIRONMENT=rails22
132
- - rvm: 2.3.5
133
- env: TYPE=UNIT ENVIRONMENT=rails23
134
-
135
- # 2.2
136
- - rvm: 2.2.8
137
- env: TYPE=UNIT ENVIRONMENT=rails21
138
- - rvm: 2.2.8
139
- env: TYPE=UNIT ENVIRONMENT=rails22
140
- - rvm: 2.2.8
141
- env: TYPE=UNIT ENVIRONMENT=rails23
142
-
143
131
  # 2.1
144
- - rvm: 2.1.10
145
- env: TYPE=UNIT ENVIRONMENT=rails21
146
- - rvm: 2.1.10
147
- env: TYPE=UNIT ENVIRONMENT=rails22
148
- - rvm: 2.1.10
149
- env: TYPE=UNIT ENVIRONMENT=rails23
150
132
  - rvm: 2.1.10
151
133
  env: TYPE=UNIT ENVIRONMENT=rails50
152
134
  - rvm: 2.1.10
153
135
  env: TYPE=UNIT ENVIRONMENT=rails51
154
136
 
155
137
  # 2.0
156
- - rvm: 2.0.0-p648
157
- env: TYPE=UNIT ENVIRONMENT=rails21
158
- - rvm: 2.0.0-p648
159
- env: TYPE=UNIT ENVIRONMENT=rails22
160
- - rvm: 2.0.0-p648
161
- env: TYPE=UNIT ENVIRONMENT=rails23
162
138
  - rvm: 2.0.0-p648
163
139
  env: TYPE=UNIT ENVIRONMENT=rails50
164
140
  - rvm: 2.0.0-p648
165
141
  env: TYPE=UNIT ENVIRONMENT=rails51
166
142
 
167
- # jruby 9.0
168
- - rvm: jruby-9.1.13.0
169
- env: TYPE=UNIT ENVIRONMENT=rails21
170
- - rvm: jruby-9.1.13.0
171
- env: TYPE=UNIT ENVIRONMENT=rails22
172
- - rvm: jruby-9.1.13.0
173
- env: TYPE=UNIT ENVIRONMENT=rails23
174
- - rvm: jruby-9.1.13.0
143
+ # jruby 9.2.6.0 (Compatible with MRI 2.5)
144
+ - rvm: jruby-9.2.6.0
175
145
  env: TYPE=UNIT ENVIRONMENT=rails30
176
- - rvm: jruby-9.1.13.0
146
+ - rvm: jruby-9.2.6.0
177
147
  env: TYPE=UNIT ENVIRONMENT=rails31
178
- - rvm: jruby-9.1.13.0
148
+ - rvm: jruby-9.2.6.0
179
149
  env: TYPE=UNIT ENVIRONMENT=rails32
180
-
181
- # Travis (and only Travis) has been throwing difficult-to-reproduce
182
- # errors in various JRuby tests. These appeared after a build image
183
- # update, and they seem to be unrelated to any agent code changes.
184
- # So, we'll allow these specific test runs to fail while we track
185
- # the issue (RUBY-1869).
186
- #
187
- allow_failures:
188
- - rvm: jruby-9.1.13.0
150
+ - rvm: jruby-9.2.6.0
189
151
  env: TYPE=UNIT ENVIRONMENT=rails40
190
- - rvm: jruby-9.1.13.0
152
+ - rvm: jruby-9.2.6.0
191
153
  env: TYPE=UNIT ENVIRONMENT=rails41
192
- - rvm: jruby-9.1.13.0
193
- env: TYPE=UNIT ENVIRONMENT=rails42
194
- - rvm: jruby-9.1.13.0
195
- env: TYPE=UNIT ENVIRONMENT=rails50
196
- - rvm: jruby-9.1.13.0
197
- env: TYPE=UNIT ENVIRONMENT=rails51
198
- - rvm: jruby-9.1.13.0
199
- env: TYPE=UNIT ENVIRONMENT=norails
200
- - rvm: jruby-9.1.13.0
201
- env: TYPE=FUNCTIONAL GROUP=background_2
data/.yardopts CHANGED
@@ -12,6 +12,7 @@ lib/new_relic/agent/stats_engine/metric_stats.rb
12
12
  lib/new_relic/agent/datastores.rb
13
13
  lib/new_relic/agent/messaging.rb
14
14
  lib/new_relic/agent/sql_sampler.rb
15
+ lib/new_relic/agent/tracer.rb
15
16
  lib/new_relic/agent/transaction.rb
16
17
  lib/new_relic/agent/transaction_sampler.rb
17
18
  lib/new_relic/rack/agent_hooks.rb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,154 @@
1
1
  # New Relic Ruby Agent Release Notes #
2
2
 
3
+ ## v6.2.0
4
+
5
+ * Bugfix for superfluous `Empty JSON response` error messages
6
+
7
+ Version 6.1.0 of the agent frequently logged error messages about an empty
8
+ JSON response, when no error had occurred. These logs no longer appear.
9
+
10
+ * Bugfix for `Unable to calculate elapsed transaction time` warning messages
11
+
12
+ Ruby Agent versions 5.4 through 6.1, when running in jruby without
13
+ ObjectSpace enabled, would occasionally log a warning indicating that the
14
+ agent was unable to calculate the elapsed transaction time. When this log
15
+ statement appeared, the affected transactions would not be included in the
16
+ data displayed on the capacity analysis page. These transactions are now
17
+ correctly recorded.
18
+
19
+ ## v6.1.0
20
+
21
+ * Performance monitoring on Kubernetes
22
+
23
+ This release adds Transaction event attributes that provide
24
+ context between your Kubernetes cluster and services. For details
25
+ on the benefits, see this [blog
26
+ post](https://blog.newrelic.com/engineering/monitoring-application-performance-in-kubernetes/).
27
+
28
+ * Bugfix for Bunny instrumentation when popping empty queues
29
+
30
+ When a customer calls `Bunny::Queue#pop` on an empty queue, Bunny
31
+ returns a `nil` value. Previous Ruby Agent versions raised a
32
+ `NoMethodError` when trying to process this result. Now, the
33
+ agent correctly skips processing for `nil` values. Thanks to
34
+ Matt Campbell for the contribution.
35
+
36
+ ## v6.0.0
37
+
38
+ * Tracer API for flexible custom instrumentation
39
+
40
+ With agent version 6.0, we are introducing the `Tracer` class, an
41
+ officially supported public API for more flexible custom
42
+ instrumentation. By calling its `in_transaction` method, you can
43
+ instrument an arbitrary section of Ruby code without needing to
44
+ juggle any explicit state. Behind the scenes, the agent will
45
+ make sure that the measured code results in an APM segment inside
46
+ a transaction.
47
+
48
+ The same API contains additional methods for creating
49
+ transactions and segments, and for interacting with the current
50
+ transaction. For more details, see the [custom instrumentation
51
+ documentation](https://docs.newrelic.com/docs/agents/ruby-agent/api-guides/ruby-custom-instrumentation).
52
+
53
+ If you were previously using any of the agent's private,
54
+ undocumented APIs, such as `Transaction.wrap` or
55
+ `Transaction.start/stop`, you will need to update your code to
56
+ use the Tracer API.
57
+
58
+ The full list of APIs that were removed or deprecated are:
59
+ * `External.start_segment`
60
+ * `Transaction.create_segment`
61
+ * `Transaction.start`
62
+ * `Transaction.stop`
63
+ * `Transaction.start_datastore_segment`
64
+ * `Transaction.start_segment`
65
+ * `Transaction.wrap`
66
+ * `TransactionState.current_transaction`
67
+
68
+ If are you using any of these APIs, please see the [upgrade guide](https://docs.newrelic.com/docs/agents/ruby-agent/troubleshooting/update-private-api-calls-public-tracer-api) for a list of replacements.
69
+
70
+ * Agent detects Rails 6.0
71
+
72
+ The agent properly detects Rails 6.0 and no longer logs an error when
73
+ started in a Rails 6.0 environment. This does not include full Rails 6.0
74
+ support, which will be coming in a future release. Thanks to Jacob Bednarz
75
+ for the contribution.
76
+
77
+ ## v5.7.0
78
+
79
+ * Ruby 2.6 support
80
+
81
+ We have tested the agent with the official release of Ruby 2.6.0
82
+ made on December 25, 2018, and it looks great! Feel free to use
83
+ agent v5.7 to measure the performance of your Ruby 2.6
84
+ applications.
85
+
86
+ * Support for loading Sequel core standalone
87
+
88
+ Earlier versions of the agent required users of the Sequel data
89
+ mapping library to load the _entire_ library. The agent will now
90
+ enable Sequel instrumentation when an application loads Sequel's
91
+ core standalone; i.e., without the `Sequel::Model` class. Thanks
92
+ to Vasily Kolesnikov for the contribution!
93
+
94
+ * Grape 1.2 support
95
+
96
+ With agent versions 5.6 and earlier, Grape 1.2 apps reported
97
+ their transactions under the name `Proc#call` instead of the name
98
+ of the API endpoint. Starting with agent version 5.7, all
99
+ existing versions of Grape will report the correct transaction
100
+ name. Thanks to Masato Ohba for the contribution!
101
+
102
+ ## v5.6.0
103
+
104
+ * Bugfix for transactions with `ActionController::Live`
105
+
106
+ Previously, transactions containing `ActionController::Live` resulted in
107
+ incorrect calculations of capacity analysis as well as error backtraces
108
+ appearing in agent logs in agent versions 5.4 and later. The agent now
109
+ correctly calculates capacity for transactions with `ActionController::Live`.
110
+
111
+ * Add ability to exclude attributes from span events and transaction
112
+ segments
113
+
114
+ Agent versions 5.5 and lower could selectively exclude attributes
115
+ from page views, error traces, transaction traces, and
116
+ transaction events. With agent version 5.6 and higher, you can
117
+ also exclude attributes from span events (via the
118
+ `span_events.include/exclude` options) and from transaction
119
+ segments (via the `transaction_segments.include/exclude` options).
120
+
121
+ As with other attribute destinations, these new options will
122
+ inherit values from the top-level `attributes.include/exclude`
123
+ settings. See the
124
+ [documentation](https://docs.newrelic.com/docs/agents/ruby-agent/attributes/enabling-disabling-attributes-ruby)
125
+ for more information.
126
+
127
+ * Increasing backoff sequence on failing to connect to New Relic
128
+
129
+ If the agent cannot reach New Relic, it will now wait for an
130
+ increasing amount of time after each failed attempt. We are also
131
+ starting with a shorter delay initially, which will help customer
132
+ apps bounce back more quickly from transient network errors.
133
+
134
+ * Truncation of long stack traces
135
+
136
+ Previous versions of the agent would truncate long stack traces to
137
+ 50 frames. To give customers more flexibility, we have added the
138
+ `error_collector.max_backtrace_frames` configuration option.
139
+ Thanks to Patrick Tulskie for the contribution!
140
+
141
+ * Update link in documentation
142
+
143
+ The community forum link in `README.md` now goes to the updated
144
+ location. Thanks to Sam Killgallon for the contribution!
145
+
146
+ * Active Storage instrumentation
147
+
148
+ The agent now provides instrumentation for Active Storage, introduced in
149
+ Rails 5.2. Customers will see Active Storage operations represented as
150
+ segments within transaction traces.
151
+
3
152
  ## v5.5.0
4
153
 
5
154
  * Bugfix for `perform` instrumentation with curb gem
data/README.md CHANGED
@@ -127,7 +127,7 @@ You can find more detailed documentation [on our website](http://newrelic.com/do
127
127
  and specifically in the [Ruby category](http://newrelic.com/docs/ruby).
128
128
 
129
129
  If you can't find what you're looking for there, reach out to us on our [support
130
- site](http://support.newrelic.com/) or our [community forum](http://forum.newrelic.com)
130
+ site](http://support.newrelic.com/) or our [community forum](https://discuss.newrelic.com/)
131
131
  and we'll be happy to help you.
132
132
 
133
133
  Find a bug? Contact us via [support.newrelic.com](http://support.newrelic.com/),
data/config.dot CHANGED
@@ -18,6 +18,7 @@ digraph AgentEnabled {
18
18
  "[error_collector.capture_source]"
19
19
  "[error_collector.enabled]"
20
20
  "[error_collector.ignore_errors]"
21
+ "[error_collector.max_backtrace_frames]"
21
22
  "[browser_monitoring.auto_instrument]"
22
23
  "[license_key]"
23
24
  "[verify_certificate]"
@@ -262,7 +262,7 @@ module NewRelic
262
262
  # should not record sql in the current thread. Returns the
263
263
  # previous value, if there is one
264
264
  def set_record_sql(should_record) #THREAD_LOCAL_ACCESS
265
- state = TransactionState.tl_get
265
+ state = Tracer.state
266
266
  prev = state.record_sql
267
267
  state.record_sql = should_record
268
268
  prev.nil? || prev
@@ -273,13 +273,13 @@ module NewRelic
273
273
  # children of a transaction without affecting the tracing of
274
274
  # the whole transaction
275
275
  def push_trace_execution_flag(should_trace=false) #THREAD_LOCAL_ACCESS
276
- TransactionState.tl_get.push_traced(should_trace)
276
+ Tracer.state.push_traced(should_trace)
277
277
  end
278
278
 
279
279
  # Pop the current trace execution status. Restore trace execution status
280
280
  # to what it was before we pushed the current flag.
281
281
  def pop_trace_execution_flag #THREAD_LOCAL_ACCESS
282
- TransactionState.tl_get.pop_traced
282
+ Tracer.state.pop_traced
283
283
  end
284
284
 
285
285
  # Herein lies the corpse of the former 'start' method. May
@@ -543,7 +543,7 @@ module NewRelic
543
543
  @sql_sampler.reset!
544
544
 
545
545
  if Agent.config[:clear_transaction_state_after_fork]
546
- TransactionState.tl_clear
546
+ Tracer.clear_state
547
547
  end
548
548
  end
549
549
 
@@ -624,7 +624,7 @@ module NewRelic
624
624
  # is the worker thread that gathers data and talks to the
625
625
  # server.
626
626
  def handle_force_disconnect(error)
627
- ::NewRelic::Agent.logger.warn "New Relic forced this agent to disconnect (#{error.message})"
627
+ ::NewRelic::Agent.logger.warn "Agent received a ForceDisconnectException from the server, disconnecting. (#{error.message})"
628
628
  disconnect
629
629
  end
630
630
 
@@ -632,7 +632,7 @@ module NewRelic
632
632
  # it and disconnecting the agent, since we are now in an
633
633
  # unknown state.
634
634
  def handle_other_error(error)
635
- ::NewRelic::Agent.logger.error "Unhandled error in worker thread, disconnecting this agent process:"
635
+ ::NewRelic::Agent.logger.error "Unhandled error in worker thread, disconnecting."
636
636
  # These errors are fatal (that is, they will prevent the agent from
637
637
  # reporting entirely), so we really want backtraces when they happen
638
638
  ::NewRelic::Agent.logger.log_exception(:error, error)
@@ -727,12 +727,14 @@ module NewRelic
727
727
  force || (!connected? && !disconnected?)
728
728
  end
729
729
 
730
- # Retry period is a minute for each failed attempt that
731
- # we've made. This should probably do some sort of sane TCP
732
- # backoff to prevent hammering the server, but a minute for
733
- # each attempt seems to work reasonably well.
730
+ # Per the spec at
731
+ # /agents/agent-specs/Collector-Response-Handling.md, retry
732
+ # connections after a specific backoff sequence to prevent
733
+ # hammering the server.
734
+ CONNECT_RETRY_PERIODS = [15, 15, 30, 60, 120, 300]
735
+
734
736
  def connect_retry_period
735
- [600, connect_attempts * 60].min
737
+ CONNECT_RETRY_PERIODS[connect_attempts] || 300
736
738
  end
737
739
 
738
740
  def note_connect_failure
@@ -1117,6 +1119,8 @@ module NewRelic
1117
1119
  @agent_command_router.check_for_and_handle_agent_commands
1118
1120
  rescue ForceRestartException, ForceDisconnectException
1119
1121
  raise
1122
+ rescue UnrecoverableServerException => e
1123
+ NewRelic::Agent.logger.warn("get_agent_commands message was rejected by remote service, discarding. Error: ", e)
1120
1124
  rescue ServerConnectionException => e
1121
1125
  log_remote_unavailable(:get_agent_commands, e)
1122
1126
  rescue => e