newrelic_rpm 9.0.0 → 9.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (247) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +7 -81
  4. data/.rubocop_todo.yml +4 -43
  5. data/.simplecov +2 -1
  6. data/Brewfile +1 -0
  7. data/CHANGELOG.md +74 -2
  8. data/Gemfile +1 -1
  9. data/Guardfile +8 -7
  10. data/README.md +1 -2
  11. data/Rakefile +8 -8
  12. data/Thorfile +1 -1
  13. data/bin/newrelic +1 -0
  14. data/bin/newrelic_cmd +1 -0
  15. data/bin/nrdebug +20 -20
  16. data/init.rb +1 -1
  17. data/lib/new_relic/agent/agent.rb +3 -16
  18. data/lib/new_relic/agent/agent_helpers/connect.rb +4 -9
  19. data/lib/new_relic/agent/agent_helpers/harvest.rb +4 -4
  20. data/lib/new_relic/agent/agent_helpers/shutdown.rb +5 -5
  21. data/lib/new_relic/agent/agent_helpers/special_startup.rb +2 -2
  22. data/lib/new_relic/agent/agent_helpers/start_worker_thread.rb +47 -39
  23. data/lib/new_relic/agent/agent_helpers/startup.rb +13 -13
  24. data/lib/new_relic/agent/agent_helpers/transmit.rb +6 -6
  25. data/lib/new_relic/agent/agent_logger.rb +9 -9
  26. data/lib/new_relic/agent/attribute_filter.rb +2 -2
  27. data/lib/new_relic/agent/attribute_processing.rb +2 -2
  28. data/lib/new_relic/agent/audit_logger.rb +5 -5
  29. data/lib/new_relic/agent/autostart.rb +1 -1
  30. data/lib/new_relic/agent/commands/agent_command.rb +2 -2
  31. data/lib/new_relic/agent/commands/agent_command_router.rb +5 -4
  32. data/lib/new_relic/agent/commands/thread_profiler_session.rb +5 -5
  33. data/lib/new_relic/agent/configuration/default_source.rb +57 -80
  34. data/lib/new_relic/agent/configuration/environment_source.rb +2 -2
  35. data/lib/new_relic/agent/configuration/high_security_source.rb +3 -3
  36. data/lib/new_relic/agent/configuration/manager.rb +2 -2
  37. data/lib/new_relic/agent/configuration/security_policy_source.rb +10 -10
  38. data/lib/new_relic/agent/configuration/server_source.rb +24 -24
  39. data/lib/new_relic/agent/configuration/yaml_source.rb +4 -4
  40. data/lib/new_relic/agent/connect/request_builder.rb +1 -1
  41. data/lib/new_relic/agent/connect/response_handler.rb +1 -1
  42. data/lib/new_relic/agent/custom_event_aggregator.rb +4 -4
  43. data/lib/new_relic/agent/database/explain_plan_helpers.rb +1 -1
  44. data/lib/new_relic/agent/database/obfuscation_helpers.rb +2 -2
  45. data/lib/new_relic/agent/database/obfuscator.rb +2 -2
  46. data/lib/new_relic/agent/database.rb +4 -4
  47. data/lib/new_relic/agent/datastores/metric_helper.rb +5 -5
  48. data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +11 -11
  49. data/lib/new_relic/agent/datastores/redis.rb +6 -6
  50. data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +7 -8
  51. data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +10 -10
  52. data/lib/new_relic/agent/distributed_tracing/distributed_trace_metrics.rb +7 -7
  53. data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +1 -1
  54. data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +6 -6
  55. data/lib/new_relic/agent/distributed_tracing/trace_context.rb +7 -7
  56. data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +4 -4
  57. data/lib/new_relic/agent/distributed_tracing.rb +5 -5
  58. data/lib/new_relic/agent/error_collector.rb +35 -7
  59. data/lib/new_relic/agent/error_filter.rb +2 -2
  60. data/lib/new_relic/agent/error_trace_aggregator.rb +5 -4
  61. data/lib/new_relic/agent/event_loop.rb +3 -3
  62. data/lib/new_relic/agent/external.rb +1 -1
  63. data/lib/new_relic/agent/harvester.rb +1 -3
  64. data/lib/new_relic/agent/heap.rb +2 -1
  65. data/lib/new_relic/agent/hostname.rb +1 -1
  66. data/lib/new_relic/agent/http_clients/abstract.rb +9 -21
  67. data/lib/new_relic/agent/http_clients/curb_wrappers.rb +7 -3
  68. data/lib/new_relic/agent/http_clients/excon_wrappers.rb +7 -5
  69. data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +4 -0
  70. data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +6 -2
  71. data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +5 -1
  72. data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +8 -5
  73. data/lib/new_relic/agent/http_clients/uri_util.rb +2 -2
  74. data/lib/new_relic/agent/instrumentation/action_controller_other_subscriber.rb +5 -2
  75. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +3 -2
  76. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +3 -3
  77. data/lib/new_relic/agent/instrumentation/active_job.rb +1 -1
  78. data/lib/new_relic/agent/instrumentation/active_merchant.rb +3 -3
  79. data/lib/new_relic/agent/instrumentation/active_record.rb +3 -2
  80. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +38 -35
  81. data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +3 -3
  82. data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +2 -2
  83. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +3 -2
  84. data/lib/new_relic/agent/instrumentation/bunny/chain.rb +1 -1
  85. data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +3 -3
  86. data/lib/new_relic/agent/instrumentation/bunny.rb +1 -1
  87. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +5 -3
  88. data/lib/new_relic/agent/instrumentation/curb/chain.rb +1 -1
  89. data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +5 -5
  90. data/lib/new_relic/agent/instrumentation/curb.rb +1 -1
  91. data/lib/new_relic/agent/instrumentation/custom_events_subscriber.rb +2 -1
  92. data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +1 -0
  93. data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +1 -1
  94. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +2 -1
  95. data/lib/new_relic/agent/instrumentation/elasticsearch/chain.rb +2 -2
  96. data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +4 -3
  97. data/lib/new_relic/agent/instrumentation/elasticsearch.rb +2 -2
  98. data/lib/new_relic/agent/instrumentation/excon/middleware.rb +2 -1
  99. data/lib/new_relic/agent/instrumentation/excon.rb +3 -3
  100. data/lib/new_relic/agent/instrumentation/fiber/chain.rb +1 -1
  101. data/lib/new_relic/agent/instrumentation/fiber.rb +1 -1
  102. data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +4 -4
  103. data/lib/new_relic/agent/instrumentation/grape.rb +3 -3
  104. data/lib/new_relic/agent/instrumentation/grpc/client/chain.rb +1 -1
  105. data/lib/new_relic/agent/instrumentation/grpc/client/instrumentation.rb +3 -2
  106. data/lib/new_relic/agent/instrumentation/grpc/client/prepend.rb +1 -1
  107. data/lib/new_relic/agent/instrumentation/grpc/client/request_wrapper.rb +1 -1
  108. data/lib/new_relic/agent/instrumentation/grpc/server/instrumentation.rb +4 -4
  109. data/lib/new_relic/agent/instrumentation/grpc_client.rb +1 -1
  110. data/lib/new_relic/agent/instrumentation/grpc_server.rb +1 -1
  111. data/lib/new_relic/agent/instrumentation/httprb.rb +1 -1
  112. data/lib/new_relic/agent/instrumentation/ignore_actions.rb +1 -1
  113. data/lib/new_relic/agent/instrumentation/logger.rb +1 -1
  114. data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +3 -1
  115. data/lib/new_relic/agent/instrumentation/memcache/instrumentation.rb +2 -2
  116. data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +3 -1
  117. data/lib/new_relic/agent/instrumentation/memcache.rb +8 -8
  118. data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +3 -3
  119. data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +1 -1
  120. data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +6 -6
  121. data/lib/new_relic/agent/instrumentation/net_http.rb +1 -1
  122. data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +1 -1
  123. data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +3 -3
  124. data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +2 -2
  125. data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +1 -1
  126. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +3 -2
  127. data/lib/new_relic/agent/instrumentation/rails_middleware.rb +1 -1
  128. data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +7 -7
  129. data/lib/new_relic/agent/instrumentation/rake.rb +2 -2
  130. data/lib/new_relic/agent/instrumentation/redis/constants.rb +1 -1
  131. data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +2 -1
  132. data/lib/new_relic/agent/instrumentation/resque/helper.rb +1 -1
  133. data/lib/new_relic/agent/instrumentation/sequel.rb +4 -4
  134. data/lib/new_relic/agent/instrumentation/sequel_helper.rb +10 -10
  135. data/lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb +1 -1
  136. data/lib/new_relic/agent/instrumentation/sidekiq/server.rb +1 -1
  137. data/lib/new_relic/agent/instrumentation/sidekiq.rb +1 -0
  138. data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +1 -1
  139. data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +6 -5
  140. data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +1 -1
  141. data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +2 -1
  142. data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +5 -5
  143. data/lib/new_relic/agent/javascript_instrumentor.rb +29 -24
  144. data/lib/new_relic/agent/linking_metadata.rb +2 -2
  145. data/lib/new_relic/agent/log_event_aggregator.rb +15 -15
  146. data/lib/new_relic/agent/logging.rb +73 -33
  147. data/lib/new_relic/agent/messaging.rb +7 -5
  148. data/lib/new_relic/agent/method_tracer.rb +7 -7
  149. data/lib/new_relic/agent/method_tracer_helpers.rb +1 -1
  150. data/lib/new_relic/agent/monitors/cross_app_monitor.rb +4 -4
  151. data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +1 -1
  152. data/lib/new_relic/agent/new_relic_service/encoders.rb +1 -1
  153. data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +2 -2
  154. data/lib/new_relic/agent/new_relic_service.rb +14 -15
  155. data/lib/new_relic/agent/obfuscator.rb +1 -1
  156. data/lib/new_relic/agent/parameter_filtering.rb +6 -6
  157. data/lib/new_relic/agent/pipe_channel_manager.rb +7 -6
  158. data/lib/new_relic/agent/pipe_service.rb +5 -3
  159. data/lib/new_relic/agent/priority_sampled_buffer.rb +1 -1
  160. data/lib/new_relic/agent/sampler.rb +2 -1
  161. data/lib/new_relic/agent/sampler_collection.rb +1 -1
  162. data/lib/new_relic/agent/samplers/cpu_sampler.rb +5 -5
  163. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +9 -9
  164. data/lib/new_relic/agent/samplers/memory_sampler.rb +9 -9
  165. data/lib/new_relic/agent/samplers/object_sampler.rb +1 -1
  166. data/lib/new_relic/agent/span_event_aggregator.rb +4 -4
  167. data/lib/new_relic/agent/span_event_primitive.rb +2 -2
  168. data/lib/new_relic/agent/sql_sampler.rb +2 -2
  169. data/lib/new_relic/agent/stats.rb +1 -1
  170. data/lib/new_relic/agent/synthetics_event_aggregator.rb +1 -1
  171. data/lib/new_relic/agent/system_info.rb +10 -10
  172. data/lib/new_relic/agent/threading/agent_thread.rb +1 -1
  173. data/lib/new_relic/agent/threading/backtrace_node.rb +3 -3
  174. data/lib/new_relic/agent/threading/backtrace_service.rb +3 -7
  175. data/lib/new_relic/agent/threading/thread_profile.rb +5 -5
  176. data/lib/new_relic/agent/timestamp_sampled_buffer.rb +1 -1
  177. data/lib/new_relic/agent/tracer.rb +8 -7
  178. data/lib/new_relic/agent/transaction/abstract_segment.rb +52 -46
  179. data/lib/new_relic/agent/transaction/datastore_segment.rb +1 -1
  180. data/lib/new_relic/agent/transaction/distributed_tracer.rb +7 -6
  181. data/lib/new_relic/agent/transaction/distributed_tracing.rb +13 -14
  182. data/lib/new_relic/agent/transaction/external_request_segment.rb +11 -11
  183. data/lib/new_relic/agent/transaction/message_broker_segment.rb +1 -1
  184. data/lib/new_relic/agent/transaction/request_attributes.rb +2 -2
  185. data/lib/new_relic/agent/transaction/segment.rb +1 -1
  186. data/lib/new_relic/agent/transaction/synthetics_sample_buffer.rb +1 -1
  187. data/lib/new_relic/agent/transaction/trace.rb +1 -1
  188. data/lib/new_relic/agent/transaction/trace_context.rb +4 -4
  189. data/lib/new_relic/agent/transaction/trace_node.rb +8 -7
  190. data/lib/new_relic/agent/transaction/tracing.rb +2 -2
  191. data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -1
  192. data/lib/new_relic/agent/transaction.rb +39 -36
  193. data/lib/new_relic/agent/transaction_error_primitive.rb +5 -5
  194. data/lib/new_relic/agent/transaction_event_aggregator.rb +4 -4
  195. data/lib/new_relic/agent/transaction_event_primitive.rb +3 -3
  196. data/lib/new_relic/agent/transaction_sampler.rb +3 -3
  197. data/lib/new_relic/agent/transaction_time_aggregator.rb +7 -3
  198. data/lib/new_relic/agent/utilization/aws.rb +1 -1
  199. data/lib/new_relic/agent/utilization/azure.rb +3 -3
  200. data/lib/new_relic/agent/utilization/gcp.rb +3 -3
  201. data/lib/new_relic/agent/utilization/pcf.rb +1 -1
  202. data/lib/new_relic/agent/utilization/vendor.rb +1 -1
  203. data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +1 -1
  204. data/lib/new_relic/agent/vm/mri_vm.rb +9 -8
  205. data/lib/new_relic/agent/worker_loop.rb +1 -1
  206. data/lib/new_relic/agent.rb +78 -16
  207. data/lib/new_relic/cli/command.rb +3 -3
  208. data/lib/new_relic/cli/commands/deployments.rb +26 -25
  209. data/lib/new_relic/cli/commands/install.rb +14 -14
  210. data/lib/new_relic/collection_helper.rb +2 -2
  211. data/lib/new_relic/constants.rb +7 -8
  212. data/lib/new_relic/control/class_methods.rb +3 -3
  213. data/lib/new_relic/control/frameworks/rails.rb +30 -18
  214. data/lib/new_relic/control/instance_methods.rb +5 -5
  215. data/lib/new_relic/control/instrumentation.rb +1 -1
  216. data/lib/new_relic/control/private_instance_methods.rb +1 -1
  217. data/lib/new_relic/dependency_detection.rb +4 -17
  218. data/lib/new_relic/environment_report.rb +4 -4
  219. data/lib/new_relic/helper.rb +2 -1
  220. data/lib/new_relic/language_support.rb +1 -1
  221. data/lib/new_relic/latest_changes.rb +5 -5
  222. data/lib/new_relic/noticed_error.rb +20 -18
  223. data/lib/new_relic/rack/browser_monitoring.rb +20 -16
  224. data/lib/new_relic/recipes/capistrano3.rb +1 -1
  225. data/lib/new_relic/recipes/capistrano_legacy.rb +6 -6
  226. data/lib/new_relic/recipes/helpers/send_deployment.rb +5 -5
  227. data/lib/new_relic/supportability_helper.rb +2 -0
  228. data/lib/new_relic/version.rb +1 -1
  229. data/lib/newrelic_rpm.rb +3 -3
  230. data/lib/sequel/extensions/new_relic_instrumentation.rb +3 -3
  231. data/lib/sequel/plugins/new_relic_instrumentation.rb +1 -1
  232. data/lib/tasks/config.rake +12 -12
  233. data/lib/tasks/coverage_report.rake +4 -4
  234. data/lib/tasks/helpers/format.rb +9 -9
  235. data/lib/tasks/helpers/removers.rb +5 -5
  236. data/lib/tasks/install.rake +4 -4
  237. data/lib/tasks/instrumentation_generator/instrumentation.thor +8 -8
  238. data/lib/tasks/instrumentation_generator/templates/chain.tt +1 -1
  239. data/lib/tasks/instrumentation_generator/templates/dependency_detection.tt +1 -1
  240. data/lib/tasks/multiverse.rb +13 -6
  241. data/lib/tasks/newrelic.rb +1 -0
  242. data/lib/tasks/tests.rake +6 -6
  243. data/newrelic.yml +3 -3
  244. data/newrelic_rpm.gemspec +13 -13
  245. data/test/agent_helper.rb +25 -24
  246. metadata +73 -4
  247. data/lib/new_relic/agent/range_extensions.rb +0 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4283d6fa7224688ad73c78ae5b36f499eb377c96b0511050b588ac2b0884d8e
4
- data.tar.gz: a10eafed3eaef851da18ba4b4bc8b8c3984f2fd4d7291750be84c418ba942132
3
+ metadata.gz: 1eb606235173b437a2991d23d5f23b7715ab8025263f134f11454dcadf0bac9e
4
+ data.tar.gz: 4e468d079bd47f57a7dd2185039dc15f29a139e278b5d133a5a0b08e301f85f0
5
5
  SHA512:
6
- metadata.gz: e680bc7110e8fd9efd9e25ec3559512c74f7f254922a73f80b79cefbef1f5a88d43c6b68cefe4297f64cc430b96e0a561e9980abaa6c7074a51dd8b8f5f13fb0
7
- data.tar.gz: 0530bc3faa79c4259eee31482bf08adeea08966fead73979f65c7c17f0f33293b905c265a125fd69318f0130c48ae61ab5a4071fa9a1be101c0e47bba2b61abd
6
+ metadata.gz: 11835787018b19326041e1f10f8a72befeb8ba9345e793ceb30e4cbd57b6ffa678da13f833fe05f17148b8beb6e9e77f4dc2ab7eda573ecc4aa62060e71ee05b
7
+ data.tar.gz: 1f0e60f9d9aef77edd656a6cc55b7e735cfbaf6a7006ed0724303b52d9cbb71bc740899de335ff45bece28f551bb0053a3077fee65863d5c355666c323150ac0
data/.gitignore CHANGED
@@ -40,3 +40,4 @@ vendor/
40
40
  Brewfile.lock.json
41
41
  .github/actions/simplecov-report/lib/
42
42
  test/minitest/minitest_time_report
43
+ gem_manifest_*.json
data/.rubocop.yml CHANGED
@@ -6,7 +6,7 @@ require:
6
6
  # Default performance configurations: https://github.com/rubocop/rubocop-performance/blob/master/config/default.yml
7
7
  - rubocop-performance
8
8
  # Default rake configurations: https://github.com/rubocop/rubocop-rake/blob/master/config/default.yml
9
- <%= '- rubocop-rake' if RUBY_VERSION >= '2.4.0' %>
9
+ - rubocop-rake
10
10
 
11
11
  AllCops:
12
12
  TargetRubyVersion: 2.7
@@ -66,7 +66,7 @@ Style/RedundantEach: # new in 1.38
66
66
  Enabled: true
67
67
  Style/RedundantInitialize: # new in 1.27
68
68
  Enabled: true
69
- Style/RedundantStringEscape: # new in 1.37
69
+ Style/RedundantStringEscape: # new in 1.37, 'pending' by default so enabled to make sure it's applied
70
70
  Enabled: true
71
71
  Style/YodaExpression: # new in 1.42
72
72
  Enabled: true
@@ -140,7 +140,8 @@ Performance/StringIdentifierArgument: # new in 1.13
140
140
  Enabled: true
141
141
  Performance/StringInclude: # new in 1.7
142
142
  Enabled: true
143
-
143
+ Performance/Sum: # new in 1.8, pending so left enabled explicitly until 2.0
144
+ Enabled: true
144
145
 
145
146
  # Old cops
146
147
 
@@ -238,10 +239,6 @@ Layout/ClosingParenthesisIndentation:
238
239
  Layout/CommentIndentation:
239
240
  Enabled: true
240
241
 
241
- # Disabling for now
242
- Layout/ConditionPosition:
243
- Enabled: false
244
-
245
242
  Layout/DefEndAlignment:
246
243
  Enabled: true
247
244
  EnforcedStyleAlignWith: start_of_line
@@ -260,19 +257,9 @@ Layout/EmptyComment:
260
257
  AllowBorderComment: true
261
258
  AllowMarginComment: true
262
259
 
263
- # Disabling for now
264
- Layout/EmptyLineAfterMagicComment:
265
- Enabled: false
266
-
267
260
  Layout/EmptyLineAfterMultilineCondition:
268
261
  Enabled: false
269
262
 
270
- # Disabling for now
271
- Layout/EmptyLineBetweenDefs:
272
- Enabled: false
273
- # AllowAdjacentOneLineDefs: false
274
- # NumberOfEmptyLines: 1
275
-
276
263
  Layout/EmptyLines:
277
264
  Enabled: true
278
265
 
@@ -361,10 +348,6 @@ Layout/HashAlignment:
361
348
  Layout/HeredocArgumentClosingParenthesis:
362
349
  Enabled: false
363
350
 
364
- # Disabling for now
365
- Layout/HeredocIndentation:
366
- Enabled: false
367
-
368
351
  Layout/IndentationConsistency:
369
352
  Enabled: true
370
353
  EnforcedStyle: normal
@@ -504,11 +487,6 @@ Layout/SpaceBeforeFirstArg:
504
487
  Layout/SpaceBeforeSemicolon:
505
488
  Enabled: true
506
489
 
507
- # Disabling for now
508
- Layout/SpaceInLambdaLiteral:
509
- Enabled: false
510
- # EnforcedStyle: require_no_space
511
-
512
490
  Layout/SpaceInsideArrayLiteralBrackets:
513
491
  Enabled: true
514
492
  EnforcedStyle: no_space
@@ -532,10 +510,6 @@ Layout/SpaceInsideParens:
532
510
  Enabled: true
533
511
  EnforcedStyle: no_space
534
512
 
535
- # Disabling for now
536
- Layout/SpaceInsidePercentLiteralDelimiters:
537
- Enabled: false
538
-
539
513
  Layout/SpaceInsideRangeLiteral:
540
514
  Enabled: true
541
515
 
@@ -562,40 +536,24 @@ Lint/AmbiguousAssignment:
562
536
  Lint/AmbiguousBlockAssociation:
563
537
  Enabled: false
564
538
 
565
- # Disabling for now
566
- Lint/AmbiguousOperator:
567
- Enabled: false
568
-
569
539
  Lint/AmbiguousOperatorPrecedence:
570
540
  Enabled: false
571
541
 
572
542
  Lint/AmbiguousRange:
573
543
  Enabled: false
574
544
 
575
- # Disabling for now
576
- Lint/AmbiguousRegexpLiteral:
577
- Enabled: false
578
-
579
- # Disabling for now
580
545
  Lint/AssignmentInCondition:
581
546
  Enabled: false
582
- # AllowSafeAssignment: true
583
547
 
584
548
  Lint/BigDecimalNew:
585
549
  Enabled: true
586
550
 
587
- # Disabling for now
588
551
  Lint/BinaryOperatorWithIdenticalOperands:
589
552
  Enabled: false
590
553
 
591
- # Disabling for now
592
- Lint/BooleanSymbol:
593
- Enabled: false
594
-
595
554
  Lint/CircularArgumentReference:
596
555
  Enabled: true
597
556
 
598
- # Disabling for now
599
557
  Lint/ConstantDefinitionInBlock:
600
558
  Enabled: false
601
559
 
@@ -605,10 +563,6 @@ Lint/ConstantResolution:
605
563
  Lint/Debugger:
606
564
  Enabled: true
607
565
 
608
- # Disabling for now
609
- Lint/DeprecatedClassMethods:
610
- Enabled: false
611
-
612
566
  Lint/DeprecatedConstants:
613
567
  Enabled: true
614
568
 
@@ -621,20 +575,12 @@ Lint/DisjunctiveAssignmentInConstructor:
621
575
  Lint/DuplicateBranch:
622
576
  Enabled: false
623
577
 
624
- # Disabling for now
625
- Lint/DuplicateCaseCondition:
626
- Enabled: false
627
-
628
578
  Lint/DuplicateElsifCondition:
629
579
  Enabled: true
630
580
 
631
581
  Lint/DuplicateHashKey:
632
582
  Enabled: true
633
583
 
634
- # Disabling for now
635
- Lint/DuplicateMethods:
636
- Enabled: false
637
-
638
584
  Lint/DuplicateRegexpCharacterClassElement:
639
585
  Enabled: true
640
586
 
@@ -659,11 +605,6 @@ Lint/EmptyClass:
659
605
  Lint/EmptyConditionalBody:
660
606
  Enabled: false
661
607
 
662
- # Disabling for now
663
- Lint/EmptyEnsure:
664
- Enabled: false
665
- # AutoCorrect: true
666
-
667
608
  Lint/EmptyExpression:
668
609
  Enabled: true
669
610
 
@@ -680,10 +621,6 @@ Lint/EmptyWhen:
680
621
  Enabled: true
681
622
  AllowComments: true
682
623
 
683
- # Disabling for now
684
- Lint/EnsureReturn:
685
- Enabled: false
686
-
687
624
  Lint/ErbNewArguments:
688
625
  Enabled: true
689
626
 
@@ -1255,9 +1192,6 @@ Style/DocumentationMethod:
1255
1192
  Style/DoubleCopDisableDirective:
1256
1193
  Enabled: false
1257
1194
 
1258
- Style/DoubleNegation:
1259
- Enabled: false
1260
-
1261
1195
  Style/EachForSimpleLoop:
1262
1196
  Enabled: true
1263
1197
 
@@ -1318,6 +1252,9 @@ Style/ExplicitBlockArgument:
1318
1252
  Style/ExponentialNotation:
1319
1253
  Enabled: false
1320
1254
 
1255
+ Style/FetchEnvVar:
1256
+ Enabled: false
1257
+
1321
1258
  Style/FloatDivision:
1322
1259
  Enabled: false
1323
1260
 
@@ -1781,17 +1718,6 @@ Style/StringConcatenation:
1781
1718
  Style/StringHashKeys:
1782
1719
  Enabled: false
1783
1720
 
1784
- # Disabling for now
1785
- Style/StringLiterals:
1786
- Enabled: false
1787
- # EnforcedStyle: double_quotes
1788
- # ConsistentQuotesInMultiline: false
1789
-
1790
- # Disabling for now
1791
- Style/StringLiteralsInInterpolation:
1792
- Enabled: false
1793
- # EnforcedStyle: double_quotes
1794
-
1795
1721
  Style/StringMethods:
1796
1722
  Enabled: false
1797
1723
 
data/.rubocop_todo.yml CHANGED
@@ -9,10 +9,11 @@
9
9
  # Offense count: 422
10
10
  # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
11
11
  Metrics/AbcSize:
12
- Max: 54
12
+ Max: 40
13
13
  Exclude:
14
- - test/**/*
15
14
  - infinite_tracing/test/**/*
15
+ - lib/new_relic/cli/commands/deployments.rb
16
+ - test/**/*
16
17
 
17
18
  # This cop supports safe autocorrection (--autocorrect).
18
19
  Minitest/AssertInDelta:
@@ -36,6 +37,7 @@ Minitest/DuplicateTestRun:
36
37
  Minitest/EmptyLineBeforeAssertionMethods:
37
38
  Exclude:
38
39
  - 'test/new_relic/agent_test.rb'
40
+ - 'test/new_relic/cli/commands/deployments_test.rb'
39
41
 
40
42
  # Offense count: 269
41
43
  Minitest/MultipleAssertions:
@@ -57,44 +59,3 @@ Style/ConcatArrayLiterals:
57
59
  Minitest/RefuteRespondTo:
58
60
  Exclude:
59
61
  - 'test/new_relic/cli/commands/deployments_test.rb'
60
-
61
- Minitest/EmptyLineBeforeAssertionMethods:
62
- Exclude:
63
- - 'test/new_relic/agent_test.rb'
64
- - 'test/new_relic/cli/commands/deployments_test.rb'
65
-
66
- # Offense count: 23
67
- # This cop supports safe autocorrection (--autocorrect).
68
- Performance/RegexpMatch:
69
- Enabled: false
70
-
71
- # Offense count: 1
72
- # This cop supports unsafe autocorrection (--autocorrect-all).
73
- # Configuration parameters: OnlySumOrWithInitialValue.
74
- Performance/Sum:
75
- Exclude:
76
- - 'lib/new_relic/agent/system_info.rb'
77
-
78
- # Offense count: 72
79
- # This cop supports unsafe autocorrection (--autocorrect-all).
80
- Performance/UnfreezeString:
81
- Enabled: false
82
-
83
- # Offense count: 21
84
- # This cop supports safe autocorrection (--autocorrect).
85
- # Configuration parameters: AllowedVars.
86
- Style/FetchEnvVar:
87
- Enabled: false
88
-
89
- # Offense count: 1
90
- # This cop supports safe autocorrection (--autocorrect).
91
- Style/RedundantStringEscape:
92
- Exclude:
93
- - 'test/new_relic/agent/logging_test.rb'
94
-
95
- # Offense count: 115
96
- # This cop supports unsafe autocorrection (--autocorrect-all).
97
- # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
98
- # AllowedMethods: present?, blank?, presence, try, try!
99
- Style/SafeNavigation:
100
- Enabled: false
data/.simplecov CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'securerandom'
3
4
 
4
5
  if ENV['CI']
@@ -10,6 +11,6 @@ end
10
11
  SimpleCov.start do
11
12
  enable_coverage(:branch)
12
13
  SimpleCov.root(File.join(File.dirname(__FILE__), '/lib'))
13
- track_files("**/*.rb")
14
+ track_files('**/*.rb')
14
15
  formatter(SimpleCov::Formatter::SimpleFormatter) if ENV['CI']
15
16
  end
data/Brewfile CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  brew 'elasticsearch'
3
4
  brew 'imagemagick'
4
5
  brew 'memcached'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,77 @@
1
1
  # New Relic Ruby Agent Release Notes
2
2
 
3
+ ## v9.2.0
4
+
5
+ Version 9.2.0 of the agent introduces some performance improvements for working with high numbers of nested actions, and deprecates instrumentation for the `memcached` and `memcache-client` gems (with `dalli` still being supported).
6
+
7
+ - **Feature: Enhance performance for handling high numbers of nested actions**
8
+
9
+ With [Issue#1910](https://github.com/newrelic/newrelic-ruby-agent/issues/1910) community members [@parkerfinch](https://github.com/parkerfinch) and [@travisbell](https://github.com/travisbell) informed us of some CPU spikes and process hangs seen only when using the agent's thread instrumentation, which was enabled by default with v9.0. When thread instrumentation is enabled, instrumented actions taking place within threads are seen and reported on by the agent whereas they would have previously gone unnoticed. This is a great improvement to the agent's usefulness in an async context, and also makes it easier for higher numbers of nested actions to be observed.
10
+ For example, if an instrumented background job framework (Sidekiq, Resque) kicks off a job that the agent notices and then that job in turn performs actions such as database queries that the agent also instruments, nested actions are seen. However, with very high (10,000+) numbers of actions nested within a single instrumented outer action, the agent would struggle to efficiently crunch through all of the collected data at the time when the outer action finished.
11
+ The agent should now be much more efficient when any observed action with lots of nested actions is finished. Our performance testing was conducted with hundreds of thousands of nested actions taking place, and we hope that the benefits of thread tracing can now be enjoyed without any drawbacks. Thanks very much [@parkerfinch](https://github.com/parkerfinch) and [@travisbell](https://github.com/travisbell)! [PR#1927](https://github.com/newrelic/newrelic-ruby-agent/pull/1927)
12
+
13
+ - **Feature: Deprecate memcached and memcache-client instrumentation**
14
+
15
+ Instrumentation for the memcached and memcache-client libraries is deprecated and will be removed during the next major release.
16
+
17
+ ## v9.1.0
18
+
19
+ Version 9.1.0 of the agent delivers support for two new [errors inbox](https://docs.newrelic.com/docs/errors-inbox/errors-inbox/) features: error fingerprinting and user tracking, identifies the Amazon Timestream data store, removes Distributed Tracing warnings from agent logs when using Sidekiq, fixes bugs, and is tested against the recently released JRuby 9.4.2.0.
20
+
21
+ - **Feature: Error fingerprinting - supply your own errors inbox group names**
22
+
23
+ Are your error occurrences grouped poorly? Set your own error fingerprint via a callback function. A new `set_error_group_callback` public API method has been added that will accept a user defined proc. The proc will be invoked for each noticed error and whenever it returns a string, that string will be used as the error group name for the error and will take precedence over any server-side grouping that takes place with the New Relic errors inbox. This gives users much greater control over the grouping of their errors.
24
+
25
+ The customer defined proc will be expected to receive exactly one input argument, a hash. The hash contains the following:
26
+
27
+ | Key | Value |
28
+ | ---------------------| ---------------------------------------------------------------------------- |
29
+ | `:error` | The Ruby error class instance. Offers `#class`, `#message`, and `#backtrace` |
30
+ | `:customAttributes` | Any customer defined custom attributes for the current transaction |
31
+ | `:'request.uri'` | The current request URI if available |
32
+ | `:'http.statusCode'` | The HTTP status code (200, 404, etc.) if available |
33
+ | `:'http.method'` | The HTTP method (GET, PUT, etc.) if available |
34
+ | `:'error.expected'` | Whether (true) or not (false) the error was expected |
35
+ | `:'options'` | The options hash passed to `NewRelic::Agent.notice_error` |
36
+
37
+ The callback only needs to be set once per initialization of the New Relic agent.
38
+
39
+ Example usage:
40
+
41
+ ```
42
+ proc = proc { |hash| "Access" if hash[:'http.statusCode'] == 401 }
43
+ NewRelic::Agent.set_error_group_callback(proc)
44
+ ```
45
+
46
+ - **Feature: User tracking - associate errors with a user id**
47
+
48
+ You can now see the number of users impacted by an error group. Identify the end user with a new `set_user_id` public API method that will accept a string representation of a user id and associate that user id with the current transaction. Transactions and errors will then have a new `enduser.id` agent attribute associated with them. This will allow agent users to tag transactions and errors as belonging to given user ids in support of greater filtering and alerting capabilities.
49
+
50
+ - **Identify Amazon Timestream when the amazon_timestream AR adapter is used**
51
+
52
+ When the agent sees the [activerecord-amazon-timestream-adapter](https://rubygems.org/gems/activerecord-amazon-timestream-adapter) gem being used, it will now identify the data store as "Timestream". Thanks very much to [@wagner](https://github.com/wagner) for contributing this enhancement! [PR#1872](https://github.com/newrelic/newrelic-ruby-agent/pull/1872)
53
+
54
+ - **Bugfix: Remove Distributed Tracing related warnings from agent logs when headers are not present in Sidekiq**
55
+
56
+ Previously, the agent would log a warning to `newrelic_agent.log` every time it attempted to accept empty Distributed Tracing headers from Sidekiq jobs which could result in an excessive number of warnings. Now the agent will no longer create these warnings when using Sidekiq. [PR#1834](https://github.com/newrelic/newrelic-ruby-agent/pull/1834)
57
+
58
+ - **Bugfix: Log request headers in debug-level logs instead of human-readable Objects**
59
+
60
+ Previously, the agent sometimes received children of the `NewRelic::Agent::HTTPClients::AbstractRequest` class as an argument when `NewRelic::Agent::Transaction::DistributedTracers#log_request_headers` was called. This caused debug-level log messages that print the request headers to show human-readable Objects (ex. `#<NewRelic::Agent::HTTPClients::HTTPClientRequest:0x00007fd0dda983e0>`) instead of the request headers. Now, the hash of the request headers should always be logged. [PR#1839](https://github.com/newrelic/newrelic-ruby-agent/pull/1839)
61
+
62
+ - **Bugfix: Fix undefined method `controller_path` logged in Action Controller Instrumentation**
63
+
64
+ Previously, the agent could log an error when trying to determine the metric name in the Action Controller instrumentation if the controller class did not respond to `controller_path`. This has been resolved and the agent will no longer call this method unless the class responds to it. Thank you to [@gsar](https://github.com/gsar) for letting us know about this issue. [PR#1844](https://github.com/newrelic/newrelic-ruby-agent/pull/1844)
65
+
66
+ - **Bugfix: Fix Transaction#finish exception and decrease log level for related warning during async transactions**
67
+
68
+ Previously, the agent would raise a non-fatal error when a segment without a parent was unfinished when the transaction completed. This error was raised while constructing a `warn`-level log message. Now that Thread instrumentation is on by default, this log message emits more frequently and is less concerning. In cases where we see a Thread, Fiber, or concurrent-ruby segment in a transaction, the message will be degraded to a `debug`-level. Thanks to [@NielsKSchjoedt](https://github.com/NielsKSchjoedt) for creating the issue and [@boomer196](https://github.com/boomer196) for testing solutions. [PR#1876](https://github.com/newrelic/newrelic-ruby-agent/pull/1876)
69
+
70
+ - **CI: Target JRuby 9.4.2.0**
71
+
72
+ The agent is now actively being tested against JRuby 9.4.2.0. NOTE that this release does not contain any non-CI related changes for JRuby. Old agent versions are still expected to work with newer JRubies and the newest agent version is still expected to work with older JRubies.
73
+
74
+
3
75
  ## v9.0.0
4
76
 
5
77
  Version 9.0.0 of the agent removes several deprecated configuration options and API methods, enables Thread tracing by default, adds Fiber instrumentation, removes support for Ruby versions 2.2 and 2.3, removes instrumentation for several deprecated gems, changes how the API method `set_transaction_name` works, and updates `rails_defer_initialization` to be an environment variable only configuration option.
@@ -92,8 +164,8 @@
92
164
  - HttpClient: 2.2.0 - 2.8.0
93
165
  - HttpRb: 0.9.9 - 2.2.1
94
166
  - Typhoeus: 0.5.3 - 1.2.x
95
- - Bunny: 2.0.x - 2.6.x
96
- - ActiveMerchant: 1.25.0 - 1.64.x
167
+ - Bunny: 2.0.x - 2.6.x
168
+ - ActiveMerchant: 1.25.0 - 1.64.x
97
169
 
98
170
 
99
171
  - **Updated API method `set_transaction_name`**
data/Gemfile CHANGED
@@ -3,4 +3,4 @@
3
3
  # frozen_string_literal: true
4
4
 
5
5
  source 'https://rubygems.org'
6
- gemspec name: "newrelic_rpm"
6
+ gemspec name: 'newrelic_rpm'
data/Guardfile CHANGED
@@ -1,10 +1,11 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require './test/multiverse/lib/multiverse/bundler_patch'
3
4
 
4
- test_folders = Dir.glob("test/new_relic/*").select { |f| File.directory?(f) }
5
- test_folders += Dir.glob("test/new_relic/**/*").select { |f| File.directory?(f) }
5
+ test_folders = Dir.glob('test/new_relic/*').select { |f| File.directory?(f) }
6
+ test_folders += Dir.glob('test/new_relic/**/*').select { |f| File.directory?(f) }
6
7
 
7
- rake_lib_path = Bundler.with_unbundled_env { `bundle exec gem which rake`.chomp.gsub("lib/rake.rb", "lib") }
8
+ rake_lib_path = Bundler.with_unbundled_env { `bundle exec gem which rake`.chomp.gsub('lib/rake.rb', 'lib') }
8
9
  ruby_options = %(-w -I"#{rake_lib_path}" "#{rake_lib_path}/rake/rake_test_loader.rb")
9
10
 
10
11
  guard_options = {
@@ -17,10 +18,10 @@ guard_options = {
17
18
  guard :minitest, guard_options do
18
19
  watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
19
20
  watch(%r{^test/.+_test\.rb$})
20
- watch(%r{^test/rum/.*}) { "test/new_relic/rack/browser_monitoring_test.rb" }
21
+ watch(%r{^test/rum/.*}) { 'test/new_relic/rack/browser_monitoring_test.rb' }
21
22
  watch(%r{^test/fixtures/cross_agent_tests/distributed_tracing/(.+).json}) { |m| "test/new_relic/agent/distributed_tracing/#{m[1]}_cross_agent_test.rb" }
22
- watch('test/test_helper.rb') { "test/new_relic" }
23
- watch('test/agent_helper.rb') { "test/new_relic" }
24
- watch('lib/new_relic/agent/configuration/default_source.rb') { "test/new_relic/agent/configuration/orphan_configuration_test.rb" }
23
+ watch('test/test_helper.rb') { 'test/new_relic' }
24
+ watch('test/agent_helper.rb') { 'test/new_relic' }
25
+ watch('lib/new_relic/agent/configuration/default_source.rb') { 'test/new_relic/agent/configuration/orphan_configuration_test.rb' }
25
26
  watch(%r{^lib/new_relic/agent/transaction/(.+).rb}) { |m| "test/new_relic/agent/distributed_tracing/#{m[1]}_cross_agent_test.rb" }
26
27
  end
data/README.md CHANGED
@@ -1,5 +1,4 @@
1
- [![Community Plus header](https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Community_Plus.png)](https://opensource.newrelic.com/oss-category/#community-plus)
2
-
1
+ <a href="https://opensource.newrelic.com/oss-category/#community-plus"><picture><source media="(prefers-color-scheme: dark)" srcset="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/dark/Community_Plus.png"><source media="(prefers-color-scheme: light)" srcset="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Community_Plus.png"><img alt="New Relic Open Source community plus project banner." src="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Community_Plus.png"></picture></a>
3
2
 
4
3
  # New Relic Ruby Agent
5
4
 
data/Rakefile CHANGED
@@ -15,11 +15,11 @@ task :default => :test
15
15
  task :test => ['test:newrelic']
16
16
 
17
17
  namespace :test do
18
- desc "Run all tests"
18
+ desc 'Run all tests'
19
19
  task :all => %w[newrelic multiverse all_compatible_envs]
20
20
  agent_home = File.expand_path(File.dirname(__FILE__))
21
21
 
22
- desc "Run agent performance tests"
22
+ desc 'Run agent performance tests'
23
23
  task :performance, [:suite, :name] => [] do |t, args|
24
24
  require File.expand_path(File.join(File.dirname(__FILE__), 'test', 'performance', 'lib', 'performance'))
25
25
  options = {}
@@ -28,13 +28,13 @@ namespace :test do
28
28
  Performance::Runner.new(options).run_and_report
29
29
  end
30
30
 
31
- desc "Run agent within existing mini environment(s): env[name1,name2,name3,etc.]"
31
+ desc 'Run agent within existing mini environment(s): env[name1,name2,name3,etc.]'
32
32
  task :env do |t, args|
33
33
  require File.expand_path(File.join(File.dirname(__FILE__), 'test', 'environments', 'lib', 'environments', 'runner'))
34
34
  Environments::Runner.new(args.to_a).run_and_report
35
35
  end
36
36
 
37
- desc "Run all mini environment tests known to work with the current Ruby version"
37
+ desc 'Run all mini environment tests known to work with the current Ruby version'
38
38
  task :all_compatible_envs do |t, args|
39
39
  require File.expand_path(File.join(File.dirname(__FILE__), 'test', 'helpers', 'ruby_rails_mappings'))
40
40
  rails_versions = rails_versions_for_ruby_version(RUBY_VERSION)
@@ -62,10 +62,10 @@ task :record_build, [:build_number, :stage] do |t, args|
62
62
  build_string = args.build_number
63
63
  build_string << ".#{args.stage}" unless args.stage.nil? || args.stage.empty?
64
64
 
65
- gitsha = File.exist?(".git") ? `git rev-parse HEAD` : "Unknown"
65
+ gitsha = File.exist?('.git') ? `git rev-parse HEAD` : 'Unknown'
66
66
  gitsha.chomp!
67
67
 
68
- File.open("lib/new_relic/build.rb", "w") do |f|
68
+ File.open('lib/new_relic/build.rb', 'w') do |f|
69
69
  f.write("# GITSHA: #{gitsha}\n")
70
70
  f.write("module NewRelic; module VERSION; BUILD='#{build_string}'; end; end\n")
71
71
  end
@@ -93,14 +93,14 @@ task :update_ca_bundle do |t|
93
93
  bundle_last_update = `cd #{ca_bundle_path} && git show -s --format=%ci HEAD`
94
94
  puts "Source CA bundle last updated #{bundle_last_update}"
95
95
 
96
- bundle_path = "cert/cacert.pem"
96
+ bundle_path = 'cert/cacert.pem'
97
97
  cert_paths = []
98
98
  Dir.glob("#{ca_bundle_path}/*.pem").each { |p| cert_paths << p }
99
99
  cert_paths.sort!
100
100
 
101
101
  puts "Writing #{cert_paths.size} certs to bundle at #{bundle_path}..."
102
102
 
103
- File.open(bundle_path, "w") do |f|
103
+ File.open(bundle_path, 'w') do |f|
104
104
  cert_paths.each do |cert_path|
105
105
  cert_name = File.basename(cert_path, '.pem')
106
106
  puts "Adding #{cert_name}"
data/Thorfile CHANGED
@@ -2,4 +2,4 @@
2
2
  # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
3
3
  # frozen_string_literal: true
4
4
 
5
- Dir["./lib/tasks/**/*.thor"].sort.each { |f| load f }
5
+ Dir['./lib/tasks/**/*.thor'].sort.each { |f| load f }
data/bin/newrelic CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
+
3
4
  # executes one of the commands in the new_relic/commands directory
4
5
  # pass the name of the command as an argument
5
6
 
data/bin/newrelic_cmd CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
+
3
4
  # This command has been renamed "newrelic"
4
5
  # executes one of the commands in the new_relic/commands directory
5
6
  # pass the name of the command as an argument
data/bin/nrdebug CHANGED
@@ -96,7 +96,7 @@ class LinuxProcessDataProvider < ProcessDataProvider
96
96
  end
97
97
 
98
98
  def procline
99
- File.read(proc_path('cmdline')).tr("\000", " ")
99
+ File.read(proc_path('cmdline')).tr("\000", ' ')
100
100
  end
101
101
 
102
102
  def environment
@@ -189,7 +189,7 @@ class ProcessReport
189
189
 
190
190
  def open
191
191
  if @path
192
- File.open(@path, "w") do |f|
192
+ File.open(@path, 'w') do |f|
193
193
  yield(f)
194
194
  end
195
195
  else
@@ -216,16 +216,16 @@ class ProcessReport
216
216
 
217
217
  section(f) do
218
218
  c_backtraces, ruby_backtraces = @target.gather_backtraces
219
- if c_backtraces =~ /could not attach/i
220
- fail("Failed to attach to target process. Please try again with sudo.")
219
+ if /could not attach/i.match?(c_backtraces)
220
+ fail('Failed to attach to target process. Please try again with sudo.')
221
221
  end
222
222
 
223
- section(f, "C Backtraces") { c_backtraces }
224
- section(f, "Ruby Backtrace(s)") { ruby_backtraces }
223
+ section(f, 'C Backtraces') { c_backtraces }
224
+ section(f, 'Ruby Backtrace(s)') { ruby_backtraces }
225
225
  end
226
226
 
227
- section(f, "Open files") { @target.open_files }
228
- section(f, "Log") do
227
+ section(f, 'Open files') { @target.open_files }
228
+ section(f, 'Log') do
229
229
  commands = Logger.messages.map { |(_, msg)| msg }
230
230
  commands.join("\n")
231
231
  end
@@ -235,14 +235,14 @@ class ProcessReport
235
235
  private
236
236
 
237
237
  def add_environment_sections(handle)
238
- section(handle, "Time") { Time.now }
239
- section(handle, "PID") { @target.pid }
240
- section(handle, "Command") { @target.procline }
241
- section(handle, "RSS") { @target.rss }
242
- section(handle, "CPU") { @target.cpu }
243
- section(handle, "Parent PID") { @target.ppid }
244
- section(handle, "OS") { ShellWrapper.execute('uname -a') }
245
- section(handle, "Environment") { @target.environment }
238
+ section(handle, 'Time') { Time.now }
239
+ section(handle, 'PID') { @target.pid }
240
+ section(handle, 'Command') { @target.procline }
241
+ section(handle, 'RSS') { @target.rss }
242
+ section(handle, 'CPU') { @target.cpu }
243
+ section(handle, 'Parent PID') { @target.ppid }
244
+ section(handle, 'OS') { ShellWrapper.execute('uname -a') }
245
+ section(handle, 'Environment') { @target.environment }
246
246
  end
247
247
  end
248
248
 
@@ -270,10 +270,10 @@ def prompt_for_confirmation(target_pid, target_cmd)
270
270
  end
271
271
 
272
272
  target_pid = ARGV[0]
273
- fail("Please provide a PID for the target process", :usage => true) unless target_pid
273
+ fail('Please provide a PID for the target process', :usage => true) unless target_pid
274
274
 
275
275
  gdb_path = `which gdb`
276
- fail("Could not find gdb, please ensure it is installed and in your PATH") if gdb_path.empty?
276
+ fail('Could not find gdb, please ensure it is installed and in your PATH') if gdb_path.empty?
277
277
 
278
278
  target = RubyProcess.new(target_pid)
279
279
  if !target.attachable?
@@ -298,5 +298,5 @@ report.generate
298
298
 
299
299
  puts "Generated '#{report_filename}'"
300
300
  puts ''
301
- puts "Please examine the output file for potentially sensitive information and"
302
- puts "remove it before sharing this file with anyone."
301
+ puts 'Please examine the output file for potentially sensitive information and'
302
+ puts 'remove it before sharing this file with anyone.'
data/init.rb CHANGED
@@ -26,5 +26,5 @@ begin
26
26
 
27
27
  NewRelic::Control.instance.init_plugin(:config => current_config)
28
28
  rescue => e
29
- NewRelic::Agent.logger.error("Error initializing New Relic plugin. Agent is disabled.", e)
29
+ NewRelic::Agent.logger.error('Error initializing New Relic plugin. Agent is disabled.', e)
30
30
  end