newrelic_rpm 8.16.0 → 9.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (243) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +3 -41
  4. data/.rubocop_todo.yml +13 -14
  5. data/.simplecov +1 -1
  6. data/CHANGELOG.md +184 -0
  7. data/CONTRIBUTING.md +1 -1
  8. data/Gemfile +1 -1
  9. data/Guardfile +7 -7
  10. data/README.md +3 -2
  11. data/Rakefile +8 -8
  12. data/Thorfile +1 -1
  13. data/bin/nrdebug +36 -36
  14. data/init.rb +1 -1
  15. data/lib/new_relic/agent/agent.rb +3 -16
  16. data/lib/new_relic/agent/agent_helpers/connect.rb +5 -10
  17. data/lib/new_relic/agent/agent_helpers/harvest.rb +4 -4
  18. data/lib/new_relic/agent/agent_helpers/shutdown.rb +5 -5
  19. data/lib/new_relic/agent/agent_helpers/special_startup.rb +3 -4
  20. data/lib/new_relic/agent/agent_helpers/start_worker_thread.rb +47 -39
  21. data/lib/new_relic/agent/agent_helpers/startup.rb +13 -13
  22. data/lib/new_relic/agent/agent_helpers/transmit.rb +6 -6
  23. data/lib/new_relic/agent/agent_logger.rb +9 -9
  24. data/lib/new_relic/agent/attribute_filter.rb +2 -4
  25. data/lib/new_relic/agent/attribute_processing.rb +2 -2
  26. data/lib/new_relic/agent/audit_logger.rb +5 -5
  27. data/lib/new_relic/agent/autostart.rb +1 -1
  28. data/lib/new_relic/agent/commands/agent_command.rb +2 -2
  29. data/lib/new_relic/agent/commands/agent_command_router.rb +5 -4
  30. data/lib/new_relic/agent/commands/thread_profiler_session.rb +8 -8
  31. data/lib/new_relic/agent/configuration/default_source.rb +155 -530
  32. data/lib/new_relic/agent/configuration/environment_source.rb +2 -2
  33. data/lib/new_relic/agent/configuration/high_security_source.rb +3 -5
  34. data/lib/new_relic/agent/configuration/manager.rb +2 -2
  35. data/lib/new_relic/agent/configuration/security_policy_source.rb +10 -26
  36. data/lib/new_relic/agent/configuration/server_source.rb +24 -24
  37. data/lib/new_relic/agent/configuration/yaml_source.rb +4 -4
  38. data/lib/new_relic/agent/connect/request_builder.rb +1 -1
  39. data/lib/new_relic/agent/connect/response_handler.rb +1 -1
  40. data/lib/new_relic/agent/custom_event_aggregator.rb +4 -4
  41. data/lib/new_relic/agent/database/explain_plan_helpers.rb +1 -1
  42. data/lib/new_relic/agent/database/obfuscation_helpers.rb +2 -2
  43. data/lib/new_relic/agent/database/obfuscator.rb +2 -2
  44. data/lib/new_relic/agent/database.rb +4 -18
  45. data/lib/new_relic/agent/datastores/metric_helper.rb +5 -5
  46. data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +11 -11
  47. data/lib/new_relic/agent/datastores/redis.rb +6 -6
  48. data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +8 -10
  49. data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +10 -10
  50. data/lib/new_relic/agent/distributed_tracing/distributed_trace_metrics.rb +7 -7
  51. data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +1 -1
  52. data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +6 -6
  53. data/lib/new_relic/agent/distributed_tracing/trace_context.rb +7 -7
  54. data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +4 -4
  55. data/lib/new_relic/agent/distributed_tracing.rb +5 -5
  56. data/lib/new_relic/agent/error_collector.rb +36 -8
  57. data/lib/new_relic/agent/error_filter.rb +5 -5
  58. data/lib/new_relic/agent/error_trace_aggregator.rb +5 -4
  59. data/lib/new_relic/agent/event_loop.rb +3 -3
  60. data/lib/new_relic/agent/external.rb +1 -1
  61. data/lib/new_relic/agent/harvester.rb +1 -3
  62. data/lib/new_relic/agent/heap.rb +2 -1
  63. data/lib/new_relic/agent/hostname.rb +1 -1
  64. data/lib/new_relic/agent/http_clients/abstract.rb +9 -21
  65. data/lib/new_relic/agent/http_clients/curb_wrappers.rb +7 -3
  66. data/lib/new_relic/agent/http_clients/excon_wrappers.rb +7 -5
  67. data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +4 -0
  68. data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +6 -2
  69. data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +5 -1
  70. data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +8 -5
  71. data/lib/new_relic/agent/http_clients/uri_util.rb +2 -2
  72. data/lib/new_relic/agent/instrumentation/action_controller_other_subscriber.rb +5 -2
  73. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +3 -2
  74. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +3 -3
  75. data/lib/new_relic/agent/instrumentation/active_job.rb +2 -2
  76. data/lib/new_relic/agent/instrumentation/active_record.rb +3 -2
  77. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +38 -35
  78. data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +3 -3
  79. data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +2 -2
  80. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +3 -2
  81. data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +3 -3
  82. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +6 -4
  83. data/lib/new_relic/agent/instrumentation/curb/chain.rb +1 -1
  84. data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +5 -5
  85. data/lib/new_relic/agent/instrumentation/curb.rb +1 -1
  86. data/lib/new_relic/agent/instrumentation/custom_events_subscriber.rb +2 -1
  87. data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +1 -1
  88. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +2 -1
  89. data/lib/new_relic/agent/instrumentation/elasticsearch/chain.rb +1 -1
  90. data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +3 -3
  91. data/lib/new_relic/agent/instrumentation/elasticsearch.rb +1 -1
  92. data/lib/new_relic/agent/instrumentation/excon/middleware.rb +2 -1
  93. data/lib/new_relic/agent/instrumentation/excon.rb +3 -3
  94. data/lib/new_relic/agent/instrumentation/fiber/chain.rb +20 -0
  95. data/lib/new_relic/agent/instrumentation/fiber/instrumentation.rb +24 -0
  96. data/lib/new_relic/agent/instrumentation/fiber/prepend.rb +18 -0
  97. data/lib/new_relic/agent/instrumentation/fiber.rb +25 -0
  98. data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +4 -4
  99. data/lib/new_relic/agent/instrumentation/grape.rb +4 -4
  100. data/lib/new_relic/agent/instrumentation/grpc/client/instrumentation.rb +2 -1
  101. data/lib/new_relic/agent/instrumentation/grpc/server/instrumentation.rb +3 -3
  102. data/lib/new_relic/agent/instrumentation/httprb.rb +1 -1
  103. data/lib/new_relic/agent/instrumentation/ignore_actions.rb +1 -1
  104. data/lib/new_relic/agent/instrumentation/logger.rb +1 -1
  105. data/lib/new_relic/agent/instrumentation/memcache/instrumentation.rb +2 -2
  106. data/lib/new_relic/agent/instrumentation/memcache.rb +8 -8
  107. data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +3 -3
  108. data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +1 -1
  109. data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +5 -5
  110. data/lib/new_relic/agent/instrumentation/net_http.rb +2 -2
  111. data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +1 -1
  112. data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +3 -3
  113. data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +2 -2
  114. data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +1 -1
  115. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +3 -2
  116. data/lib/new_relic/agent/instrumentation/rails_middleware.rb +1 -1
  117. data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +8 -15
  118. data/lib/new_relic/agent/instrumentation/rake.rb +3 -3
  119. data/lib/new_relic/agent/instrumentation/redis/constants.rb +1 -1
  120. data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +2 -1
  121. data/lib/new_relic/agent/instrumentation/redis.rb +1 -1
  122. data/lib/new_relic/agent/instrumentation/resque/helper.rb +1 -1
  123. data/lib/new_relic/agent/instrumentation/resque.rb +1 -1
  124. data/lib/new_relic/agent/instrumentation/sequel.rb +8 -9
  125. data/lib/new_relic/agent/instrumentation/sequel_helper.rb +10 -10
  126. data/lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb +1 -1
  127. data/lib/new_relic/agent/instrumentation/sidekiq/server.rb +1 -1
  128. data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +1 -1
  129. data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +6 -5
  130. data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +1 -1
  131. data/lib/new_relic/agent/instrumentation/thread/instrumentation.rb +3 -7
  132. data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +2 -1
  133. data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +5 -5
  134. data/lib/new_relic/agent/javascript_instrumentor.rb +29 -24
  135. data/lib/new_relic/agent/linking_metadata.rb +2 -2
  136. data/lib/new_relic/agent/log_event_aggregator.rb +15 -15
  137. data/lib/new_relic/agent/logging.rb +73 -33
  138. data/lib/new_relic/agent/messaging.rb +7 -5
  139. data/lib/new_relic/agent/method_tracer.rb +6 -6
  140. data/lib/new_relic/agent/method_tracer_helpers.rb +1 -1
  141. data/lib/new_relic/agent/monitors/cross_app_monitor.rb +4 -5
  142. data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +1 -1
  143. data/lib/new_relic/agent/new_relic_service/encoders.rb +1 -1
  144. data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +2 -2
  145. data/lib/new_relic/agent/new_relic_service/security_policy_settings.rb +0 -1
  146. data/lib/new_relic/agent/new_relic_service.rb +15 -15
  147. data/lib/new_relic/agent/obfuscator.rb +1 -1
  148. data/lib/new_relic/agent/parameter_filtering.rb +6 -6
  149. data/lib/new_relic/agent/pipe_channel_manager.rb +7 -6
  150. data/lib/new_relic/agent/pipe_service.rb +5 -3
  151. data/lib/new_relic/agent/priority_sampled_buffer.rb +1 -1
  152. data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +0 -1
  153. data/lib/new_relic/agent/sampler.rb +1 -1
  154. data/lib/new_relic/agent/sampler_collection.rb +1 -1
  155. data/lib/new_relic/agent/samplers/cpu_sampler.rb +5 -5
  156. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +9 -9
  157. data/lib/new_relic/agent/samplers/memory_sampler.rb +9 -9
  158. data/lib/new_relic/agent/samplers/object_sampler.rb +1 -1
  159. data/lib/new_relic/agent/span_event_aggregator.rb +4 -4
  160. data/lib/new_relic/agent/span_event_primitive.rb +2 -2
  161. data/lib/new_relic/agent/sql_sampler.rb +2 -2
  162. data/lib/new_relic/agent/stats.rb +1 -1
  163. data/lib/new_relic/agent/synthetics_event_aggregator.rb +1 -1
  164. data/lib/new_relic/agent/system_info.rb +10 -10
  165. data/lib/new_relic/agent/threading/agent_thread.rb +1 -1
  166. data/lib/new_relic/agent/threading/backtrace_node.rb +3 -3
  167. data/lib/new_relic/agent/threading/backtrace_service.rb +3 -7
  168. data/lib/new_relic/agent/threading/thread_profile.rb +5 -5
  169. data/lib/new_relic/agent/timestamp_sampled_buffer.rb +1 -1
  170. data/lib/new_relic/agent/tracer.rb +18 -8
  171. data/lib/new_relic/agent/transaction/abstract_segment.rb +9 -9
  172. data/lib/new_relic/agent/transaction/datastore_segment.rb +1 -1
  173. data/lib/new_relic/agent/transaction/distributed_tracer.rb +7 -6
  174. data/lib/new_relic/agent/transaction/distributed_tracing.rb +6 -6
  175. data/lib/new_relic/agent/transaction/external_request_segment.rb +11 -11
  176. data/lib/new_relic/agent/transaction/message_broker_segment.rb +1 -1
  177. data/lib/new_relic/agent/transaction/request_attributes.rb +2 -2
  178. data/lib/new_relic/agent/transaction/segment.rb +1 -1
  179. data/lib/new_relic/agent/transaction/synthetics_sample_buffer.rb +1 -1
  180. data/lib/new_relic/agent/transaction/trace.rb +1 -1
  181. data/lib/new_relic/agent/transaction/trace_context.rb +4 -4
  182. data/lib/new_relic/agent/transaction/trace_node.rb +8 -7
  183. data/lib/new_relic/agent/transaction/tracing.rb +4 -4
  184. data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -1
  185. data/lib/new_relic/agent/transaction.rb +56 -52
  186. data/lib/new_relic/agent/transaction_error_primitive.rb +5 -5
  187. data/lib/new_relic/agent/transaction_event_aggregator.rb +4 -4
  188. data/lib/new_relic/agent/transaction_event_primitive.rb +3 -3
  189. data/lib/new_relic/agent/transaction_sampler.rb +3 -3
  190. data/lib/new_relic/agent/transaction_time_aggregator.rb +7 -3
  191. data/lib/new_relic/agent/utilization/aws.rb +1 -1
  192. data/lib/new_relic/agent/utilization/azure.rb +3 -3
  193. data/lib/new_relic/agent/utilization/gcp.rb +3 -3
  194. data/lib/new_relic/agent/utilization/pcf.rb +1 -1
  195. data/lib/new_relic/agent/utilization/vendor.rb +1 -1
  196. data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +1 -1
  197. data/lib/new_relic/agent/vm/mri_vm.rb +9 -8
  198. data/lib/new_relic/agent/worker_loop.rb +1 -1
  199. data/lib/new_relic/agent.rb +79 -35
  200. data/lib/new_relic/cli/command.rb +3 -3
  201. data/lib/new_relic/cli/commands/deployments.rb +26 -25
  202. data/lib/new_relic/cli/commands/install.rb +23 -23
  203. data/lib/new_relic/collection_helper.rb +2 -2
  204. data/lib/new_relic/constants.rb +7 -8
  205. data/lib/new_relic/control/class_methods.rb +3 -3
  206. data/lib/new_relic/control/frameworks/rails.rb +30 -18
  207. data/lib/new_relic/control/instance_methods.rb +6 -6
  208. data/lib/new_relic/control/instrumentation.rb +1 -1
  209. data/lib/new_relic/control/private_instance_methods.rb +1 -1
  210. data/lib/new_relic/dependency_detection.rb +4 -17
  211. data/lib/new_relic/environment_report.rb +4 -4
  212. data/lib/new_relic/helper.rb +2 -1
  213. data/lib/new_relic/language_support.rb +1 -1
  214. data/lib/new_relic/latest_changes.rb +5 -5
  215. data/lib/new_relic/local_environment.rb +0 -10
  216. data/lib/new_relic/noticed_error.rb +20 -18
  217. data/lib/new_relic/rack/browser_monitoring.rb +20 -16
  218. data/lib/new_relic/recipes/capistrano3.rb +1 -1
  219. data/lib/new_relic/recipes/capistrano_legacy.rb +6 -6
  220. data/lib/new_relic/recipes/helpers/send_deployment.rb +5 -5
  221. data/lib/new_relic/supportability_helper.rb +2 -1
  222. data/lib/new_relic/version.rb +2 -2
  223. data/lib/newrelic_rpm.rb +4 -4
  224. data/lib/sequel/extensions/{newrelic_instrumentation.rb → new_relic_instrumentation.rb} +5 -5
  225. data/lib/sequel/plugins/{newrelic_instrumentation.rb → new_relic_instrumentation.rb} +4 -4
  226. data/lib/tasks/config.rake +12 -12
  227. data/lib/tasks/coverage_report.rake +3 -3
  228. data/lib/tasks/helpers/format.rb +10 -10
  229. data/lib/tasks/helpers/removers.rb +5 -5
  230. data/lib/tasks/install.rake +4 -4
  231. data/lib/tasks/instrumentation_generator/instrumentation.thor +7 -10
  232. data/lib/tasks/instrumentation_generator/templates/Envfile.tt +1 -1
  233. data/lib/tasks/multiverse.rb +12 -6
  234. data/lib/tasks/tests.rake +6 -6
  235. data/newrelic.yml +5 -8
  236. data/newrelic_rpm.gemspec +29 -26
  237. data/test/agent_helper.rb +25 -24
  238. metadata +13 -14
  239. data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +0 -83
  240. data/lib/new_relic/agent/instrumentation/authlogic.rb +0 -33
  241. data/lib/new_relic/agent/instrumentation/data_mapper.rb +0 -215
  242. data/lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb +0 -36
  243. data/lib/new_relic/agent/instrumentation/sunspot.rb +0 -41
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36c4100794a9189b995fb7c649be61e3770b1e47ea5c961624c6519bea637770
4
- data.tar.gz: bd4cf6f4a56bdad905768d3306ab26649c8ff9564619ec0b4099db63043bc1f9
3
+ metadata.gz: 86b089be72e8fdf6af07082365c42ecfcbc6cc0c88df45cbac8238dca375af9c
4
+ data.tar.gz: e41f270e6d423755657678a0211cab7cb2a294d7f514d486b447b4c09c650fd7
5
5
  SHA512:
6
- metadata.gz: 9a97a4611de30a1d96ea4afb7b24220dd86f289761fb17cac531acbaeb09ed55be183127a78fbb7c5dac153f68305d6f8e87164be7fe0ab97ef3faf5e42ce2d5
7
- data.tar.gz: 8a5e4c91f9c89ba0e3317984865127ad30b9746b469f67246c9da20257ed4a2851d0148f191b19288655aec642d79edbcd71d98f0cd2ebe60c7c7e95e8696336
6
+ metadata.gz: f58684a973dd62ac5fb9b50309fd9ffc71ad2d14d2120902c8de8a3c1647abc99c376caeec6955708c5bbbc6989c687b753684523e02a0624dccc0a894285380
7
+ data.tar.gz: 4e6e538da76646d35f55af94bc037603cf3bb643396a21304ddc887d56d02802cd36a50aaaeafad03ea4c1f579248710919eff2e458b78d610c5820e219d8f34
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
@@ -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
 
@@ -1081,18 +1082,6 @@ Performance/MapCompact:
1081
1082
  Performance/MethodObjectAsBlock:
1082
1083
  Enabled: false
1083
1084
 
1084
- # TODO: OLD RUBIES - Requires 2.4
1085
- Performance/RegexpMatch:
1086
- Enabled: false
1087
-
1088
- # TODO: OLD RUBIES - Requires 2.4
1089
- Performance/Sum:
1090
- Enabled: false
1091
-
1092
- # TODO: OLD RUBIES - Requires 2.3
1093
- Performance/UnfreezeString:
1094
- Enabled: false
1095
-
1096
1085
  # Disabling for now
1097
1086
  Security/Eval:
1098
1087
  Enabled: false
@@ -1267,9 +1256,6 @@ Style/DocumentationMethod:
1267
1256
  Style/DoubleCopDisableDirective:
1268
1257
  Enabled: false
1269
1258
 
1270
- Style/DoubleNegation:
1271
- Enabled: false
1272
-
1273
1259
  Style/EachForSimpleLoop:
1274
1260
  Enabled: true
1275
1261
 
@@ -1330,8 +1316,6 @@ Style/ExplicitBlockArgument:
1330
1316
  Style/ExponentialNotation:
1331
1317
  Enabled: false
1332
1318
 
1333
- # TODO: MAJOR VERSION - Re-enable FetchEnvVar after dropping support for Ruby 2.2
1334
- # Ruby 2.3+ allows for ENV.fetch('KEY') { default }
1335
1319
  Style/FetchEnvVar:
1336
1320
  Enabled: false
1337
1321
 
@@ -1740,17 +1724,6 @@ Style/RescueStandardError:
1740
1724
  Style/ReturnNil:
1741
1725
  Enabled: false
1742
1726
 
1743
- # Can't use, not available in Ruby 2.2
1744
- Style/SafeNavigation:
1745
- Enabled: false
1746
- # ConvertCodeThatCanStartToReturnNil: false
1747
- # AllowedMethods:
1748
- # - present?
1749
- # - blank?
1750
- # - presence
1751
- # - try
1752
- # - try!
1753
-
1754
1727
  Style/Sample:
1755
1728
  Enabled: true
1756
1729
 
@@ -1809,17 +1782,6 @@ Style/StringConcatenation:
1809
1782
  Style/StringHashKeys:
1810
1783
  Enabled: false
1811
1784
 
1812
- # Disabling for now
1813
- Style/StringLiterals:
1814
- Enabled: false
1815
- # EnforcedStyle: double_quotes
1816
- # ConsistentQuotesInMultiline: false
1817
-
1818
- # Disabling for now
1819
- Style/StringLiteralsInInterpolation:
1820
- Enabled: false
1821
- # EnforcedStyle: double_quotes
1822
-
1823
1785
  Style/StringMethods:
1824
1786
  Enabled: false
1825
1787
 
data/.rubocop_todo.yml CHANGED
@@ -1,18 +1,19 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2022-10-03 22:57:47 UTC using RuboCop version 1.36.0.
3
+ # on 2023-02-02 15:27:55 UTC using RuboCop version 1.44.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 412
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:
@@ -31,7 +32,14 @@ Minitest/DuplicateTestRun:
31
32
  - 'test/multiverse/suites/rails/error_tracing_test.rb'
32
33
  - 'test/multiverse/suites/sinatra/ignoring_test.rb'
33
34
 
34
- # Offense count: 263
35
+ # Offense count: 1
36
+ # This cop supports safe autocorrection (--autocorrect).
37
+ Minitest/EmptyLineBeforeAssertionMethods:
38
+ Exclude:
39
+ - 'test/new_relic/agent_test.rb'
40
+ - 'test/new_relic/cli/commands/deployments_test.rb'
41
+
42
+ # Offense count: 269
35
43
  Minitest/MultipleAssertions:
36
44
  Max: 28
37
45
 
@@ -51,12 +59,3 @@ Style/ConcatArrayLiterals:
51
59
  Minitest/RefuteRespondTo:
52
60
  Exclude:
53
61
  - 'test/new_relic/cli/commands/deployments_test.rb'
54
-
55
- Minitest/EmptyLineBeforeAssertionMethods:
56
- Exclude:
57
- - 'test/new_relic/agent_test.rb'
58
- - 'test/new_relic/cli/commands/deployments_test.rb'
59
-
60
- Style/RedundantStringEscape:
61
- Exclude:
62
- - 'test/new_relic/agent/logging_test.rb'
data/.simplecov CHANGED
@@ -10,6 +10,6 @@ end
10
10
  SimpleCov.start do
11
11
  enable_coverage(:branch)
12
12
  SimpleCov.root(File.join(File.dirname(__FILE__), '/lib'))
13
- track_files("**/*.rb")
13
+ track_files('**/*.rb')
14
14
  formatter(SimpleCov::Formatter::SimpleFormatter) if ENV['CI']
15
15
  end
data/CHANGELOG.md CHANGED
@@ -1,5 +1,189 @@
1
1
  # New Relic Ruby Agent Release Notes
2
2
 
3
+ ## v9.1.0
4
+
5
+ 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.
6
+
7
+ - **Feature: Error fingerprinting - supply your own errors inbox group names**
8
+
9
+ 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.
10
+
11
+ The customer defined proc will be expected to receive exactly one input argument, a hash. The hash contains the following:
12
+
13
+ | Key | Value |
14
+ | ---------------------| ---------------------------------------------------------------------------- |
15
+ | `:error` | The Ruby error class instance. Offers `#class`, `#message`, and `#backtrace` |
16
+ | `:customAttributes` | Any customer defined custom attributes for the current transaction |
17
+ | `:'request.uri'` | The current request URI if available |
18
+ | `:'http.statusCode'` | The HTTP status code (200, 404, etc.) if available |
19
+ | `:'http.method'` | The HTTP method (GET, PUT, etc.) if available |
20
+ | `:'error.expected'` | Whether (true) or not (false) the error was expected |
21
+ | `:'options'` | The options hash passed to `NewRelic::Agent.notice_error` |
22
+
23
+ The callback only needs to be set once per initialization of the New Relic agent.
24
+
25
+ Example usage:
26
+
27
+ ```
28
+ proc = proc { |hash| "Access" if hash[:'http.statusCode'] == 401 }
29
+ NewRelic::Agent.set_error_group_callback(proc)
30
+ ```
31
+
32
+ - **Feature: User tracking - associate errors with a user id**
33
+
34
+ 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.
35
+
36
+ - **Identify Amazon Timestream when the amazon_timestream AR adapter is used**
37
+
38
+ 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)
39
+
40
+ - **Bugfix: Remove Distributed Tracing related warnings from agent logs when headers are not present in Sidekiq**
41
+
42
+ 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)
43
+
44
+ - **Bugfix: Log request headers in debug-level logs instead of human-readable Objects**
45
+
46
+ 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)
47
+
48
+ - **Bugfix: Fix undefined method `controller_path` logged in Action Controller Instrumentation**
49
+
50
+ 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)
51
+
52
+ - **Bugfix: Fix Transaction#finish exception and decrease log level for related warning during async transactions**
53
+
54
+ 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)
55
+
56
+ - **CI: Target JRuby 9.4.2.0**
57
+
58
+ 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.
59
+
60
+
61
+ ## v9.0.0
62
+
63
+ 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.
64
+
65
+
66
+ - **Remove deprecated configuration options**
67
+
68
+ The following configuration options have been removed and will no longer work. Please update all configs to use the replacements listed below. [PR#1782](https://github.com/newrelic/newrelic-ruby-agent/pull/1782)
69
+
70
+ | Removed | Replacement | `newrelic.yml` example |
71
+ | ----------------------------------------- | ----------------------------------------- | ----------------------------------------------------------------------------------- |
72
+ | `analytics_events.capture_attributes` | `transaction_events.attributes.enabled` | `transaction_events.attributes.enabled: false` |
73
+ | `browser_monitoring.capture_attributes` | `browser_monitoring.attributes.enabled` | `browser_monitoring.attributes.enabled: false` |
74
+ | `error_collector.capture_attributes` | `error_collector.attributes.enabled` | `error_collector.attributes.enabled: false` |
75
+ | `resque.capture_params` | `attributes.include` | `attributes.include: ['job.resque.args.*']` |
76
+ | `sidekiq.capture_params` | `attributes.include` | `attributes.include: ['job.sidekiq.args.*']` |
77
+ | `transaction_tracer.capture_attributes` | `transaction_tracer.attributes.enabled` | `transaction_tracer.attributes.enabled: false` |
78
+ | `error_collector.ignore_errors` | `error_collector.ignore_classes` | `error_collector.ignore_classes: ['ActionController::RoutingError', 'CustomError']` |
79
+ | `analytics_events.enabled` | `transaction_events.enabled` | `transaction_events.enabled: false` |
80
+ | `analytics_events.max_samples_stored` | `transaction_events.max_samples_stored` | `transaction_events.max_samples_stored: 1200` |
81
+ | `disable_database_instrumentation` | `disable_sequel_instrumentation` | `disable_sequel_instrumentation: true` |
82
+ | `disable_bunny` | `instrumentation.bunny` | `instrumentation.bunny: disabled` |
83
+ | `disable_curb` | `instrumentation.curb` | `instrumentation.curb: disabled` |
84
+ | `disable_dj` | `instrumentation.delayed_job` | `instrumentation.delayed_job: disabled` |
85
+ | `disable_excon` | `instrumentation.excon` | `instrumentation.excon: disabled` |
86
+ | `disable_grape` | `instrumentation.grape` | `instrumentation.grape: disabled` |
87
+ | `disable_grape_instrumentation` | `instrumentation.grape` | `instrumentation.grape: disabled` |
88
+ | `disable_httpclient` | `instrumentation.httpclient` | `instrumentation.httpcient: disabled` |
89
+ | `disable_httprb` | `instrumentation.httprb` | `instrumentation.httprb: disabled` |
90
+ | `disable_dalli` | `instrumentation.memcache` | `instrumentation.memcache: disabled` |
91
+ | `disable_dalli_cas_client` | `instrumentation.memcache` | `instrumentation.memcache: disabled` |
92
+ | `disable_memcache_client` | `instrumentation.memcache-client` | `instrumentation.memcache-client: disabled` |
93
+ | `disable_memcache_instrumentation` | `instrumentation.memcache` | `instrumentation.memcache: disabled` |
94
+ | `disable_memcached` | `instrumentation.memcached` | `instrumentation.memcached: disabled` |
95
+ | `disable_mongo` | `instrumentation.mongo` | `instrumentation.mongo: disabled` |
96
+ | `disable_net_http` | `instrumentation.net_http` | `instrumentation.net_http: disabled` |
97
+ | `prepend_net_instrumentation` | `instrumentation.net_http` | `instrumentation.net_http: prepend` |
98
+ | `disable_puma_rack` | `instrumentation.puma_rack` | `instrumentation.puma_rack: disabled` |
99
+ | `disable_puma_rack_urlmap` | `instrumentation.puma_rack_urlmap` | `instrumentation.puma_rack_urlmap: disabled` |
100
+ | `disable_rack` | `instrumentation.rack` | `instrumentation.rack: disabled` |
101
+ | `disable_rack_urlmap` | `instrumentation.rack_urlmap` | `instrumentation.rack_urlmap: disabled` |
102
+ | `disable_redis` | `instrumentation.redis` | `instrumentation.redis: disabled` |
103
+ | `disable_redis_instrumentation` | `instrumentation.redis` | `instrumentation.redis: disabled` |
104
+ | `disable_resque` | `instrumentation.resque` | `instrumentation.resque: disabled` |
105
+ | `disable_sinatra` | `instrumentation.sinatra` | `instrumentation.sinatra: disabled` |
106
+ | `disable_rake` | `instrumentation.rake` | `instrumentation.rake: disabled` |
107
+ | `disable_rake_instrumentation` | `instrumentation.rake` | `instrumentation.rake: disabled` |
108
+ | `disable_typhoeus` | `instrumentation.typhoeus` | `instrumentation.typhoeus: disabled` |
109
+
110
+
111
+
112
+
113
+ - **Enable Thread instrumentation by default**
114
+
115
+ The configuration option `instrumentation.thread.tracing` is now enabled by default. This configuration allows the agent to properly monitor code occurring inside threads. In Ruby agent 9.0, instrumented code within threads will be recorded and associated with the current transaction when the thread was created.
116
+
117
+ This may be a breaking change if you are currently using custom thread instrumentation. New transactions inside of threads will no longer be started if one already exists. [PR#1767](https://github.com/newrelic/newrelic-ruby-agent/pull/1767)
118
+
119
+ - **Add Fiber instrumentation**
120
+
121
+ `Fiber` instances are now automatically instrumented similarly to `Thread` instances. This can be [configured](https://docs.newrelic.com/docs/apm/agents/ruby-agent/configuration/ruby-agent-configuration/#instrumentation-fiber) using `instrumentation.fiber`. [PR#1802](https://github.com/newrelic/newrelic-ruby-agent/pull/1802)
122
+
123
+
124
+ - **Removed support for Ruby 2.2 and 2.3**
125
+
126
+ Ruby 2.2 and 2.3 are no longer supported by the Ruby agent. To continue using the latest Ruby Agent version, please update to Ruby 2.4.0 or above. [PR#1778](https://github.com/newrelic/newrelic-ruby-agent/pull/1778)
127
+
128
+ - **Removed deprecated instrumentation**
129
+
130
+ Instrumentation for the following gems had been previously deprecated and has now been removed. [PR#1788](https://github.com/newrelic/newrelic-ruby-agent/pull/1788)
131
+ - Acts As Solr
132
+ - Authlogic
133
+ - DataMapper
134
+ - Rainbows
135
+ - Sunspot
136
+
137
+ Versions of the following technologies had been previously deprecated and are no longer supported.
138
+
139
+ - Passenger: 2.2.x - 4.0.x
140
+ - Puma: 2.0.x
141
+ - Grape: 0.2.0
142
+ - Padrino: 0.14.x
143
+ - Rails: 3.2.x
144
+ - Sinatra: 1.4.x, 1.5.x
145
+ - Mongo: 1.8.x - 2.3.x
146
+ - Sequel: 3.37.x, 4.0.x
147
+ - Delayed_Job: 2.0.x - 4.0.x
148
+ - Sidekiq: 4.2.x
149
+ - Excon: below 0.55.0
150
+ - HttpClient: 2.2.0 - 2.8.0
151
+ - HttpRb: 0.9.9 - 2.2.1
152
+ - Typhoeus: 0.5.3 - 1.2.x
153
+ - Bunny: 2.0.x - 2.6.x
154
+ - ActiveMerchant: 1.25.0 - 1.64.x
155
+
156
+
157
+ - **Updated API method `set_transaction_name`**
158
+
159
+ When the method `NewRelic::Agent.set_transaction_name` is called, it will now always change the name and category of the currently running transaction to what is passed into the method. This is a change from previous agent versions.
160
+
161
+ Previously, if `set_transaction_name` was called with a new transaction name and a new category that did not match the category already assigned to a transaction, neither the new name nor category would be saved to the transaction. If this method is being called in a situation in which it was previously ignored due to category differences, this will now change the name and category of the transaction. [PR#1797](https://github.com/newrelic/newrelic-ruby-agent/pull/1797)
162
+
163
+ - **Removed API method: `NewRelic::Agent.disable_transaction_tracing`**
164
+
165
+ The deprecated API method `NewRelic::Agent.disable_transaction_tracing` has been removed. Instead use either `NewRelic::Agent#ignore_transaction` to disable the recording of the current transaction or `NewRelic::Agent.disable_all_tracing` to yield a block without collecting any metrics or traces in any of the subsequent calls. [PR#1792](https://github.com/newrelic/newrelic-ruby-agent/pull/1792)
166
+
167
+ - **Renamed ActiveJob metrics**
168
+
169
+ Previously, ActiveJob was categorized as a message broker, which is inaccurate. We've updated the naming of ActiveJob traces from leading with `MessageBroker/ActiveJob` to simply leading with `ActiveJob`. [PR#1811](https://github.com/newrelic/newrelic-ruby-agent/pull/1811)
170
+
171
+ - **Code cleanup**
172
+
173
+ Thank you to community member [@esquith](https://github.com/esquith) for contributing some cleanup of orphaned constants in our code base. [PR#1793](https://github.com/newrelic/newrelic-ruby-agent/pull/1793) [PR#1794](https://github.com/newrelic/newrelic-ruby-agent/pull/1794) [PR#1808](https://github.com/newrelic/newrelic-ruby-agent/pull/1808)
174
+
175
+ Community member [@fchatterji](https://github.com/fchatterji) helped standardize how we reference `NewRelic` throughout our codebase [PR#1795](https://github.com/newrelic/newrelic-ruby-agent/pull/1795) and updated our README's community header [PR#1815](https://github.com/newrelic/newrelic-ruby-agent/pull/1815). Thanks fchatterji!
176
+
177
+
178
+ - **Bugfix: Allow rails initialization to be deferred by environment variable**
179
+
180
+ The Ruby agent may force some Rails libraries to load on agent initialization, preventing some settings defined in `config/initializers` from being applied. Changing the initialization process to run after `config/initializers`, however, may break the configuration for other gems (ex. Roadie Rails).
181
+
182
+ For those having troubles with agent initialization and Rails initializers, you can now pass the environment variable `NEW_RELIC_DEFER_RAILS_INITIALIZATION=true` to make the agent initialize after `config/initializers` are run. This config option can only be set using an environment variable and can't be set using YAML. [PR#1791](https://github.com/newrelic/newrelic-ruby-agent/pull/1791)
183
+
184
+ Thanks to [@jdelStrother](https://github.com/jdelStrother) for bringing this issue to our attention and testing our fixes along the way. [Issue#662](https://github.com/newrelic/newrelic-ruby-agent/issues/662)
185
+
186
+
3
187
  ## 8.16.0
4
188
 
5
189
  Version 8.16.0 introduces more Ruby on Rails instrumentation (especially for Rails 6 and 7) for various Action\*/Active\* libraries whose actions produce [Active Support notifications events](https://guides.rubyonrails.org/active_support_instrumentation.html).
data/CONTRIBUTING.md CHANGED
@@ -94,7 +94,7 @@ includes unreleased work. Please create all new branches off of `dev`.
94
94
  - Fork the repository inside GitHub
95
95
  - `git clone git@github.com:<gh username>/newrelic-ruby-agent.git`
96
96
  1. Pick a Ruby version
97
- - Use rbenv, rvm, chruby, asdf, etc. to install any version of Ruby between 2.2 up to the latest stable version
97
+ - Use rbenv, rvm, chruby, asdf, etc. to install any version of Ruby between 2.4 up to the latest stable version
98
98
  1. Install development dependencies
99
99
  - `bundle install`
100
100
  1. Check that your env is setup correctly
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,10 @@
1
1
  # frozen_string_literal: true
2
2
  require './test/multiverse/lib/multiverse/bundler_patch'
3
3
 
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) }
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) }
6
6
 
7
- rake_lib_path = Bundler.with_unbundled_env { `bundle exec gem which rake`.chomp.gsub("lib/rake.rb", "lib") }
7
+ rake_lib_path = Bundler.with_unbundled_env { `bundle exec gem which rake`.chomp.gsub('lib/rake.rb', 'lib') }
8
8
  ruby_options = %(-w -I"#{rake_lib_path}" "#{rake_lib_path}/rake/rake_test_loader.rb")
9
9
 
10
10
  guard_options = {
@@ -17,10 +17,10 @@ guard_options = {
17
17
  guard :minitest, guard_options do
18
18
  watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
19
19
  watch(%r{^test/.+_test\.rb$})
20
- watch(%r{^test/rum/.*}) { "test/new_relic/rack/browser_monitoring_test.rb" }
20
+ watch(%r{^test/rum/.*}) { 'test/new_relic/rack/browser_monitoring_test.rb' }
21
21
  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" }
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' }
25
25
  watch(%r{^lib/new_relic/agent/transaction/(.+).rb}) { |m| "test/new_relic/agent/distributed_tracing/#{m[1]}_cross_agent_test.rb" }
26
26
  end
data/README.md CHANGED
@@ -1,5 +1,4 @@
1
- [![Open Source, New Relic Community Plus: This code is currently maintained by New Relic engineering teams and delivered here in GitHub. See the README for troubleshooting and defect reporting instructions.](https://github.com/newrelic/open-source-office/raw/master/examples/categories/images/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
 
@@ -12,6 +11,8 @@ to help you improve the customer experience and make data-driven business decisi
12
11
  The New Relic Ruby agent is dual-purposed as either a Gem or a Rails plugin,
13
12
  hosted on [github](https://github.com/newrelic/newrelic-ruby-agent).
14
13
 
14
+ This code is actively maintained by New Relic engineering teams and delivered here in GitHub. See below for troubleshooting and defect reporting instructions.
15
+
15
16
  [![Gem Version](https://badge.fury.io/rb/newrelic_rpm.svg)](https://badge.fury.io/rb/newrelic_rpm)
16
17
 
17
18
  ## Supported Environments
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/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
@@ -155,7 +155,7 @@ class RubyProcess
155
155
  def gdb_script_body(backtrace_file)
156
156
  backtrace_gathering_code = 'Thread.list.each { |t| bt = t.backtrace rescue nil; ' \
157
157
  'puts \"#{t.inspect}\n#{bt && bt.join(\"\n\")}\n\n\" }'
158
- <<-END
158
+ <<~END
159
159
  attach #{pid}
160
160
  t a a bt
161
161
  call (void)close(1)
@@ -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,33 +235,33 @@ 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
 
249
249
  def prompt_for_confirmation(target_pid, target_cmd)
250
- puts <<-PROMPT
251
- Are you sure you want to attach to PID #{target_pid} ('#{target_cmd}')}?
252
-
253
- ************************** !WARNING! **************************
254
- Extracting debug information from this process may cause it to CRASH OR HANG.
255
-
256
- It is highly recommended that you only run this script against processes that
257
- are already unresponsive.
258
-
259
- Additionally, the output may contain sensitive information from the program's
260
- command line arguments, environment, or open file list. Please examine the
261
- output before sharing it.
262
- ************************** !WARNING! **************************
263
-
264
- To continue, type 'continue':
250
+ puts <<~PROMPT
251
+ Are you sure you want to attach to PID #{target_pid} ('#{target_cmd}')}?
252
+
253
+ ************************** !WARNING! **************************
254
+ Extracting debug information from this process may cause it to CRASH OR HANG.
255
+
256
+ It is highly recommended that you only run this script against processes that
257
+ are already unresponsive.
258
+
259
+ Additionally, the output may contain sensitive information from the program's
260
+ command line arguments, environment, or open file list. Please examine the
261
+ output before sharing it.
262
+ ************************** !WARNING! **************************
263
+
264
+ To continue, type 'continue':
265
265
  PROMPT
266
266
 
267
267
  until $stdin.gets.strip == 'continue'
@@ -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