newrelic_rpm 7.1.0 → 8.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/CHANGELOG.md +189 -6
  4. data/README.md +5 -1
  5. data/lib/new_relic/agent/adaptive_sampler.rb +2 -2
  6. data/lib/new_relic/agent/agent.rb +6 -6
  7. data/lib/new_relic/agent/commands/thread_profiler_session.rb +7 -3
  8. data/lib/new_relic/agent/configuration/default_source.rb +86 -15
  9. data/lib/new_relic/agent/configuration/event_harvest_config.rb +28 -12
  10. data/lib/new_relic/agent/configuration/manager.rb +1 -2
  11. data/lib/new_relic/agent/configuration/server_source.rb +3 -2
  12. data/lib/new_relic/agent/configuration/yaml_source.rb +22 -1
  13. data/lib/new_relic/agent/connect/request_builder.rb +4 -2
  14. data/lib/new_relic/agent/custom_event_aggregator.rb +2 -1
  15. data/lib/new_relic/agent/database.rb +5 -2
  16. data/lib/new_relic/agent/datastores/mongo.rb +5 -10
  17. data/lib/new_relic/agent/datastores.rb +7 -7
  18. data/lib/new_relic/agent/distributed_tracing/cross_app_payload.rb +5 -5
  19. data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +10 -6
  20. data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +0 -1
  21. data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +1 -1
  22. data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +6 -6
  23. data/lib/new_relic/agent/error_collector.rb +52 -37
  24. data/lib/new_relic/agent/error_filter.rb +175 -0
  25. data/lib/new_relic/agent/event_loop.rb +6 -6
  26. data/lib/new_relic/agent/external.rb +0 -32
  27. data/lib/new_relic/agent/http_clients/abstract.rb +2 -2
  28. data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +7 -1
  29. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +1 -1
  30. data/lib/new_relic/agent/instrumentation/active_merchant.rb +3 -3
  31. data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +1 -1
  32. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +1 -1
  33. data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +4 -4
  34. data/lib/new_relic/agent/instrumentation/excon.rb +4 -23
  35. data/lib/new_relic/agent/instrumentation/logger/chain.rb +21 -0
  36. data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +59 -0
  37. data/lib/new_relic/agent/instrumentation/logger/prepend.rb +13 -0
  38. data/lib/new_relic/agent/instrumentation/logger.rb +25 -0
  39. data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +5 -1
  40. data/lib/new_relic/agent/instrumentation/memcache/helper.rb +5 -0
  41. data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +8 -2
  42. data/lib/new_relic/agent/instrumentation/mongo.rb +3 -141
  43. data/lib/new_relic/agent/instrumentation/padrino/chain.rb +23 -19
  44. data/lib/new_relic/agent/instrumentation/padrino/prepend.rb +1 -1
  45. data/lib/new_relic/agent/instrumentation/padrino.rb +4 -2
  46. data/lib/new_relic/agent/instrumentation/queue_time.rb +4 -4
  47. data/lib/new_relic/agent/instrumentation/rack/chain.rb +3 -2
  48. data/lib/new_relic/agent/instrumentation/rack/prepend.rb +2 -1
  49. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +5 -41
  50. data/lib/new_relic/agent/instrumentation/resque.rb +2 -2
  51. data/lib/new_relic/agent/instrumentation/sidekiq.rb +6 -1
  52. data/lib/new_relic/agent/instrumentation/tilt/chain.rb +24 -0
  53. data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +41 -0
  54. data/lib/new_relic/agent/instrumentation/tilt/prepend.rb +13 -0
  55. data/lib/new_relic/agent/instrumentation/tilt.rb +25 -0
  56. data/lib/new_relic/agent/javascript_instrumentor.rb +3 -3
  57. data/lib/new_relic/agent/logging.rb +5 -6
  58. data/lib/new_relic/agent/messaging.rb +10 -24
  59. data/lib/new_relic/agent/method_tracer.rb +137 -138
  60. data/lib/new_relic/agent/monitors/cross_app_monitor.rb +8 -1
  61. data/lib/new_relic/agent/new_relic_service.rb +16 -23
  62. data/lib/new_relic/agent/pipe_channel_manager.rb +10 -6
  63. data/lib/new_relic/agent/pipe_service.rb +1 -1
  64. data/lib/new_relic/agent/samplers/cpu_sampler.rb +1 -1
  65. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +9 -6
  66. data/lib/new_relic/agent/span_event_aggregator.rb +2 -2
  67. data/lib/new_relic/agent/sql_sampler.rb +1 -1
  68. data/lib/new_relic/agent/stats_engine/stats_hash.rb +1 -1
  69. data/lib/new_relic/agent/stats_engine.rb +1 -1
  70. data/lib/new_relic/agent/threading/backtrace_service.rb +4 -5
  71. data/lib/new_relic/agent/threading/thread_profile.rb +1 -1
  72. data/lib/new_relic/agent/tracer.rb +15 -37
  73. data/lib/new_relic/agent/transaction/abstract_segment.rb +3 -3
  74. data/lib/new_relic/agent/transaction/datastore_segment.rb +3 -0
  75. data/lib/new_relic/agent/transaction/distributed_tracer.rb +1 -0
  76. data/lib/new_relic/agent/transaction/external_request_segment.rb +3 -0
  77. data/lib/new_relic/agent/transaction/message_broker_segment.rb +5 -11
  78. data/lib/new_relic/agent/transaction/segment.rb +3 -0
  79. data/lib/new_relic/agent/transaction.rb +7 -28
  80. data/lib/new_relic/agent/transaction_time_aggregator.rb +5 -5
  81. data/lib/new_relic/agent/vm/snapshot.rb +1 -1
  82. data/lib/new_relic/agent/worker_loop.rb +5 -5
  83. data/lib/new_relic/agent.rb +6 -5
  84. data/lib/new_relic/cli/commands/deployments.rb +2 -2
  85. data/lib/new_relic/constants.rb +0 -4
  86. data/lib/new_relic/noticed_error.rb +4 -4
  87. data/lib/new_relic/version.rb +2 -2
  88. data/lib/newrelic_rpm.rb +10 -34
  89. data/lib/tasks/all.rb +1 -1
  90. data/newrelic.yml +580 -3
  91. data/newrelic_rpm.gemspec +1 -1
  92. data/test/agent_helper.rb +27 -2
  93. metadata +12 -11
  94. data/lib/new_relic/agent/datastores/mongo/statement_formatter.rb +0 -53
  95. data/lib/new_relic/agent/instrumentation/excon/connection.rb +0 -49
  96. data/lib/new_relic/agent/instrumentation/merb/controller.rb +0 -44
  97. data/lib/new_relic/agent/instrumentation/merb/errors.rb +0 -33
  98. data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +0 -125
  99. data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +0 -46
  100. data/lib/new_relic/agent/supported_versions.rb +0 -275
  101. data/lib/new_relic/control/frameworks/merb.rb +0 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 768b946a5433cf79422bbbc2cda40878a70a6aad22a159e5eb0dcdb351aa9e6d
4
- data.tar.gz: efa504f22c2029103d7ccba6940a47b77d12ef4f1d13fbff2da34d9ba7443c1a
3
+ metadata.gz: dee9561e93a6cd3e2ae811234dae75cd65310c394031fcf3ad3091b46185cb6a
4
+ data.tar.gz: 7c017fcfeefe7fcce7ce662bed42cc3258028fb42a36e849cbc0d84231e8c4be
5
5
  SHA512:
6
- metadata.gz: d982762c9dadd2457e49a6ae480b39ad91d0484de4c8788cc0cb3ab3c677e001c57aa8047daaa0d1010b7a7b2b5b15c74790d60badecd81a3987bc4dc3a3d151
7
- data.tar.gz: '079081d14361839642d5339bf1a2be928cded80310cfd951f43f2d2885c6fb71c3a6a713db6ae9e03e7bcf9e244c4a8cf48d1e132a7ba47f928b4bff974426d6'
6
+ metadata.gz: 7b51ea238bcbaadfc37ed5364556dbb994788a0214dcd4c890ecbf4bb20aac744db0c733e32955da60c60f1e28220f44b8529bdab74d3af613985a5ac6076ab2
7
+ data.tar.gz: d3400acd658bffec6058a3a7f7ac7e2df0a36ee95777bfc44768f839ec7b6c29184c8172b43d3f9f43a211add2c108aa68a3358f7b93d1e9581b19eeb8f37bd3
data/.gitignore CHANGED
@@ -35,3 +35,5 @@ test/fixtures/cross_agent_tests/*/README.md
35
35
  node_modules/
36
36
  yarn.lock
37
37
  errors.txt
38
+ .history/
39
+ vendor/
data/CHANGELOG.md CHANGED
@@ -1,14 +1,197 @@
1
1
  # New Relic Ruby Agent Release Notes #
2
2
 
3
+ ## v8.2.0
4
+
5
+ * **New Instrumentation for Tilt gem**
6
+
7
+ Template rendering using [Tilt](https://github.com/rtomayko/tilt) is now instrumented. See [PR #847](https://github.com/newrelic/newrelic-ruby-agent/pull/847) for details.
8
+
9
+ * **Configuration `error_collector.ignore_errors` is marked as deprecated**
10
+
11
+ This setting has been marked as deprecated in the documentation since version 7.2.0 and is now flagged as deprecated within the code.
12
+
13
+ * **Remove Rails 2 instrumentation**
14
+
15
+ Though any version of Rails 2 has not been supported by the Ruby Agent since v3.18.1.330, instrumentation for ActionController and ActionWebService specific to that version were still part of the agent. This instrumentation has been removed.
16
+
17
+ * **Remove duplicated settings from newrelic.yml**
18
+
19
+ Thank you @jakeonfire for bringing this to our attention and @kuroponzu for making the changes!
20
+
21
+ * **Bugfix: Span Events recorded when using newrelic_ignore**
22
+
23
+ Previously, the agent was incorrectly recording span events only on transactions that should be ignored. This fix will prevent any span events from being created for transactions using newrelic_ignore, or ignored through the `rules.ignore_url_regexes` configuration option.
24
+
25
+ * **Bugfix: Print deprecation warning for Cross-Application Tracing if enabled**
26
+
27
+ Prior to this change, the deprecation warning would log whenever the agent started up, regardless of configuration. Thank you @alpha-san for bringing this to our attention!
28
+
29
+ * **Bugfix: Scrub non-unicode characters from DecoratingLogger**
30
+
31
+ To prevent `JSON::GeneratorErrors`, the DecoratingLogger replaces non-unicode characters with the replacement character: �. Thank you @jdelStrother for bringing this to our attention!
32
+
33
+ * **Bugfix: Distributed tracing headers emitted errors when agent was not connected**
34
+
35
+ Previously, when the agent had not yet connected it would fail to create a trace context payload and emit an error, "TypeError: no implicit conversion of nil into String," to the agent logs. The correct behavior in this situation is to not create these headers due to the lack of required information. Now, the agent will not attempt to create trace context payloads until it has connected. Thank you @Izzette for bringing this to our attention!
36
+
37
+
38
+ ## v8.1.0
39
+
40
+ * **Instrumentation for Ruby standard library Logger**
41
+
42
+ The agent will now automatically instrument Logger, recording number of lines and size of logging output, with breakdown by severity.
43
+
44
+ * **Bugfix for Padrino instrumentation**
45
+
46
+ A bug was introduced to the way the agent installs padrino instrumentation in 7.0.0. This release fixes the issues with the padrino instrumentation. Thanks to @sriedel for bringing this issue to our attention.
47
+
48
+ * **Bugfix: Stop deadlocks between New Relic thread and Delayed Job sampling thread**
49
+
50
+ Running the agent's polling queries for the DelayedJobSampler within the same ActiveRecord connection decreases the frequency of deadlocks in development environments. Thanks @jdelStrother for bringing this to our attention and providing excellent sample code to speed up development!
51
+
52
+ * **Bugfix: Allow Net::HTTP request to IPv6 addresses**
53
+
54
+ The agent will no longer raise an `URI::InvalidURIError` error if an IPv6 address is passed to Net::HTTP. Thank you @tristinbarnett and @tabathadelane for crafting a solution!
55
+
56
+ * **Bugfix: Allow integers to be passed to error_collector.ignore_status_codes configuration**
57
+
58
+ Integers not wrapped in quotation marks can be passed to `error_collector.ignore_status_codes` in the `newrelic.yml` file. Our thanks goes to @elaguerta and @brammerl for resolving this issue!
59
+
60
+ * **Bugfix: Allow add_method_tracer to be used on BasicObjects**
61
+
62
+ Previously, our `add_method_tracer` changes referenced `self.class` which is not available on `BasicObjects`. This has been fixed. Thanks to @toncid for bringing this issue to our attention.
63
+
64
+
65
+ ## v8.0.0
66
+
67
+ * **`add_method_tracer` refactored to use prepend over alias_method chaining**
68
+
69
+ This release overhauls the implementation of `add_method_tracer`, as detailed in [issue #502](https://github.com/newrelic/newrelic-ruby-agent/issues/502). The main breaking updates are as follows:
70
+ - A metric name passed to `add_method_tracer` will no longer be interpolated in an instance context as before. To maintain this behavior, pass a Proc object with the same arity as the method being traced. For example:
71
+ ```ruby
72
+ # OLD
73
+ add_method_tracer :foo, '#{args[0]}.#{args[1]}'
74
+
75
+ # NEW
76
+ add_method_tracer :foo, -> (*args) { "#{args[0]}.#{args[1]}" }
77
+ ```
78
+
79
+ - Similarly, the `:code_header` and `:code_footer` options to `add_method_tracer` will *only* accept a Proc object, which will be bound to the calling instance when the traced method is invoked.
80
+
81
+ - Calling `add_method_tracer` for a method will overwrite any previously defined tracers for that method. To specify multiple metric names for a single method tracer, pass them to `add_method_tracer` as an array.
82
+
83
+ See updated documentation on the following pages for full details:
84
+ - [Ruby Custom Instrumentation: Method Tracers](https://docs.newrelic.com/docs/agents/ruby-agent/api-guides/ruby-custom-instrumentation/#method_tracers)
85
+ - [MethodTracer::ClassMethods#add_method_tracer](https://rubydoc.info/github/newrelic/newrelic-ruby-agent/NewRelic/Agent/MethodTracer/ClassMethods#add_method_tracer-instance_method)
86
+
87
+
88
+ * **Distributed tracing is enabled by default**
89
+
90
+ [Distributed tracing](https://docs.newrelic.com/docs/distributed-tracing/enable-configure/language-agents-enable-distributed-tracing/) tracks and observes service requests as they flow through distributed systems. Distributed tracing is now enabled by default and replaces [cross application tracing](https://docs.newrelic.com/docs/agents/ruby-agent/features/cross-application-tracing-ruby/).
91
+
92
+ * **Bugfix: Incorrectly loading configuration options from newrelic.yml**
93
+
94
+ The agent will now import the configuration options [`error_collector.ignore_messages`](https://docs.newrelic.com/docs/agents/ruby-agent/configuration/ruby-agent-configuration/#error_collector-ignore_messages) and [`error_collector.expected_messages`](https://docs.newrelic.com/docs/agents/ruby-agent/configuration/ruby-agent-configuration/#error_collector-expected_messages) from the `newrelic.yml` file correctly.
95
+
96
+ * **Cross Application is now deprecated, and disabled by default**
97
+
98
+ [Distributed tracing](https://docs.newrelic.com/docs/distributed-tracing/enable-configure/language-agents-enable-distributed-tracing/) is replacing [cross application tracing](https://docs.newrelic.com/docs/agents/ruby-agent/features/cross-application-tracing-ruby/) as the default means of tracing between services. To continue using it, enable it with `cross_application_tracer.enabled: true` and `distributed_tracing.enabled: false`
99
+
100
+ * **Update configuration option default value for `span_events.max_samples_stored` from 1000 to 2000**
101
+
102
+ For more information about this congfiguration option, visit [the Ruby agent documentation](https://docs.newrelic.com/docs/agents/ruby-agent/configuration/ruby-agent-configuration/#span_events-max_samples_stored).
103
+
104
+ * **Agent now enforces server supplied maximum value for configuration option `span_events.max_samples_stored`**
105
+
106
+ Upon connection to the New Relic servers, the agent will now enforce a maximum value allowed for the configuration option [`span_events.max_samples_stored`](https://docs.newrelic.com/docs/agents/ruby-agent/configuration/ruby-agent-configuration/#span_events-max_samples_stored) sent from the New Relic servers.
107
+
108
+ * **Remove Ruby 2.0 required kwarg compatibility checks**
109
+
110
+ Our agent has code that provides compatibility for required keyword arguments in Ruby versions below 2.1. Since the agent now only supports Ruby 2.2+, this code is no longer required.
111
+
112
+ * **Replace Time.now with Process.clock_gettime**
113
+
114
+ Calls to `Time.now` have been replaced with calls to `Process.clock_gettime` to leverage the system's built-in clocks for elapsed time (`Process::CLOCK_MONOTONIC`) and wall-clock time (`Process::CLOCK_REALTIME`). This results in fewer object allocations, more accurate elapsed time records, and enhanced performance. Thanks to @sdemjanenko and @viraptor for advocating for this change!
115
+
116
+ * **Updated generated default newrelic.yml**
117
+
118
+ Thank you @wyhaines and @creaturenex for your contribution. The default newrelic.yml that the agent can generate is now updated with commented out examples of all configuration options.
119
+
120
+ * **Bugfix: Psych 4.0 causes errors when loading newrelic.yml**
121
+
122
+ Psych 4.0 now uses safe load behavior when using `YAML.load` which by default doesn't allow aliases, causing errors when the agent loads the config file. We have updated how we load the config file to avoid these errors.
123
+
124
+ * **Remove support for Excon versions below 0.19.0**
125
+
126
+ Excon versions below 0.19.0 will no longer be instrumented through the Ruby agent.
127
+
128
+ * **Remove support for Mongo versions below 2.1**
129
+
130
+ Mongo versions below 2.1 will no longer be instrumented through the Ruby agent.
131
+
132
+ * **Remove tests for Rails 3.0 and Rails 3.1**
133
+
134
+ As of the 7.0 release, the Ruby agent stopped supporting Rails 3.0 and Rails 3.1. Despite this, we still had tests for these versions running on the agent's CI. Those tests are now removed.
135
+
136
+ * **Update test Gemfiles for patched versions**
137
+
138
+ The gem has individual Gemfiles it uses to test against different common user setups. Rails 5.2, 6.0, and 6.1 have been updated to the latest patch versions in the test Gemfiles. Rack was updated in the Rails61 test suite to 2.1.4 to resolve a security vulnerability.
139
+
140
+ * **Remove Merb Support**
141
+
142
+ This release removes the remaining support for the [Merb](https://weblog.rubyonrails.org/2008/12/23/merb-gets-merged-into-rails-3/) framework. It merged with Rails during the 3.0 release. Now that the Ruby agent supports Rails 3.2 and above, we thought it was time to say goodbye.
143
+
144
+ * **Remove deprecated method External.start_segment**
145
+
146
+ The method `NewRelic::Agent::External.start_segment` has been deprecated as of Ruby Agent 6.0.0. This method is now removed.
147
+
148
+ * **Added testing and support for the following gem versions**
149
+
150
+ - activemerchant 1.121.0
151
+ - bunny 2.19.0
152
+ - excon 0.85.0
153
+ - mongo 2.14.0, 2.15.1
154
+ - padrino 0.15.1
155
+ - resque 2.1.0
156
+ - sequel 5.48.0
157
+ - yajl-ruby 1.4.1
158
+
159
+ * **This version adds support for ARM64/Graviton2 platform using Ruby 3.0.2+**
160
+
161
+
162
+ ## v7.2.0
163
+
164
+ * **Expected Errors and Ignore Errors**
165
+ This release adds support for configuration for expected/ignored errors by class name, status code, and message. The following configuration options are now available:
166
+ - `error_collector.ignore_classes`
167
+ - `error_collector.ignore_messages`
168
+ - `error_collector.ignore_status_codes`
169
+ - `error_collector.expected_classes`
170
+ - `error_collector.expected_messages`
171
+ - `error_collector.expected_status_codes`
172
+ For more details about expected and ignored errors, please see our [configuration documentation](https://docs.newrelic.com/docs/agents/ruby-agent/configuration/)
173
+
174
+ * **Bugfix: resolves "can't add a new key into hash during iteration" Errors**
175
+
176
+ Thanks to @wyhaines for this fix that prevents "can't add a new key into hash during iteration" errors from occuring when iterating over environment data.
177
+
178
+ * **Bugfix: kwarg support fixed for Rack middleware instrumentation**
179
+
180
+ Thanks to @walro for submitting this fix. This fixes the rack instrumentation when using kwargs.
181
+
182
+ * **Update known conflicts with use of Module#Prepend**
183
+
184
+ With our release of v7.0.0, we updated our instrumentation to use Module#Prepend by default, instead of method chaining. We have received reports of conflicts and added a check for these known conflicts. If a known conflict with prepend is detected while using the default value of 'auto' for gem instrumentation, the agent will instead install method chaining instrumentation in order to avoid this conflict. This check can be bypassed by setting the instrumentation method for the gem to 'prepend'.
185
+
3
186
  ## v7.1.0
4
187
 
5
188
  * **Add support for CSP nonces when using our API to insert the browser agent**
6
-
189
+
7
190
  We now support passing in a nonce to our API method `browser_timing_header` to allow the browser agent to run on applications using CSP nonces. This allows users to inject the browser agent themselves and use the nonce required for the script to run. In order to utilize this new feature, you must disable auto instrumentation for the browser agent, and use the API method browser_timing_header to pass the nonce in and inject the script manually.
8
-
191
+
9
192
  * **Removed MD5 use in the SQL sampler**
10
193
 
11
- In order to allow the agent to run in FIPS compliant environments, the usage of MD5 for aggregating slow sql traces has been replaced with SHA1.
194
+ In order to allow the agent to run in FIPS compliant environments, the usage of MD5 for aggregating slow sql traces has been replaced with SHA1.
12
195
 
13
196
  * **Enable server-side configuration of distributed tracing**
14
197
 
@@ -16,7 +199,7 @@
16
199
 
17
200
  * **Bugfix: Fix for missing part of a previous bugfix**
18
201
 
19
- Our previous fix of "nil Middlewares injection now prevented and gracefully handled in Sinatra" released in 7.0.0 was partially overwritten by some of the other changes in that release. This release adds back those missing sections of the bugfix, and should resolve the issue for sinatra users.
202
+ Our previous fix of "nil Middlewares injection now prevented and gracefully handled in Sinatra" released in 7.0.0 was partially overwritten by some of the other changes in that release. This release adds back those missing sections of the bugfix, and should resolve the issue for sinatra users.
20
203
 
21
204
  * **Update known conflicts with use of Module#Prepend**
22
205
 
@@ -35,8 +218,8 @@
35
218
  correctly when running in a non-forking Resque worker process.
36
219
 
37
220
  * **Bugfix: Added check for ruby2_keywords in add_transaction_tracer**
38
-
39
- Thanks @beauraF for the contribution! Previously, the add_transaction_tracer was not updated when we added support for ruby 3. In order to correctly support `**kwargs`, ruby2_keywords was added to correctly update the method signature to use **kwargs in ruby versions that support that.
221
+
222
+ Thanks @beauraF for the contribution! Previously, the add_transaction_tracer was not updated when we added support for ruby 3. In order to correctly support `**kwargs`, ruby2_keywords was added to correctly update the method signature to use **kwargs in ruby versions that support that.
40
223
 
41
224
  * **Confirmed support for yajl 1.4.0**
42
225
 
data/README.md CHANGED
@@ -11,6 +11,8 @@ to help you improve the customer experience and make data-driven business decisi
11
11
  The New Relic Ruby Agent is dual-purposed as a either a Gem or a Rails plugin,
12
12
  hosted on [github](https://github.com/newrelic/newrelic-ruby-agent).
13
13
 
14
+ [![Gem Version](https://badge.fury.io/rb/newrelic_rpm.svg)](https://badge.fury.io/rb/newrelic_rpm)
15
+
14
16
  ## Supported Environments
15
17
 
16
18
  An up-to-date list of Ruby versions and frameworks for the latest agent
@@ -21,6 +23,8 @@ Environments" section below.
21
23
 
22
24
  ## Installing and Using
23
25
 
26
+ The latest released gem for the Ruby Agent can be found at [Rubygems.org](https://rubygems.org/gems/newrelic_rpm)
27
+
24
28
  ### Quick Start
25
29
 
26
30
  #### With Bundler
@@ -131,6 +135,6 @@ The New Relic Ruby agent also uses source code from third-party libraries. Full
131
135
 
132
136
  Thank you, and may your application scale to infinity plus one.
133
137
 
134
- Lew Cirne, Founder and CEO
138
+ Lew Cirne, Founder
135
139
 
136
140
  New Relic, Inc.
@@ -13,7 +13,7 @@ module NewRelic
13
13
  @sampled_count = 0
14
14
  @period_duration = period_duration
15
15
  @first_period = true
16
- @period_start = Time.now.to_f
16
+ @period_start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
17
17
  @lock = Mutex.new
18
18
  register_config_callbacks
19
19
  end
@@ -53,7 +53,7 @@ module NewRelic
53
53
  private
54
54
 
55
55
  def reset_if_period_expired!
56
- now = Time.now.to_f
56
+ now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
57
57
  return unless @period_start + @period_duration <= now
58
58
 
59
59
  elapsed_periods = Integer((now - @period_start) / @period_duration)
@@ -215,7 +215,7 @@ module NewRelic
215
215
  @connected_pid = Process.pid
216
216
  else
217
217
  ::NewRelic::Agent.logger.debug("Child process #{Process.pid} not reporting to non-connected parent (process #{Process.ppid}).")
218
- @service.shutdown(Time.now)
218
+ @service.shutdown
219
219
  disconnect
220
220
  end
221
221
  end
@@ -1123,7 +1123,7 @@ module NewRelic
1123
1123
  end
1124
1124
 
1125
1125
  def transmit_single_data_type(harvest_method, supportability_name)
1126
- now = Time.now
1126
+ now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
1127
1127
 
1128
1128
  msg = "Sending #{supportability_name} data to New Relic Service"
1129
1129
  ::NewRelic::Agent.logger.debug msg
@@ -1132,12 +1132,12 @@ module NewRelic
1132
1132
  self.send(harvest_method)
1133
1133
  end
1134
1134
  ensure
1135
- duration = (Time.now - now).to_f
1135
+ duration = Process.clock_gettime(Process::CLOCK_MONOTONIC) - now
1136
1136
  NewRelic::Agent.record_metric("Supportability/#{supportability_name}Harvest", duration)
1137
1137
  end
1138
1138
 
1139
1139
  def transmit_data
1140
- now = Time.now
1140
+ now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
1141
1141
  ::NewRelic::Agent.logger.debug "Sending data to New Relic Service"
1142
1142
 
1143
1143
  @events.notify(:before_harvest)
@@ -1154,7 +1154,7 @@ module NewRelic
1154
1154
  end
1155
1155
  ensure
1156
1156
  NewRelic::Agent::Database.close_connections
1157
- duration = (Time.now - now).to_f
1157
+ duration = Process.clock_gettime(Process::CLOCK_MONOTONIC) - now
1158
1158
  NewRelic::Agent.record_metric('Supportability/Harvest', duration)
1159
1159
  end
1160
1160
 
@@ -1179,7 +1179,7 @@ module NewRelic
1179
1179
 
1180
1180
  if @connected_pid == $$ && !@service.kind_of?(NewRelic::Agent::NewRelicService)
1181
1181
  ::NewRelic::Agent.logger.debug "Sending New Relic service agent run shutdown message"
1182
- @service.shutdown(Time.now.to_f)
1182
+ @service.shutdown
1183
1183
  else
1184
1184
  ::NewRelic::Agent.logger.debug "This agent connected from parent process #{@connected_pid}--not sending shutdown"
1185
1185
  end
@@ -38,7 +38,7 @@ module NewRelic
38
38
  agent_command.arguments
39
39
  )
40
40
 
41
- @started_at = Time.now
41
+ @started_at = Process.clock_gettime(Process::CLOCK_REALTIME)
42
42
  @duration = profile.duration if profile
43
43
  end
44
44
 
@@ -51,7 +51,9 @@ module NewRelic
51
51
  end
52
52
 
53
53
  def harvest
54
- NewRelic::Agent.logger.debug("Harvesting from Thread Profiler #{@finished_profile.to_log_description unless @finished_profile.nil?}")
54
+ NewRelic::Agent.logger.debug(
55
+ "Harvesting from Thread Profiler #{@finished_profile.to_log_description unless @finished_profile.nil?}"
56
+ )
55
57
  profile = @finished_profile
56
58
  @backtrace_service.profile_agent_code = false
57
59
  @finished_profile = nil
@@ -72,7 +74,9 @@ module NewRelic
72
74
  end
73
75
 
74
76
  def past_time?
75
- @started_at && (Time.now > @started_at + @duration)
77
+ @started_at && (
78
+ Process.clock_gettime(Process::CLOCK_REALTIME) > @started_at + @duration
79
+ )
76
80
  end
77
81
 
78
82
  def stopped?
@@ -39,6 +39,8 @@ module NewRelic
39
39
  end
40
40
  end
41
41
 
42
+ # Marks the config option as deprecated in the documentation once generated.
43
+ # Does not appear in logs.
42
44
  def self.deprecated_description new_setting, description
43
45
  link_ref = new_setting.to_s.gsub(".", "-")
44
46
  %{Please see: [#{new_setting}](docs/agents/ruby-agent/configuration/ruby-agent-configuration##{link_ref}). \n\n#{description}}
@@ -120,7 +122,6 @@ module NewRelic
120
122
  Proc.new {
121
123
  case
122
124
  when defined?(::NewRelic::TEST) then :test
123
- when defined?(::Merb) && defined?(::Merb::Plugins) then :merb
124
125
  when defined?(::Rails::VERSION)
125
126
  case Rails::VERSION::MAJOR
126
127
  when 0..2
@@ -353,7 +354,7 @@ module NewRelic
353
354
  :entity_guid => {
354
355
  :default => nil,
355
356
  :allow_nil => true,
356
- :public => true,
357
+ :public => false,
357
358
  :type => String,
358
359
  :allowed_from_server => true,
359
360
  :description => 'The [Entity GUID](/attribute-dictionary/span/entityguid) for the entity running this agent.'
@@ -534,7 +535,7 @@ module NewRelic
534
535
  :type => Float,
535
536
  :allowed_from_server => true,
536
537
  :deprecated => true,
537
- :description => 'Deprecated. For agent versions 3.5.0 or higher, [set your Apdex T via the New Relic UI](/docs/apm/new-relic-apm/apdex/changing-your-apdex-settings).'
538
+ :description => 'For agent versions 3.5.0 or higher, [set your Apdex T via the New Relic UI](/docs/apm/new-relic-apm/apdex/changing-your-apdex-settings).'
538
539
  },
539
540
  :'strip_exception_messages.enabled' => {
540
541
  :default => value_of(:high_security),
@@ -998,6 +999,22 @@ module NewRelic
998
999
  :allowed_from_server => false,
999
1000
  :description => 'Controls auto-instrumentation of dalli gem for Memcache at start up. May be one of [auto|prepend|chain|disabled].'
1000
1001
  },
1002
+ :'instrumentation.logger' => {
1003
+ :default => "auto",
1004
+ :public => true,
1005
+ :type => String,
1006
+ :dynamic_name => true,
1007
+ :allowed_from_server => false,
1008
+ :description => 'Controls auto-instrumentation of Ruby standard library Logger at start up. May be one of [auto|prepend|chain|disabled].'
1009
+ },
1010
+ :'instrumentation.tilt' => {
1011
+ :default => "auto",
1012
+ :public => true,
1013
+ :type => String,
1014
+ :dynamic_name => true,
1015
+ :allowed_from_server => false,
1016
+ :description => 'Controls auto-instrumentation of Tilt at start up. May be one of [auto|prepend|chain|disabled].'
1017
+ },
1001
1018
  :disable_data_mapper => {
1002
1019
  :default => false,
1003
1020
  :public => true,
@@ -1151,7 +1168,7 @@ module NewRelic
1151
1168
  :type => Boolean,
1152
1169
  :deprecated => true,
1153
1170
  :allowed_from_server => false,
1154
- :description => 'Deprecated; use [`transaction_tracer.attributes.enabled`](#transaction_tracer-attributes-enabled) instead.'
1171
+ :description => 'Use [`transaction_tracer.attributes.enabled`](#transaction_tracer-attributes-enabled) instead.'
1155
1172
  },
1156
1173
  :'transaction_tracer.explain_threshold' => {
1157
1174
  :default => 0.5,
@@ -1194,7 +1211,7 @@ module NewRelic
1194
1211
  :type => Boolean,
1195
1212
  :allowed_from_server => false,
1196
1213
  :deprecated => true,
1197
- :description => 'Deprecated; use [`disable_sequel_instrumentation`](#disable_sequel_instrumentation) instead.'
1214
+ :description => 'Use [`disable_sequel_instrumentation`](#disable_sequel_instrumentation) instead.'
1198
1215
  },
1199
1216
  :disable_mongo => {
1200
1217
  :default => false,
@@ -1290,14 +1307,64 @@ module NewRelic
1290
1307
  :type => Boolean,
1291
1308
  :deprecated => true,
1292
1309
  :allowed_from_server => false,
1293
- :description => 'Deprecated; use [`error_collector.attributes.enabled`](#error_collector-attributes-enabled) instead.'
1310
+ :description => 'Use [`error_collector.attributes.enabled`](#error_collector-attributes-enabled) instead.'
1294
1311
  },
1295
1312
  :'error_collector.ignore_errors' => {
1296
1313
  :default => 'ActionController::RoutingError,Sinatra::NotFound',
1297
1314
  :public => true,
1298
1315
  :type => String,
1316
+ :deprecated => true,
1317
+ :allowed_from_server => true,
1318
+ :dynamic_name => true,
1319
+ :description => 'Use `error_collector.ignore_classes` instead. Specify a comma-delimited list of error classes that the agent should ignore.'
1320
+ },
1321
+ :'error_collector.ignore_classes' => {
1322
+ :default => [],
1323
+ :public => true,
1324
+ :type => Array,
1325
+ :allowed_from_server => true,
1326
+ :dynamic_name => true,
1327
+ :description => 'A list of error classes that the agent should ignore. *Note: this setting cannot be set via environment variable.*'
1328
+ },
1329
+ :'error_collector.ignore_messages' => {
1330
+ :default => {},
1331
+ :public => true,
1332
+ :type => Hash,
1333
+ :allowed_from_server => true,
1334
+ :dynamic_name => true,
1335
+ :description => 'A map of error classes to a list of messages. When an error of one of the classes specified here occurs, if its error message contains one of the strings corresponding to it here, that error will be ignored. *Note: this setting cannot be set via environment variable.*'
1336
+ },
1337
+ :'error_collector.ignore_status_codes' => {
1338
+ :default => '',
1339
+ :public => true,
1340
+ :type => String,
1299
1341
  :allowed_from_server => true,
1300
- :description => 'Specify a comma-delimited list of error classes that the agent should ignore.'
1342
+ :dynamic_name => true,
1343
+ :description => 'A comma separated list of status codes, possibly including ranges. Errors associated with these status codes, where applicable, will be ignored.'
1344
+ },
1345
+ :'error_collector.expected_classes' => {
1346
+ :default => [],
1347
+ :public => true,
1348
+ :type => Array,
1349
+ :allowed_from_server => true,
1350
+ :dynamic_name => true,
1351
+ :description => 'A list of error classes that the agent should treat as expected. *Note: this setting cannot be set via environment variable.*'
1352
+ },
1353
+ :'error_collector.expected_messages' => {
1354
+ :default => {},
1355
+ :public => true,
1356
+ :type => Hash,
1357
+ :allowed_from_server => true,
1358
+ :dynamic_name => true,
1359
+ :description => 'A map of error classes to a list of messages. When an error of one of the classes specified here occurs, if its error message contains one of the strings corresponding to it here, that error will be treated as expected. *Note: this setting cannot be set via environment variable.*'
1360
+ },
1361
+ :'error_collector.expected_status_codes' => {
1362
+ :default => '',
1363
+ :public => true,
1364
+ :type => String,
1365
+ :allowed_from_server => true,
1366
+ :dynamic_name => true,
1367
+ :description => 'A comma separated list of status codes, possibly including ranges. Errors associated with these status codes, where applicable, will be treated as expected.'
1301
1368
  },
1302
1369
  :'error_collector.max_backtrace_frames' => {
1303
1370
  :default => 50,
@@ -1376,7 +1443,7 @@ module NewRelic
1376
1443
  :type => Boolean,
1377
1444
  :deprecated => true,
1378
1445
  :allowed_from_server => false,
1379
- :description => 'Deprecated; use [`browser_monitoring.attributes.enabled`](#browser_monitoring-attributes-enabled) instead.'
1446
+ :description => 'Use [`browser_monitoring.attributes.enabled`](#browser_monitoring-attributes-enabled) instead.'
1380
1447
  },
1381
1448
  :'browser_monitoring.loader' => {
1382
1449
  :default => DefaultSource.browser_monitoring_loader,
@@ -1430,11 +1497,15 @@ module NewRelic
1430
1497
  :description => 'List of trusted New Relic account IDs for the purposes of cross-application tracing. Inbound requests from applications including cross-application headers that do not come from an account in this list will be ignored.'
1431
1498
  },
1432
1499
  :"cross_application_tracer.enabled" => {
1433
- :default => Proc.new { !NewRelic::Agent.config[:'distributed_tracing.enabled'] },
1500
+ :default => false,
1434
1501
  :public => true,
1435
1502
  :type => Boolean,
1436
1503
  :allowed_from_server => true,
1437
- :description => 'If `true`, enables [cross-application tracing](/docs/apm/transactions/cross-application-traces/cross-application-tracing).'
1504
+ :deprecated => true,
1505
+ :description => deprecated_description(
1506
+ :'distributed_tracing-enabled',
1507
+ 'If `true`, enables [cross-application tracing](/docs/agents/ruby-agent/features/cross-application-tracing-ruby/)'
1508
+ )
1438
1509
  },
1439
1510
  :cross_application_tracing => {
1440
1511
  :default => nil,
@@ -1443,7 +1514,7 @@ module NewRelic
1443
1514
  :type => Boolean,
1444
1515
  :allowed_from_server => false,
1445
1516
  :deprecated => true,
1446
- :description => 'Deprecated in favor of cross_application_tracer.enabled'
1517
+ :description => 'Deprecated in favor of distributed_tracing.enabled'
1447
1518
  },
1448
1519
  :encoding_key => {
1449
1520
  :default => '',
@@ -1500,7 +1571,7 @@ module NewRelic
1500
1571
  :type => Boolean,
1501
1572
  :deprecated => true,
1502
1573
  :allowed_from_server => false,
1503
- :description => 'Deprecated; use [`transaction_events.attributes.enabled`](#transaction_events-attributes-enabled) instead.'
1574
+ :description => 'Use [`transaction_events.attributes.enabled`](#transaction_events-attributes-enabled) instead.'
1504
1575
  },
1505
1576
  :restart_thread_in_children => {
1506
1577
  :default => true,
@@ -1743,7 +1814,7 @@ module NewRelic
1743
1814
  :type => Array,
1744
1815
  :allowed_from_server => true,
1745
1816
  :transform => DefaultSource.method(:convert_to_regexp_list),
1746
- :description => 'Define transactions you want the agent to ignore, by specifying a list of patterns matching the URI you want to ignore.'
1817
+ :description => 'Define transactions you want the agent to ignore, by specifying a list of patterns matching the URI you want to ignore.'
1747
1818
  },
1748
1819
  :'synthetics.traces_limit' => {
1749
1820
  :default => 20,
@@ -2078,7 +2149,7 @@ module NewRelic
2078
2149
  :description => 'The primary id associated with this application.'
2079
2150
  },
2080
2151
  :'distributed_tracing.enabled' => {
2081
- :default => false,
2152
+ :default => true,
2082
2153
  :public => true,
2083
2154
  :type => Boolean,
2084
2155
  :allowed_from_server => true,
@@ -2122,7 +2193,7 @@ module NewRelic
2122
2193
  :description => "Sets the maximum number of span events to buffer when streaming to the trace observer."
2123
2194
  },
2124
2195
  :'span_events.max_samples_stored' => {
2125
- :default => 1000,
2196
+ :default => 2000,
2126
2197
  :public => true,
2127
2198
  :type => Integer,
2128
2199
  :allowed_from_server => true,
@@ -13,12 +13,13 @@ module NewRelic
13
13
  :analytic_event_data => :'analytics_events.max_samples_stored',
14
14
  :custom_event_data => :'custom_insights_events.max_samples_stored',
15
15
  :error_event_data => :'error_collector.max_event_samples_stored',
16
- :span_event_data => :'span_events.max_samples_stored'
17
16
  }
18
17
 
19
18
  def from_config(config)
20
- {:harvest_limits => EVENT_HARVEST_CONFIG_KEY_MAPPING.inject({}) do
21
- |connect_payload, (connect_payload_key, config_key)|
19
+ {:harvest_limits =>
20
+ EVENT_HARVEST_CONFIG_KEY_MAPPING.merge(
21
+ :span_event_data => :'span_events.max_samples_stored'
22
+ ).inject({}) do |connect_payload, (connect_payload_key, config_key)|
22
23
  connect_payload[connect_payload_key] = config[config_key]
23
24
  connect_payload
24
25
  end
@@ -27,16 +28,31 @@ module NewRelic
27
28
 
28
29
  def to_config_hash(connect_reply)
29
30
  event_harvest_interval = connect_reply['event_harvest_config']['report_period_ms'] / 1000
30
- config_hash = EVENT_HARVEST_CONFIG_KEY_MAPPING.inject({}) do
31
- |event_harvest_config, (connect_payload_key, config_key)|
32
- if harvest_limit = connect_reply['event_harvest_config']['harvest_limits'][connect_payload_key.to_s]
33
- event_harvest_config[config_key] = harvest_limit
34
- report_period_key = :"event_report_period.#{connect_payload_key}"
35
- event_harvest_config[report_period_key] = event_harvest_interval
36
- end
37
- event_harvest_config
38
- end
31
+ config_hash = transform_event_harvest_config_keys(connect_reply, event_harvest_interval)
39
32
  config_hash[:event_report_period] = event_harvest_interval
33
+ config_hash = transform_span_event_harvest_config(config_hash, connect_reply)
34
+ config_hash
35
+ end
36
+
37
+ private
38
+
39
+ def transform_event_harvest_config_keys(connect_reply, event_harvest_interval)
40
+ EVENT_HARVEST_CONFIG_KEY_MAPPING.inject({}) do |event_harvest_config, (connect_payload_key, config_key)|
41
+ if harvest_limit = connect_reply['event_harvest_config']['harvest_limits'][connect_payload_key.to_s]
42
+ event_harvest_config[config_key] = harvest_limit
43
+ report_period_key = :"event_report_period.#{connect_payload_key}"
44
+ event_harvest_config[report_period_key] = event_harvest_interval
45
+ end
46
+ event_harvest_config
47
+ end
48
+ end
49
+
50
+ def transform_span_event_harvest_config(config_hash, connect_reply)
51
+ if span_harvest = connect_reply['span_event_harvest_config']
52
+ config_hash[:'span_events.max_samples_stored'] = span_harvest['harvest_limit'] if span_harvest['harvest_limit']
53
+ config_hash[:'event_report_period.span_event_data'] = span_harvest['report_period_ms'] if span_harvest['report_period_ms']
54
+ end
55
+
40
56
  config_hash
41
57
  end
42
58
  end