newrelic_rpm 7.0.0 → 8.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/CHANGELOG.md +226 -0
  4. data/CONTRIBUTING.md +13 -2
  5. data/README.md +5 -1
  6. data/lib/new_relic/agent/adaptive_sampler.rb +2 -2
  7. data/lib/new_relic/agent/agent.rb +8 -7
  8. data/lib/new_relic/agent/commands/thread_profiler_session.rb +7 -3
  9. data/lib/new_relic/agent/configuration/default_source.rb +229 -158
  10. data/lib/new_relic/agent/configuration/event_harvest_config.rb +28 -12
  11. data/lib/new_relic/agent/configuration/manager.rb +1 -2
  12. data/lib/new_relic/agent/configuration/server_source.rb +3 -2
  13. data/lib/new_relic/agent/configuration/yaml_source.rb +22 -1
  14. data/lib/new_relic/agent/connect/request_builder.rb +4 -2
  15. data/lib/new_relic/agent/custom_event_aggregator.rb +2 -1
  16. data/lib/new_relic/agent/database.rb +5 -2
  17. data/lib/new_relic/agent/datastores/mongo.rb +5 -10
  18. data/lib/new_relic/agent/datastores.rb +7 -7
  19. data/lib/new_relic/agent/distributed_tracing/cross_app_payload.rb +5 -5
  20. data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +10 -6
  21. data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +0 -1
  22. data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +1 -1
  23. data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +6 -6
  24. data/lib/new_relic/agent/error_collector.rb +52 -37
  25. data/lib/new_relic/agent/error_filter.rb +175 -0
  26. data/lib/new_relic/agent/event_loop.rb +6 -6
  27. data/lib/new_relic/agent/external.rb +0 -32
  28. data/lib/new_relic/agent/http_clients/abstract.rb +2 -2
  29. data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +7 -1
  30. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +1 -1
  31. data/lib/new_relic/agent/instrumentation/active_merchant.rb +3 -3
  32. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +1 -3
  33. data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +1 -1
  34. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +2 -1
  35. data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +4 -4
  36. data/lib/new_relic/agent/instrumentation/excon.rb +4 -23
  37. data/lib/new_relic/agent/instrumentation/logger/chain.rb +21 -0
  38. data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +59 -0
  39. data/lib/new_relic/agent/instrumentation/logger/prepend.rb +13 -0
  40. data/lib/new_relic/agent/instrumentation/logger.rb +25 -0
  41. data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +5 -1
  42. data/lib/new_relic/agent/instrumentation/memcache/helper.rb +5 -0
  43. data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +8 -2
  44. data/lib/new_relic/agent/instrumentation/mongo.rb +3 -141
  45. data/lib/new_relic/agent/instrumentation/net_http.rb +6 -1
  46. data/lib/new_relic/agent/instrumentation/padrino/chain.rb +23 -19
  47. data/lib/new_relic/agent/instrumentation/padrino/prepend.rb +1 -1
  48. data/lib/new_relic/agent/instrumentation/padrino.rb +4 -2
  49. data/lib/new_relic/agent/instrumentation/queue_time.rb +4 -4
  50. data/lib/new_relic/agent/instrumentation/rack/chain.rb +3 -2
  51. data/lib/new_relic/agent/instrumentation/rack/prepend.rb +2 -1
  52. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +5 -41
  53. data/lib/new_relic/agent/instrumentation/redis.rb +4 -0
  54. data/lib/new_relic/agent/instrumentation/resque/helper.rb +19 -0
  55. data/lib/new_relic/agent/instrumentation/resque/instrumentation.rb +5 -3
  56. data/lib/new_relic/agent/instrumentation/resque.rb +13 -4
  57. data/lib/new_relic/agent/instrumentation/sidekiq.rb +6 -1
  58. data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +8 -2
  59. data/lib/new_relic/agent/instrumentation/tilt/chain.rb +24 -0
  60. data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +41 -0
  61. data/lib/new_relic/agent/instrumentation/tilt/prepend.rb +13 -0
  62. data/lib/new_relic/agent/instrumentation/tilt.rb +25 -0
  63. data/lib/new_relic/agent/javascript_instrumentor.rb +15 -10
  64. data/lib/new_relic/agent/logging.rb +5 -6
  65. data/lib/new_relic/agent/messaging.rb +10 -24
  66. data/lib/new_relic/agent/method_tracer.rb +137 -138
  67. data/lib/new_relic/agent/monitors/cross_app_monitor.rb +8 -1
  68. data/lib/new_relic/agent/new_relic_service.rb +16 -12
  69. data/lib/new_relic/agent/pipe_channel_manager.rb +10 -6
  70. data/lib/new_relic/agent/pipe_service.rb +1 -1
  71. data/lib/new_relic/agent/samplers/cpu_sampler.rb +1 -1
  72. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +9 -6
  73. data/lib/new_relic/agent/span_event_aggregator.rb +2 -2
  74. data/lib/new_relic/agent/sql_sampler.rb +3 -3
  75. data/lib/new_relic/agent/stats_engine/stats_hash.rb +1 -1
  76. data/lib/new_relic/agent/stats_engine.rb +1 -1
  77. data/lib/new_relic/agent/threading/backtrace_service.rb +4 -5
  78. data/lib/new_relic/agent/threading/thread_profile.rb +1 -1
  79. data/lib/new_relic/agent/tracer.rb +15 -37
  80. data/lib/new_relic/agent/transaction/abstract_segment.rb +3 -3
  81. data/lib/new_relic/agent/transaction/datastore_segment.rb +3 -0
  82. data/lib/new_relic/agent/transaction/distributed_tracer.rb +1 -0
  83. data/lib/new_relic/agent/transaction/external_request_segment.rb +3 -0
  84. data/lib/new_relic/agent/transaction/message_broker_segment.rb +5 -11
  85. data/lib/new_relic/agent/transaction/segment.rb +3 -0
  86. data/lib/new_relic/agent/transaction.rb +7 -28
  87. data/lib/new_relic/agent/transaction_time_aggregator.rb +5 -5
  88. data/lib/new_relic/agent/vm/snapshot.rb +1 -1
  89. data/lib/new_relic/agent/worker_loop.rb +5 -5
  90. data/lib/new_relic/agent.rb +10 -7
  91. data/lib/new_relic/cli/commands/deployments.rb +2 -2
  92. data/lib/new_relic/constants.rb +0 -4
  93. data/lib/new_relic/noticed_error.rb +4 -4
  94. data/lib/new_relic/version.rb +2 -2
  95. data/lib/newrelic_rpm.rb +10 -34
  96. data/lib/tasks/all.rb +1 -1
  97. data/lib/tasks/config.html.erb +14 -25
  98. data/lib/tasks/config.rake +8 -7
  99. data/newrelic.yml +580 -3
  100. data/newrelic_rpm.gemspec +1 -1
  101. data/test/agent_helper.rb +27 -2
  102. metadata +13 -11
  103. data/lib/new_relic/agent/datastores/mongo/statement_formatter.rb +0 -53
  104. data/lib/new_relic/agent/instrumentation/excon/connection.rb +0 -49
  105. data/lib/new_relic/agent/instrumentation/merb/controller.rb +0 -44
  106. data/lib/new_relic/agent/instrumentation/merb/errors.rb +0 -33
  107. data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +0 -125
  108. data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +0 -46
  109. data/lib/new_relic/agent/supported_versions.rb +0 -275
  110. 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: 01dec51b68827b0fa9cd58d7882d9ddb29e7de80bcaa55cda486c30ff8529da9
4
- data.tar.gz: 358e73adb1e93b0e12bc7f415df728a4a8670bed0ac4eb36b81df545cc1c4651
3
+ metadata.gz: dee9561e93a6cd3e2ae811234dae75cd65310c394031fcf3ad3091b46185cb6a
4
+ data.tar.gz: 7c017fcfeefe7fcce7ce662bed42cc3258028fb42a36e849cbc0d84231e8c4be
5
5
  SHA512:
6
- metadata.gz: b06d4efcd172c4517ac7be9c7271833cef6709ff18040ceaa81240bf4a3f8ce66f9c609cc78dfffbadc698cc761a2c7e7b439c72d69b024808c10d4b9873180f
7
- data.tar.gz: 6f665d24f019d4e5c55aef8851a48f3fe7ff9735e16c41ba97cc27664fdfc9f66cdbcfd698aebe2072b12c7124431e00f4c08bdb4b15a57350d886ff98745f08
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,5 +1,231 @@
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
+
186
+ ## v7.1.0
187
+
188
+ * **Add support for CSP nonces when using our API to insert the browser agent**
189
+
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.
191
+
192
+ * **Removed MD5 use in the SQL sampler**
193
+
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.
195
+
196
+ * **Enable server-side configuration of distributed tracing**
197
+
198
+ `distributed_tracing.enabled` may now be set in server-side application configuration.
199
+
200
+ * **Bugfix: Fix for missing part of a previous bugfix**
201
+
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.
203
+
204
+ * **Update known conflicts with use of Module#Prepend**
205
+
206
+ 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'.
207
+
208
+ * **Bugfix: Updated support for ActiveRecord 6.1+ instrumentation**
209
+
210
+ Previously, the agent depended on `connection_id` to be present in the Active Support instrumentation for `sql.active_record`
211
+ to get the current ActiveRecord connection. As of Rails 6.1, `connection_id` has been dropped in favor of providing the connection
212
+ object through the `connection` value exclusively. This resulted in datastore spans displaying fallback behavior, including showing
213
+ "ActiveRecord" as the database vendor.
214
+
215
+ * **Bugfix: Updated support for Resque's FORK_PER_JOB option**
216
+
217
+ Support for Resque's FORK_PER_JOB flag within the Ruby agent was incomplete and nonfunctional. The agent should now behave
218
+ correctly when running in a non-forking Resque worker process.
219
+
220
+ * **Bugfix: Added check for ruby2_keywords in add_transaction_tracer**
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.
223
+
224
+ * **Confirmed support for yajl 1.4.0**
225
+
226
+ Thanks to @creaturenex for the contribution! `yajl-ruby` 1.4.0 was added to our test suite and confirmed all tests pass, showing the agent supports this version as well.
227
+
228
+
3
229
  ## v7.0.0
4
230
 
5
231
  * **Ruby Agent 6.x to 7.x Migration Guide Available**
data/CONTRIBUTING.md CHANGED
@@ -6,8 +6,7 @@ development team.
6
6
 
7
7
  When contributing, keep in mind that the agent runs in a wide variety of Ruby
8
8
  language implementations (e.g. 2.x.x, jruby, etc.) as well as a wide variety of
9
- application environments (e.g. Rails, Sinatra, roll-your-own, etc.) See [Ruby agent requirements and supported frameworks]
10
- (https://docs.newrelic.com/docs/agents/ruby-agent/getting-started/ruby-agent-requirements-supported-frameworks)
9
+ application environments (e.g. Rails, Sinatra, roll-your-own, etc.) See [Ruby agent requirements and supported frameworks](https://docs.newrelic.com/docs/agents/ruby-agent/getting-started/ruby-agent-requirements-supported-frameworks)
11
10
  for the current full list.
12
11
 
13
12
  Because of this, we need to be more defensive in our coding practices than most
@@ -85,6 +84,18 @@ release from this repo, use the appropriate tag. New Relic usually pushes beta
85
84
  versions of a release to a working branch before tagging them for General
86
85
  Availability.
87
86
 
87
+ ## Development Environment Setup
88
+
89
+ 1. Fork and clone the repo locally
90
+ - Fork the repository inside GitHub
91
+ - `git clone git@github.com:<gh username>/newrelic-ruby-agent.git`
92
+ 1. Pick a Ruby version
93
+ - Use rbenv or rvm to install any version of Ruby between 2.2 up to 3.0.1
94
+ 1. Install development dependencies
95
+ - `bundle install`
96
+ 1. Check that your env is setup correctly
97
+ - `bundle exec rake`
98
+
88
99
  ## Testing
89
100
 
90
101
  The agent includes a suite of unit and functional tests which should be used to
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)
@@ -17,6 +17,7 @@ require 'new_relic/agent/new_relic_service'
17
17
  require 'new_relic/agent/pipe_service'
18
18
  require 'new_relic/agent/configuration/manager'
19
19
  require 'new_relic/agent/database'
20
+ require 'new_relic/agent/instrumentation/resque/helper'
20
21
  require 'new_relic/agent/commands/agent_command_router'
21
22
  require 'new_relic/agent/event_listener'
22
23
  require 'new_relic/agent/distributed_tracing'
@@ -214,7 +215,7 @@ module NewRelic
214
215
  @connected_pid = Process.pid
215
216
  else
216
217
  ::NewRelic::Agent.logger.debug("Child process #{Process.pid} not reporting to non-connected parent (process #{Process.ppid}).")
217
- @service.shutdown(Time.now)
218
+ @service.shutdown
218
219
  disconnect
219
220
  end
220
221
  end
@@ -470,7 +471,7 @@ module NewRelic
470
471
  # before Resque calls Process.daemon (Jira RUBY-857)
471
472
  def defer_for_resque?
472
473
  NewRelic::Agent.config[:dispatcher] == :resque &&
473
- NewRelic::LanguageSupport.can_fork? &&
474
+ NewRelic::Agent::Instrumentation::Resque::Helper.resque_fork_per_job? &&
474
475
  !PipeChannelManager.listener.started?
475
476
  end
476
477
 
@@ -1122,7 +1123,7 @@ module NewRelic
1122
1123
  end
1123
1124
 
1124
1125
  def transmit_single_data_type(harvest_method, supportability_name)
1125
- now = Time.now
1126
+ now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
1126
1127
 
1127
1128
  msg = "Sending #{supportability_name} data to New Relic Service"
1128
1129
  ::NewRelic::Agent.logger.debug msg
@@ -1131,12 +1132,12 @@ module NewRelic
1131
1132
  self.send(harvest_method)
1132
1133
  end
1133
1134
  ensure
1134
- duration = (Time.now - now).to_f
1135
+ duration = Process.clock_gettime(Process::CLOCK_MONOTONIC) - now
1135
1136
  NewRelic::Agent.record_metric("Supportability/#{supportability_name}Harvest", duration)
1136
1137
  end
1137
1138
 
1138
1139
  def transmit_data
1139
- now = Time.now
1140
+ now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
1140
1141
  ::NewRelic::Agent.logger.debug "Sending data to New Relic Service"
1141
1142
 
1142
1143
  @events.notify(:before_harvest)
@@ -1153,7 +1154,7 @@ module NewRelic
1153
1154
  end
1154
1155
  ensure
1155
1156
  NewRelic::Agent::Database.close_connections
1156
- duration = (Time.now - now).to_f
1157
+ duration = Process.clock_gettime(Process::CLOCK_MONOTONIC) - now
1157
1158
  NewRelic::Agent.record_metric('Supportability/Harvest', duration)
1158
1159
  end
1159
1160
 
@@ -1178,7 +1179,7 @@ module NewRelic
1178
1179
 
1179
1180
  if @connected_pid == $$ && !@service.kind_of?(NewRelic::Agent::NewRelicService)
1180
1181
  ::NewRelic::Agent.logger.debug "Sending New Relic service agent run shutdown message"
1181
- @service.shutdown(Time.now.to_f)
1182
+ @service.shutdown
1182
1183
  else
1183
1184
  ::NewRelic::Agent.logger.debug "This agent connected from parent process #{@connected_pid}--not sending shutdown"
1184
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?