newrelic_rpm 8.15.0 → 9.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (342) hide show
  1. checksums.yaml +4 -4
  2. data/.build_ignore +26 -0
  3. data/CHANGELOG.md +538 -44
  4. data/CONTRIBUTING.md +1 -1
  5. data/Gemfile +1 -1
  6. data/README.md +11 -6
  7. data/Rakefile +9 -9
  8. data/Thorfile +1 -1
  9. data/bin/newrelic +1 -0
  10. data/bin/newrelic_cmd +1 -0
  11. data/bin/nrdebug +36 -36
  12. data/init.rb +1 -1
  13. data/lib/new_relic/agent/agent.rb +3 -16
  14. data/lib/new_relic/agent/agent_helpers/connect.rb +5 -10
  15. data/lib/new_relic/agent/agent_helpers/harvest.rb +4 -4
  16. data/lib/new_relic/agent/agent_helpers/shutdown.rb +5 -5
  17. data/lib/new_relic/agent/agent_helpers/special_startup.rb +3 -4
  18. data/lib/new_relic/agent/agent_helpers/start_worker_thread.rb +47 -39
  19. data/lib/new_relic/agent/agent_helpers/startup.rb +13 -13
  20. data/lib/new_relic/agent/agent_helpers/transmit.rb +6 -6
  21. data/lib/new_relic/agent/agent_logger.rb +9 -9
  22. data/lib/new_relic/agent/attribute_filter.rb +2 -4
  23. data/lib/new_relic/agent/attribute_pre_filtering.rb +109 -0
  24. data/lib/new_relic/agent/attribute_processing.rb +2 -2
  25. data/lib/new_relic/agent/audit_logger.rb +5 -5
  26. data/lib/new_relic/agent/autostart.rb +1 -1
  27. data/lib/new_relic/agent/commands/agent_command.rb +2 -2
  28. data/lib/new_relic/agent/commands/agent_command_router.rb +5 -4
  29. data/lib/new_relic/agent/commands/thread_profiler_session.rb +8 -8
  30. data/lib/new_relic/agent/configuration/default_source.rb +428 -586
  31. data/lib/new_relic/agent/configuration/environment_source.rb +2 -2
  32. data/lib/new_relic/agent/configuration/high_security_source.rb +3 -5
  33. data/lib/new_relic/agent/configuration/manager.rb +16 -2
  34. data/lib/new_relic/agent/configuration/security_policy_source.rb +10 -26
  35. data/lib/new_relic/agent/configuration/server_source.rb +24 -24
  36. data/lib/new_relic/agent/configuration/yaml_source.rb +17 -4
  37. data/lib/new_relic/agent/connect/request_builder.rb +1 -1
  38. data/lib/new_relic/agent/connect/response_handler.rb +1 -1
  39. data/lib/new_relic/agent/custom_event_aggregator.rb +4 -4
  40. data/lib/new_relic/agent/database/explain_plan_helpers.rb +1 -1
  41. data/lib/new_relic/agent/database/obfuscation_helpers.rb +2 -2
  42. data/lib/new_relic/agent/database/obfuscator.rb +2 -2
  43. data/lib/new_relic/agent/database.rb +4 -18
  44. data/lib/new_relic/agent/datastores/metric_helper.rb +5 -5
  45. data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +11 -11
  46. data/lib/new_relic/agent/datastores/redis.rb +6 -6
  47. data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +8 -10
  48. data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +10 -10
  49. data/lib/new_relic/agent/distributed_tracing/distributed_trace_metrics.rb +7 -7
  50. data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +1 -1
  51. data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +6 -6
  52. data/lib/new_relic/agent/distributed_tracing/trace_context.rb +7 -7
  53. data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +4 -4
  54. data/lib/new_relic/agent/distributed_tracing.rb +6 -6
  55. data/lib/new_relic/agent/error_collector.rb +36 -8
  56. data/lib/new_relic/agent/error_filter.rb +5 -5
  57. data/lib/new_relic/agent/error_trace_aggregator.rb +5 -4
  58. data/lib/new_relic/agent/event_loop.rb +3 -3
  59. data/lib/new_relic/agent/external.rb +1 -1
  60. data/lib/new_relic/agent/harvester.rb +1 -3
  61. data/lib/new_relic/agent/heap.rb +2 -1
  62. data/lib/new_relic/agent/hostname.rb +1 -1
  63. data/lib/new_relic/agent/http_clients/abstract.rb +9 -21
  64. data/lib/new_relic/agent/http_clients/async_http_wrappers.rb +83 -0
  65. data/lib/new_relic/agent/http_clients/curb_wrappers.rb +7 -3
  66. data/lib/new_relic/agent/http_clients/ethon_wrappers.rb +111 -0
  67. data/lib/new_relic/agent/http_clients/excon_wrappers.rb +7 -5
  68. data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +4 -0
  69. data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +6 -2
  70. data/lib/new_relic/agent/http_clients/httpx_wrappers.rb +93 -0
  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_cable_subscriber.rb +6 -19
  75. data/lib/new_relic/agent/instrumentation/action_controller_other_subscriber.rb +42 -0
  76. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +3 -2
  77. data/lib/new_relic/agent/instrumentation/action_dispatch.rb +31 -0
  78. data/lib/new_relic/agent/instrumentation/action_dispatch_subscriber.rb +64 -0
  79. data/lib/new_relic/agent/instrumentation/action_mailbox.rb +30 -0
  80. data/lib/new_relic/agent/instrumentation/action_mailbox_subscriber.rb +33 -0
  81. data/lib/new_relic/agent/instrumentation/action_mailer.rb +30 -0
  82. data/lib/new_relic/agent/instrumentation/action_mailer_subscriber.rb +85 -0
  83. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +10 -10
  84. data/lib/new_relic/agent/instrumentation/active_job.rb +16 -3
  85. data/lib/new_relic/agent/instrumentation/active_job_subscriber.rb +41 -0
  86. data/lib/new_relic/agent/instrumentation/active_merchant.rb +3 -3
  87. data/lib/new_relic/agent/instrumentation/active_record.rb +4 -3
  88. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +38 -36
  89. data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +5 -4
  90. data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +2 -2
  91. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +3 -2
  92. data/lib/new_relic/agent/instrumentation/active_storage.rb +4 -0
  93. data/lib/new_relic/agent/instrumentation/active_storage_subscriber.rb +2 -30
  94. data/lib/new_relic/agent/instrumentation/active_support.rb +21 -6
  95. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger/chain.rb +69 -0
  96. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger/instrumentation.rb +13 -0
  97. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger/prepend.rb +37 -0
  98. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger.rb +23 -0
  99. data/lib/new_relic/agent/instrumentation/active_support_logger/instrumentation.rb +4 -0
  100. data/lib/new_relic/agent/instrumentation/active_support_logger.rb +3 -1
  101. data/lib/new_relic/agent/instrumentation/active_support_subscriber.rb +41 -0
  102. data/lib/new_relic/agent/instrumentation/async_http/chain.rb +23 -0
  103. data/lib/new_relic/agent/instrumentation/async_http/instrumentation.rb +37 -0
  104. data/lib/new_relic/agent/instrumentation/async_http/prepend.rb +15 -0
  105. data/lib/new_relic/agent/instrumentation/async_http.rb +26 -0
  106. data/lib/new_relic/agent/instrumentation/bunny/chain.rb +1 -1
  107. data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +12 -3
  108. data/lib/new_relic/agent/instrumentation/bunny.rb +1 -1
  109. data/lib/new_relic/agent/instrumentation/concurrent_ruby/chain.rb +1 -1
  110. data/lib/new_relic/agent/instrumentation/concurrent_ruby/instrumentation.rb +3 -4
  111. data/lib/new_relic/agent/instrumentation/concurrent_ruby/prepend.rb +1 -1
  112. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +7 -6
  113. data/lib/new_relic/agent/instrumentation/curb/chain.rb +1 -1
  114. data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +9 -5
  115. data/lib/new_relic/agent/instrumentation/curb.rb +1 -1
  116. data/lib/new_relic/agent/instrumentation/custom_events.rb +12 -0
  117. data/lib/new_relic/agent/instrumentation/custom_events_subscriber.rb +2 -1
  118. data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +1 -0
  119. data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +4 -1
  120. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +2 -1
  121. data/lib/new_relic/agent/instrumentation/elasticsearch/chain.rb +2 -2
  122. data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +8 -4
  123. data/lib/new_relic/agent/instrumentation/elasticsearch.rb +2 -2
  124. data/lib/new_relic/agent/instrumentation/ethon/chain.rb +39 -0
  125. data/lib/new_relic/agent/instrumentation/ethon/instrumentation.rb +105 -0
  126. data/lib/new_relic/agent/instrumentation/ethon/prepend.rb +35 -0
  127. data/lib/new_relic/agent/instrumentation/ethon.rb +39 -0
  128. data/lib/new_relic/agent/instrumentation/excon/middleware.rb +5 -1
  129. data/lib/new_relic/agent/instrumentation/excon.rb +3 -3
  130. data/lib/new_relic/agent/instrumentation/fiber/chain.rb +27 -0
  131. data/lib/new_relic/agent/instrumentation/fiber/instrumentation.rb +23 -0
  132. data/lib/new_relic/agent/instrumentation/fiber/prepend.rb +25 -0
  133. data/lib/new_relic/agent/instrumentation/fiber.rb +25 -0
  134. data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +8 -4
  135. data/lib/new_relic/agent/instrumentation/grape.rb +4 -4
  136. data/lib/new_relic/agent/instrumentation/grpc/client/chain.rb +1 -1
  137. data/lib/new_relic/agent/instrumentation/grpc/client/instrumentation.rb +7 -2
  138. data/lib/new_relic/agent/instrumentation/grpc/client/prepend.rb +1 -1
  139. data/lib/new_relic/agent/instrumentation/grpc/client/request_wrapper.rb +1 -1
  140. data/lib/new_relic/agent/instrumentation/grpc/server/instrumentation.rb +8 -4
  141. data/lib/new_relic/agent/instrumentation/grpc_client.rb +2 -2
  142. data/lib/new_relic/agent/instrumentation/grpc_server.rb +2 -2
  143. data/lib/new_relic/agent/instrumentation/httpclient/instrumentation.rb +4 -0
  144. data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +4 -0
  145. data/lib/new_relic/agent/instrumentation/httprb.rb +1 -1
  146. data/lib/new_relic/agent/instrumentation/httpx/chain.rb +20 -0
  147. data/lib/new_relic/agent/instrumentation/httpx/instrumentation.rb +51 -0
  148. data/lib/new_relic/agent/instrumentation/httpx/prepend.rb +15 -0
  149. data/lib/new_relic/agent/instrumentation/httpx.rb +27 -0
  150. data/lib/new_relic/agent/instrumentation/ignore_actions.rb +1 -1
  151. data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +3 -0
  152. data/lib/new_relic/agent/instrumentation/logger.rb +1 -1
  153. data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +3 -1
  154. data/lib/new_relic/agent/instrumentation/memcache/instrumentation.rb +14 -5
  155. data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +3 -1
  156. data/lib/new_relic/agent/instrumentation/memcache.rb +12 -12
  157. data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +3 -3
  158. data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +1 -1
  159. data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +6 -8
  160. data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +5 -1
  161. data/lib/new_relic/agent/instrumentation/net_http.rb +2 -2
  162. data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +46 -1
  163. data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +7 -3
  164. data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +2 -2
  165. data/lib/new_relic/agent/instrumentation/queue_time.rb +1 -1
  166. data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +7 -1
  167. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +7 -2
  168. data/lib/new_relic/agent/instrumentation/rails_middleware.rb +1 -1
  169. data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +4 -4
  170. data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +14 -1
  171. data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +12 -15
  172. data/lib/new_relic/agent/instrumentation/rake.rb +3 -3
  173. data/lib/new_relic/agent/instrumentation/redis/constants.rb +1 -1
  174. data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +6 -1
  175. data/lib/new_relic/agent/instrumentation/redis.rb +1 -1
  176. data/lib/new_relic/agent/instrumentation/resque/helper.rb +1 -1
  177. data/lib/new_relic/agent/instrumentation/resque/instrumentation.rb +4 -0
  178. data/lib/new_relic/agent/instrumentation/resque.rb +1 -1
  179. data/lib/new_relic/agent/instrumentation/roda/chain.rb +43 -0
  180. data/lib/new_relic/agent/instrumentation/roda/ignorer.rb +45 -0
  181. data/lib/new_relic/agent/instrumentation/roda/instrumentation.rb +68 -0
  182. data/lib/new_relic/agent/instrumentation/roda/prepend.rb +24 -0
  183. data/lib/new_relic/agent/instrumentation/roda/roda_transaction_namer.rb +29 -0
  184. data/lib/new_relic/agent/instrumentation/roda.rb +36 -0
  185. data/lib/new_relic/agent/instrumentation/sequel.rb +8 -9
  186. data/lib/new_relic/agent/instrumentation/sequel_helper.rb +10 -10
  187. data/lib/new_relic/agent/instrumentation/sidekiq/client.rb +4 -0
  188. data/lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb +1 -1
  189. data/lib/new_relic/agent/instrumentation/sidekiq/server.rb +26 -3
  190. data/lib/new_relic/agent/instrumentation/sidekiq.rb +6 -3
  191. data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +1 -1
  192. data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +10 -5
  193. data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +2 -4
  194. data/lib/new_relic/agent/instrumentation/stripe.rb +28 -0
  195. data/lib/new_relic/agent/instrumentation/stripe_subscriber.rb +77 -0
  196. data/lib/new_relic/agent/instrumentation/thread/chain.rb +1 -1
  197. data/lib/new_relic/agent/instrumentation/thread/instrumentation.rb +3 -8
  198. data/lib/new_relic/agent/instrumentation/thread/prepend.rb +1 -1
  199. data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +6 -1
  200. data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +10 -6
  201. data/lib/new_relic/agent/javascript_instrumentor.rb +29 -24
  202. data/lib/new_relic/agent/linking_metadata.rb +2 -2
  203. data/lib/new_relic/agent/log_event_aggregator.rb +64 -17
  204. data/lib/new_relic/agent/log_event_attributes.rb +115 -0
  205. data/lib/new_relic/agent/logging.rb +77 -37
  206. data/lib/new_relic/agent/messaging.rb +9 -7
  207. data/lib/new_relic/agent/method_tracer.rb +7 -7
  208. data/lib/new_relic/agent/method_tracer_helpers.rb +27 -6
  209. data/lib/new_relic/agent/monitors/cross_app_monitor.rb +4 -5
  210. data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +1 -1
  211. data/lib/new_relic/agent/monitors/synthetics_monitor.rb +12 -1
  212. data/lib/new_relic/agent/new_relic_service/encoders.rb +1 -1
  213. data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +2 -2
  214. data/lib/new_relic/agent/new_relic_service/security_policy_settings.rb +0 -1
  215. data/lib/new_relic/agent/new_relic_service.rb +47 -32
  216. data/lib/new_relic/agent/obfuscator.rb +1 -1
  217. data/lib/new_relic/agent/parameter_filtering.rb +6 -6
  218. data/lib/new_relic/agent/pipe_channel_manager.rb +7 -6
  219. data/lib/new_relic/agent/pipe_service.rb +5 -3
  220. data/lib/new_relic/agent/priority_sampled_buffer.rb +1 -1
  221. data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +0 -1
  222. data/lib/new_relic/agent/rules_engine.rb +1 -1
  223. data/lib/new_relic/agent/sampler.rb +2 -1
  224. data/lib/new_relic/agent/sampler_collection.rb +1 -1
  225. data/lib/new_relic/agent/samplers/cpu_sampler.rb +5 -5
  226. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +9 -9
  227. data/lib/new_relic/agent/samplers/memory_sampler.rb +9 -9
  228. data/lib/new_relic/agent/samplers/object_sampler.rb +1 -1
  229. data/lib/new_relic/agent/span_event_aggregator.rb +4 -4
  230. data/lib/new_relic/agent/span_event_primitive.rb +18 -6
  231. data/lib/new_relic/agent/sql_sampler.rb +2 -2
  232. data/lib/new_relic/agent/stats.rb +1 -1
  233. data/lib/new_relic/agent/synthetics_event_aggregator.rb +1 -1
  234. data/lib/new_relic/agent/system_info.rb +36 -10
  235. data/lib/new_relic/agent/threading/agent_thread.rb +1 -1
  236. data/lib/new_relic/agent/threading/backtrace_node.rb +3 -3
  237. data/lib/new_relic/agent/threading/backtrace_service.rb +3 -7
  238. data/lib/new_relic/agent/threading/thread_profile.rb +5 -5
  239. data/lib/new_relic/agent/timestamp_sampled_buffer.rb +1 -1
  240. data/lib/new_relic/agent/tracer.rb +25 -16
  241. data/lib/new_relic/agent/transaction/abstract_segment.rb +109 -48
  242. data/lib/new_relic/agent/transaction/datastore_segment.rb +1 -1
  243. data/lib/new_relic/agent/transaction/distributed_tracer.rb +7 -6
  244. data/lib/new_relic/agent/transaction/distributed_tracing.rb +13 -14
  245. data/lib/new_relic/agent/transaction/external_request_segment.rb +16 -13
  246. data/lib/new_relic/agent/transaction/message_broker_segment.rb +2 -3
  247. data/lib/new_relic/agent/transaction/request_attributes.rb +47 -11
  248. data/lib/new_relic/agent/transaction/segment.rb +1 -1
  249. data/lib/new_relic/agent/transaction/synthetics_sample_buffer.rb +1 -1
  250. data/lib/new_relic/agent/transaction/trace.rb +1 -1
  251. data/lib/new_relic/agent/transaction/trace_context.rb +4 -4
  252. data/lib/new_relic/agent/transaction/trace_node.rb +8 -7
  253. data/lib/new_relic/agent/transaction/tracing.rb +10 -4
  254. data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -1
  255. data/lib/new_relic/agent/transaction.rb +90 -58
  256. data/lib/new_relic/agent/transaction_error_primitive.rb +21 -5
  257. data/lib/new_relic/agent/transaction_event_aggregator.rb +4 -4
  258. data/lib/new_relic/agent/transaction_event_primitive.rb +22 -3
  259. data/lib/new_relic/agent/transaction_sampler.rb +3 -3
  260. data/lib/new_relic/agent/transaction_time_aggregator.rb +7 -3
  261. data/lib/new_relic/agent/utilization/aws.rb +1 -1
  262. data/lib/new_relic/agent/utilization/azure.rb +3 -3
  263. data/lib/new_relic/agent/utilization/gcp.rb +4 -6
  264. data/lib/new_relic/agent/utilization/pcf.rb +1 -1
  265. data/lib/new_relic/agent/utilization/vendor.rb +6 -8
  266. data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +1 -1
  267. data/lib/new_relic/agent/vm/mri_vm.rb +9 -8
  268. data/lib/new_relic/agent/worker_loop.rb +1 -1
  269. data/lib/new_relic/agent.rb +133 -36
  270. data/lib/new_relic/cli/command.rb +4 -3
  271. data/lib/new_relic/cli/commands/deployments.rb +26 -25
  272. data/lib/new_relic/cli/commands/install.rb +23 -23
  273. data/lib/new_relic/collection_helper.rb +2 -2
  274. data/lib/new_relic/constants.rb +10 -8
  275. data/lib/new_relic/control/class_methods.rb +4 -10
  276. data/lib/new_relic/control/frameworks/rails.rb +44 -20
  277. data/lib/new_relic/control/frameworks/roda.rb +20 -0
  278. data/lib/new_relic/control/instance_methods.rb +6 -6
  279. data/lib/new_relic/control/instrumentation.rb +1 -15
  280. data/lib/new_relic/control/private_instance_methods.rb +1 -1
  281. data/lib/new_relic/dependency_detection.rb +20 -18
  282. data/lib/new_relic/environment_report.rb +4 -4
  283. data/lib/new_relic/helper.rb +2 -1
  284. data/lib/new_relic/language_support.rb +10 -1
  285. data/lib/new_relic/latest_changes.rb +6 -6
  286. data/lib/new_relic/local_environment.rb +0 -10
  287. data/lib/new_relic/noticed_error.rb +25 -20
  288. data/lib/new_relic/rack/agent_hooks.rb +1 -1
  289. data/lib/new_relic/rack/agent_middleware.rb +0 -16
  290. data/lib/new_relic/rack/browser_monitoring.rb +21 -17
  291. data/lib/new_relic/recipes/capistrano3.rb +1 -1
  292. data/lib/new_relic/recipes/capistrano_legacy.rb +6 -6
  293. data/lib/new_relic/recipes/helpers/send_deployment.rb +5 -5
  294. data/lib/new_relic/supportability_helper.rb +4 -1
  295. data/lib/new_relic/traced_thread.rb +2 -3
  296. data/lib/new_relic/version.rb +2 -2
  297. data/lib/newrelic_rpm.rb +4 -4
  298. data/lib/sequel/extensions/{newrelic_instrumentation.rb → new_relic_instrumentation.rb} +6 -6
  299. data/lib/sequel/plugins/{newrelic_instrumentation.rb → new_relic_instrumentation.rb} +4 -4
  300. data/lib/tasks/bump_version.rake +21 -0
  301. data/lib/tasks/config.rake +13 -12
  302. data/lib/tasks/coverage_report.rake +4 -4
  303. data/lib/tasks/helpers/config.html.erb +93 -0
  304. data/lib/tasks/helpers/format.rb +19 -15
  305. data/lib/tasks/helpers/newrelicyml.rb +144 -0
  306. data/lib/tasks/helpers/version_bump.rb +62 -0
  307. data/lib/tasks/install.rake +4 -4
  308. data/lib/tasks/instrumentation_generator/instrumentation.thor +16 -19
  309. data/lib/tasks/instrumentation_generator/templates/Envfile.tt +1 -1
  310. data/lib/tasks/instrumentation_generator/templates/chain.tt +1 -1
  311. data/lib/tasks/instrumentation_generator/templates/dependency_detection.tt +1 -1
  312. data/lib/tasks/newrelic.rb +1 -0
  313. data/lib/tasks/newrelicyml.rake +13 -0
  314. data/lib/tasks/tests.rake +77 -6
  315. data/newrelic.yml +393 -274
  316. data/newrelic_rpm.gemspec +41 -30
  317. data/test/agent_helper.rb +25 -24
  318. metadata +172 -35
  319. data/.gitignore +0 -42
  320. data/.project +0 -23
  321. data/.rubocop.yml +0 -1946
  322. data/.rubocop_todo.yml +0 -62
  323. data/.simplecov +0 -15
  324. data/.snyk +0 -11
  325. data/.yardopts +0 -27
  326. data/Brewfile +0 -12
  327. data/DOCKER.md +0 -167
  328. data/Dockerfile +0 -10
  329. data/Guardfile +0 -26
  330. data/config/database.yml +0 -5
  331. data/config.dot +0 -278
  332. data/docker-compose.yml +0 -107
  333. data/lefthook.yml +0 -9
  334. data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +0 -83
  335. data/lib/new_relic/agent/instrumentation/authlogic.rb +0 -33
  336. data/lib/new_relic/agent/instrumentation/data_mapper.rb +0 -215
  337. data/lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb +0 -36
  338. data/lib/new_relic/agent/instrumentation/sunspot.rb +0 -41
  339. data/lib/new_relic/agent/range_extensions.rb +0 -27
  340. data/lib/tasks/helpers/removers.rb +0 -33
  341. data/lib/tasks/multiverse.rake +0 -6
  342. data/lib/tasks/multiverse.rb +0 -77
@@ -94,14 +94,14 @@ module NewRelic
94
94
  elsif type == Array
95
95
  self[config_key] = value.split(/\s*,\s*/)
96
96
  elsif type == NewRelic::Agent::Configuration::Boolean
97
- if value =~ /false|off|no/i
97
+ if /false|off|no/i.match?(value)
98
98
  self[config_key] = false
99
99
  elsif !value.nil?
100
100
  self[config_key] = true
101
101
  end
102
102
  else
103
103
  ::NewRelic::Agent.logger.info("#{environment_key} does not have a corresponding configuration setting (#{config_key} does not exist).")
104
- ::NewRelic::Agent.logger.info("Run `rake newrelic:config:docs` or visit https://newrelic.com/docs/ruby/ruby-agent-configuration to see a list of available configuration settings.")
104
+ ::NewRelic::Agent.logger.info('Run `rake newrelic:config:docs` or visit https://docs.newrelic.com/docs/apm/agents/ruby-agent/configuration/ruby-agent-configuration to see a list of available configuration settings.')
105
105
  self[config_key] = value
106
106
  end
107
107
  end
@@ -11,8 +11,6 @@ module NewRelic
11
11
  def initialize(local_settings)
12
12
  super({
13
13
  :capture_params => false,
14
- :'resque.capture_params' => false,
15
- :'sidekiq.capture_params' => false,
16
14
  :'attributes.include' => [],
17
15
 
18
16
  :'transaction_tracer.record_sql' => record_sql_setting(local_settings, :'transaction_tracer.record_sql'),
@@ -26,9 +24,9 @@ module NewRelic
26
24
  })
27
25
  end
28
26
 
29
- OFF = "off".freeze
30
- RAW = "raw".freeze
31
- OBFUSCATED = "obfuscated".freeze
27
+ OFF = 'off'.freeze
28
+ RAW = 'raw'.freeze
29
+ OBFUSCATED = 'obfuscated'.freeze
32
30
 
33
31
  SET_TO_OBFUSCATED = [RAW, OBFUSCATED]
34
32
 
@@ -15,6 +15,8 @@ module NewRelic
15
15
  module Agent
16
16
  module Configuration
17
17
  class Manager
18
+ DEPENDENCY_DETECTION_VALUES = %i[prepend chain unsatisfied].freeze
19
+
18
20
  # Defining these explicitly saves object allocations that we incur
19
21
  # if we use Forwardable and def_delegators.
20
22
  def [](key)
@@ -241,8 +243,8 @@ module NewRelic
241
243
  end
242
244
  end
243
245
 
244
- MALFORMED_LABELS_WARNING = "Skipping malformed labels configuration"
245
- PARSING_LABELS_FAILURE = "Failure during parsing labels. Ignoring and carrying on with connect."
246
+ MALFORMED_LABELS_WARNING = 'Skipping malformed labels configuration'
247
+ PARSING_LABELS_FAILURE = 'Failure during parsing labels. Ignoring and carrying on with connect.'
246
248
 
247
249
  MAX_LABEL_COUNT = 64
248
250
  MAX_LABEL_LENGTH = 255
@@ -357,7 +359,19 @@ module NewRelic
357
359
  reset_cache
358
360
  end
359
361
 
362
+ # reset the configuration hash, but do not replace previously auto
363
+ # determined dependency detection values with nil or 'auto'
360
364
  def reset_cache
365
+ return new_cache unless defined?(@cache) && @cache
366
+
367
+ preserved = @cache.select { |_k, v| DEPENDENCY_DETECTION_VALUES.include?(v) }
368
+ new_cache
369
+ preserved.each { |k, v| @cache[k] = v }
370
+
371
+ @cache
372
+ end
373
+
374
+ def new_cache
361
375
  @cache = Hash.new { |hash, key| hash[key] = self.fetch(key) }
362
376
  end
363
377
 
@@ -51,7 +51,7 @@ module NewRelic
51
51
  # permitted by the security policy and is also enabled by the config
52
52
 
53
53
  SECURITY_SETTINGS_MAP = {
54
- "record_sql" => [
54
+ 'record_sql' => [
55
55
  {
56
56
  option: :'transaction_tracer.record_sql',
57
57
  supported: true,
@@ -96,7 +96,7 @@ module NewRelic
96
96
  permitted_fn: nil
97
97
  }
98
98
  ],
99
- "attributes_include" => [
99
+ 'attributes_include' => [
100
100
  {
101
101
  option: :'attributes.include',
102
102
  supported: true,
@@ -147,7 +147,7 @@ module NewRelic
147
147
  permitted_fn: nil
148
148
  }
149
149
  ],
150
- "allow_raw_exception_messages" => [
150
+ 'allow_raw_exception_messages' => [
151
151
  {
152
152
  option: :'strip_exception_messages.enabled',
153
153
  supported: true,
@@ -156,7 +156,7 @@ module NewRelic
156
156
  permitted_fn: nil
157
157
  }
158
158
  ],
159
- "custom_events" => [
159
+ 'custom_events' => [
160
160
  {
161
161
  option: :'custom_insights_events.enabled',
162
162
  supported: true,
@@ -165,7 +165,7 @@ module NewRelic
165
165
  permitted_fn: nil
166
166
  }
167
167
  ],
168
- "custom_parameters" => [
168
+ 'custom_parameters' => [
169
169
  {
170
170
  option: :'custom_attributes.enabled',
171
171
  supported: true,
@@ -174,7 +174,7 @@ module NewRelic
174
174
  permitted_fn: nil
175
175
  }
176
176
  ],
177
- "custom_instrumentation_editor" => [
177
+ 'custom_instrumentation_editor' => [
178
178
  {
179
179
  option: nil,
180
180
  supported: false,
@@ -183,7 +183,7 @@ module NewRelic
183
183
  permitted_fn: nil
184
184
  }
185
185
  ],
186
- "message_parameters" => [
186
+ 'message_parameters' => [
187
187
  {
188
188
  option: :'message_tracer.segment_parameters.enabled',
189
189
  supported: true,
@@ -191,22 +191,6 @@ module NewRelic
191
191
  disabled_value: false,
192
192
  permitted_fn: nil
193
193
  }
194
- ],
195
- "job_arguments" => [
196
- {
197
- option: :'resque.capture_params',
198
- supported: true,
199
- enabled_fn: method(:enabled?),
200
- disabled_value: false,
201
- permitted_fn: nil
202
- },
203
- {
204
- option: :'sidekiq.capture_params',
205
- supported: true,
206
- enabled_fn: method(:enabled?),
207
- disabled_value: false,
208
- permitted_fn: nil
209
- }
210
194
  ]
211
195
  }
212
196
 
@@ -214,8 +198,8 @@ module NewRelic
214
198
  super(build_overrides(security_policies))
215
199
  end
216
200
 
217
- ENABLED = "enabled".freeze
218
- COLON_COLON = "::".freeze
201
+ ENABLED = 'enabled'.freeze
202
+ COLON_COLON = '::'.freeze
219
203
 
220
204
  def build_overrides(security_policies)
221
205
  security_policies.inject({}) do |settings, (policy_name, policy_settings)|
@@ -238,7 +222,7 @@ module NewRelic
238
222
  settings[policy[:option]] = policy[:disabled_value]
239
223
  NewRelic::Agent.logger.info( \
240
224
  "Setting applied: {#{policy[:option]}: #{policy[:disabled_value]}}. " \
241
- "Source: SecurityPolicySource"
225
+ 'Source: SecurityPolicySource'
242
226
  )
243
227
  end
244
228
  end
@@ -10,27 +10,27 @@ module NewRelic
10
10
  # response, but should still be merged in as config settings to the
11
11
  # main agent configuration.
12
12
  TOP_LEVEL_KEYS = [
13
- "account_id",
14
- "apdex_t",
15
- "application_id",
16
- "beacon",
17
- "browser_key",
18
- "browser_monitoring.debug",
19
- "browser_monitoring.loader",
20
- "browser_monitoring.loader_version",
21
- "cross_process_id",
22
- "data_report_period",
23
- "encoding_key",
24
- "entity_guid",
25
- "error_beacon",
26
- "js_agent_file",
27
- "js_agent_loader",
28
- "max_payload_size_in_bytes",
29
- "primary_application_id",
30
- "sampling_target",
31
- "sampling_target_period_in_seconds",
32
- "trusted_account_ids",
33
- "trusted_account_key"
13
+ 'account_id',
14
+ 'apdex_t',
15
+ 'application_id',
16
+ 'beacon',
17
+ 'browser_key',
18
+ 'browser_monitoring.debug',
19
+ 'browser_monitoring.loader',
20
+ 'browser_monitoring.loader_version',
21
+ 'cross_process_id',
22
+ 'data_report_period',
23
+ 'encoding_key',
24
+ 'entity_guid',
25
+ 'error_beacon',
26
+ 'js_agent_file',
27
+ 'js_agent_loader',
28
+ 'max_payload_size_in_bytes',
29
+ 'primary_application_id',
30
+ 'sampling_target',
31
+ 'sampling_target_period_in_seconds',
32
+ 'trusted_account_ids',
33
+ 'trusted_account_key'
34
34
  ]
35
35
 
36
36
  def initialize(connect_reply, existing_config = {})
@@ -70,7 +70,7 @@ module NewRelic
70
70
 
71
71
  def fix_transaction_threshold(merged_settings)
72
72
  # when value is "apdex_f" remove the config and defer to default
73
- if merged_settings['transaction_tracer.transaction_threshold'].to_s =~ /apdex_f/i
73
+ if /apdex_f/i.match?(merged_settings['transaction_tracer.transaction_threshold'].to_s)
74
74
  merged_settings.delete('transaction_tracer.transaction_threshold')
75
75
  end
76
76
  end
@@ -102,8 +102,8 @@ module NewRelic
102
102
  if event_harvest_config.nil? \
103
103
  || event_harvest_config['harvest_limits'].values.min < 0 \
104
104
  || (event_harvest_config['report_period_ms'] / 1000) <= 0
105
- NewRelic::Agent.logger.warn("Invalid event harvest config found " \
106
- "in connect response; using default event report period.")
105
+ NewRelic::Agent.logger.warn('Invalid event harvest config found ' \
106
+ 'in connect response; using default event report period.')
107
107
  false
108
108
  else
109
109
  true
@@ -41,6 +41,7 @@ module NewRelic
41
41
 
42
42
  substitute_transaction_threshold(config)
43
43
  booleanify_values(config, 'agent_enabled', 'enabled')
44
+ apply_aliases(config)
44
45
 
45
46
  super(config, true)
46
47
  end
@@ -84,7 +85,7 @@ module NewRelic
84
85
  # so warn about it since it's very likely to be unintended.
85
86
  NewRelic::Agent.logger.warn(
86
87
  "No configuration file found. Working directory = #{Dir.pwd}",
87
- "Looked in these locations (based on #{based_on}): #{candidate_paths.join(", ")}"
88
+ "Looked in these locations (based on #{based_on}): #{candidate_paths.join(', ')}"
88
89
  )
89
90
  end
90
91
 
@@ -96,7 +97,7 @@ module NewRelic
96
97
  file.gsub!(/^\s*#.*$/, '#')
97
98
  ERB.new(file).result(binding)
98
99
  rescue ScriptError, StandardError => e
99
- log_failure("Failed ERB processing configuration file. This is typically caused by a Ruby error in <% %> templating blocks in your newrelic.yml file.", e)
100
+ log_failure('Failed ERB processing configuration file. This is typically caused by a Ruby error in <% %> templating blocks in your newrelic.yml file.', e)
100
101
  nil
101
102
  end
102
103
  end
@@ -124,7 +125,7 @@ module NewRelic
124
125
  config['transaction_tracer']['transaction_threshold'].to_s =~ /apdex_f/i
125
126
  # when value is "apdex_f" remove the config and defer to default
126
127
  config['transaction_tracer'].delete('transaction_threshold')
127
- elsif config['transaction_tracer.transaction_threshold'].to_s =~ /apdex_f/i
128
+ elsif /apdex_f/i.match?(config['transaction_tracer.transaction_threshold'].to_s)
128
129
  config.delete('transaction_tracer.transaction_threshold')
129
130
  end
130
131
  end
@@ -135,7 +136,7 @@ module NewRelic
135
136
  if 'auto' == config[option]
136
137
  config.delete(option)
137
138
  elsif !config[option].nil? && !is_boolean?(config[option])
138
- coerced_value = !!(config[option].to_s =~ /yes|on|true/i)
139
+ coerced_value = config[option].to_s.match?(/yes|on|true/i)
139
140
  if !coerced_value
140
141
  log_failure("Unexpected value (#{config[option]}) for '#{option}' in #{@path}")
141
142
  end
@@ -165,6 +166,18 @@ module NewRelic
165
166
  end
166
167
  result
167
168
  end
169
+
170
+ def apply_aliases(config)
171
+ DEFAULTS.each do |config_setting, value|
172
+ next unless value[:aliases]
173
+
174
+ value[:aliases].each do |config_alias|
175
+ next unless config[config_setting].nil? && !config[config_alias.to_s].nil?
176
+
177
+ config[config_setting] = config[config_alias.to_s]
178
+ end
179
+ end
180
+ end
168
181
  end
169
182
  end
170
183
  end
@@ -48,7 +48,7 @@ module NewRelic
48
48
 
49
49
  def environment_metadata
50
50
  env_copy = {}
51
- ENV.keys.each { |k| env_copy[k] = ENV[k] if k =~ /^NEW_RELIC_METADATA_/ }
51
+ ENV.keys.each { |k| env_copy[k] = ENV[k] if /^NEW_RELIC_METADATA_/.match?(k) }
52
52
  env_copy
53
53
  end
54
54
 
@@ -37,7 +37,7 @@ module NewRelic
37
37
 
38
38
  def add_server_side_config(config_data)
39
39
  if config_data['agent_config']
40
- ::NewRelic::Agent.logger.debug("Using config from server")
40
+ ::NewRelic::Agent.logger.debug('Using config from server')
41
41
  end
42
42
 
43
43
  ::NewRelic::Agent.logger.debug("Server provided config: #{config_data.inspect}")
@@ -27,7 +27,7 @@ module NewRelic
27
27
  return unless enabled?
28
28
 
29
29
  type = @type_strings[type]
30
- unless type =~ EVENT_TYPE_REGEX
30
+ unless EVENT_TYPE_REGEX.match?(type)
31
31
  note_dropped_event(type)
32
32
  return false
33
33
  end
@@ -71,9 +71,9 @@ module NewRelic
71
71
 
72
72
  def record_supportability_metrics(total_count, captured_count, dropped_count)
73
73
  engine = NewRelic::Agent.instance.stats_engine
74
- engine.tl_record_supportability_metric_count("Events/Customer/Seen", total_count)
75
- engine.tl_record_supportability_metric_count("Events/Customer/Sent", captured_count)
76
- engine.tl_record_supportability_metric_count("Events/Customer/Dropped", dropped_count)
74
+ engine.tl_record_supportability_metric_count('Events/Customer/Seen', total_count)
75
+ engine.tl_record_supportability_metric_count('Events/Customer/Sent', captured_count)
76
+ engine.tl_record_supportability_metric_count('Events/Customer/Dropped', dropped_count)
77
77
  end
78
78
 
79
79
  def note_dropped_event(type)
@@ -36,7 +36,7 @@ module NewRelic
36
36
  rescue => e
37
37
  begin
38
38
  # guarantees no throw from explain_sql
39
- ::NewRelic::Agent.logger.error("Error getting query plan:", e)
39
+ ::NewRelic::Agent.logger.error('Error getting query plan:', e)
40
40
  nil
41
41
  rescue
42
42
  # double exception. throw up your hands
@@ -49,10 +49,10 @@ module NewRelic
49
49
  }
50
50
 
51
51
  PLACEHOLDER = '?'.freeze
52
- FAILED_TO_OBFUSCATE_MESSAGE = "Failed to obfuscate SQL query - quote characters remained after obfuscation".freeze
52
+ FAILED_TO_OBFUSCATE_MESSAGE = 'Failed to obfuscate SQL query - quote characters remained after obfuscation'.freeze
53
53
 
54
54
  def obfuscate_single_quote_literals(sql)
55
- return sql unless sql =~ COMPONENTS_REGEX_MAP[:single_quotes]
55
+ return sql unless sql&.match?(COMPONENTS_REGEX_MAP[:single_quotes])
56
56
 
57
57
  sql.gsub(COMPONENTS_REGEX_MAP[:single_quotes], PLACEHOLDER)
58
58
  end
@@ -13,8 +13,8 @@ module NewRelic
13
13
 
14
14
  attr_reader :obfuscator
15
15
 
16
- QUERY_TOO_LARGE_MESSAGE = "Query too large (over 16k characters) to safely obfuscate".freeze
17
- ELLIPSIS = "...".freeze
16
+ QUERY_TOO_LARGE_MESSAGE = 'Query too large (over 16k characters) to safely obfuscate'.freeze
17
+ ELLIPSIS = '...'.freeze
18
18
 
19
19
  def initialize
20
20
  reset
@@ -7,24 +7,10 @@ require 'new_relic/agent/database/explain_plan_helpers'
7
7
  require 'new_relic/agent/database/obfuscator'
8
8
 
9
9
  module NewRelic
10
- # columns for a mysql explain plan
11
- MYSQL_EXPLAIN_COLUMNS = [
12
- "Id",
13
- "Select Type",
14
- "Table",
15
- "Type",
16
- "Possible Keys",
17
- "Key",
18
- "Key Length",
19
- "Ref",
20
- "Rows",
21
- "Extra"
22
- ].freeze
23
-
24
10
  module Agent
25
11
  module Database
26
12
  MAX_QUERY_LENGTH = 16384
27
- ELLIPSIS = "...".freeze
13
+ ELLIPSIS = '...'.freeze
28
14
 
29
15
  extend self
30
16
 
@@ -164,7 +150,7 @@ module NewRelic
164
150
  begin
165
151
  @connections[config] = yield(config)
166
152
  rescue => e
167
- ::NewRelic::Agent.logger.error("Caught exception trying to get connection to DB for explain.", e)
153
+ ::NewRelic::Agent.logger.error('Caught exception trying to get connection to DB for explain.', e)
168
154
  nil
169
155
  end
170
156
  end
@@ -188,7 +174,7 @@ module NewRelic
188
174
 
189
175
  attr_accessor :sql, :config, :explainer, :binds, :name, :host, :port_path_or_id, :database_name
190
176
 
191
- DEFAULT_QUERY_NAME = "SQL".freeze
177
+ DEFAULT_QUERY_NAME = 'SQL'.freeze
192
178
 
193
179
  def initialize(sql, config = {}, explainer = nil, binds = nil, name = DEFAULT_QUERY_NAME, host = nil, port_path_or_id = nil, database_name = nil)
194
180
  @sql = Database.capture_query(sql)
@@ -233,7 +219,7 @@ module NewRelic
233
219
  start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
234
220
  plan = @explainer.call(self)
235
221
  ::NewRelic::Agent.record_metric(
236
- "Supportability/Database/execute_explain_plan",
222
+ 'Supportability/Database/execute_explain_plan',
237
223
  Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
238
224
  )
239
225
  return process_resultset(plan, adapter) if plan
@@ -6,12 +6,12 @@ module NewRelic
6
6
  module Agent
7
7
  module Datastores
8
8
  module MetricHelper
9
- ROLLUP_METRIC = "Datastore/all".freeze
10
- OTHER = "Other".freeze
9
+ ROLLUP_METRIC = 'Datastore/all'.freeze
10
+ OTHER = 'Other'.freeze
11
11
 
12
- ALL = "all".freeze
13
- ALL_WEB = "allWeb".freeze
14
- ALL_OTHER = "allOther".freeze
12
+ ALL = 'all'.freeze
13
+ ALL_WEB = 'allWeb'.freeze
14
+ ALL_OTHER = 'allOther'.freeze
15
15
 
16
16
  def self.statement_metric_for(product, collection, operation)
17
17
  "Datastore/statement/#{product}/#{collection}/#{operation}"
@@ -53,7 +53,7 @@ module NewRelic
53
53
 
54
54
  [name.to_s, collection]
55
55
  rescue => e
56
- NewRelic::Agent.logger.debug("Failure during Mongo metric generation", e)
56
+ NewRelic::Agent.logger.debug('Failure during Mongo metric generation', e)
57
57
  nil
58
58
  end
59
59
 
@@ -64,10 +64,10 @@ module NewRelic
64
64
  NAMES_IN_SELECTOR = [
65
65
  :findandmodify,
66
66
 
67
- "aggregate",
68
- "count",
69
- "group",
70
- "mapreduce",
67
+ 'aggregate',
68
+ 'count',
69
+ 'group',
70
+ 'mapreduce',
71
71
 
72
72
  :distinct,
73
73
 
@@ -91,18 +91,18 @@ module NewRelic
91
91
  if command_key
92
92
  command_key.to_sym
93
93
  else
94
- NewRelic::Agent.increment_metric("Supportability/Mongo/UnknownCollection")
94
+ NewRelic::Agent.increment_metric('Supportability/Mongo/UnknownCollection')
95
95
  payload[:selector].first.first unless command_key
96
96
  end
97
97
  end
98
98
 
99
- CMD_COLLECTION = "$cmd".freeze
99
+ CMD_COLLECTION = '$cmd'.freeze
100
100
 
101
101
  def self.get_collection_from_selector(command_key, payload)
102
102
  if command_key
103
103
  payload[:selector][command_key]
104
104
  else
105
- NewRelic::Agent.increment_metric("Supportability/Mongo/UnknownCollection")
105
+ NewRelic::Agent.increment_metric('Supportability/Mongo/UnknownCollection')
106
106
  CMD_COLLECTION
107
107
  end
108
108
  end
@@ -124,11 +124,11 @@ module NewRelic
124
124
  end
125
125
 
126
126
  def self.create_index?(name, payload)
127
- name == :insert && payload[:collection] == "system.indexes"
127
+ name == :insert && payload[:collection] == 'system.indexes'
128
128
  end
129
129
 
130
130
  def self.drop_indexes?(name, payload)
131
- name == :deleteIndexes && payload[:selector] && payload[:selector][:index] == "*"
131
+ name == :deleteIndexes && payload[:selector] && payload[:selector][:index] == '*'
132
132
  end
133
133
 
134
134
  def self.drop_index?(name, payload)
@@ -166,7 +166,7 @@ module NewRelic
166
166
  end
167
167
 
168
168
  def self.collection_name_from_group_selector(payload)
169
- payload[:selector]["group"]["ns"]
169
+ payload[:selector]['group']['ns']
170
170
  end
171
171
 
172
172
  def self.collection_name_from_rename_selector(payload)
@@ -6,7 +6,7 @@ module NewRelic
6
6
  module Agent
7
7
  module Datastores
8
8
  module Redis
9
- BINARY_DATA_PLACEHOLDER = "<binary data>"
9
+ BINARY_DATA_PLACEHOLDER = '<binary data>'
10
10
 
11
11
  MAXIMUM_COMMAND_LENGTH = 1000
12
12
  MAXIMUM_ARGUMENT_LENGTH = 64
@@ -25,7 +25,7 @@ module NewRelic
25
25
 
26
26
  def self.format_command(command_with_args)
27
27
  if Agent.config[:'transaction_tracer.record_redis_arguments']
28
- result = String.new('')
28
+ result = +''
29
29
 
30
30
  append_command_with_args(result, command_with_args)
31
31
 
@@ -36,7 +36,7 @@ module NewRelic
36
36
  end
37
37
 
38
38
  def self.format_pipeline_commands(commands_with_args)
39
- result = String.new('')
39
+ result = +''
40
40
 
41
41
  commands_with_args.each do |command|
42
42
  if result.length >= MAXIMUM_COMMAND_LENGTH
@@ -83,7 +83,7 @@ module NewRelic
83
83
  end
84
84
 
85
85
  def self.is_supported_version?
86
- Gem::Version.new(::Redis::VERSION) >= Gem::Version.new("3.0.0")
86
+ Gem::Version.new(::Redis::VERSION) >= Gem::Version.new('3.0.0')
87
87
  end
88
88
 
89
89
  def self.ellipsize(result, string)
@@ -106,8 +106,8 @@ module NewRelic
106
106
  end
107
107
 
108
108
  def self.safe_from_third_party_gem?
109
- if NewRelic::LanguageSupport.bundled_gem?("newrelic-redis")
110
- ::NewRelic::Agent.logger.info("Not installing New Relic supported Redis instrumentation because the third party newrelic-redis gem is present")
109
+ if NewRelic::LanguageSupport.bundled_gem?('newrelic-redis')
110
+ ::NewRelic::Agent.logger.info('Not installing New Relic supported Redis instrumentation because the third party newrelic-redis gem is present')
111
111
  false
112
112
  else
113
113
  true
@@ -1,4 +1,3 @@
1
- # -*- ruby -*-
2
1
  # This file is distributed under New Relic's license terms.
3
2
  # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
4
3
  # frozen_string_literal: true
@@ -28,7 +27,7 @@ module NewRelic
28
27
  end
29
28
 
30
29
  def is_cross_app_callee?
31
- cross_app_payload != nil
30
+ !cross_app_payload.nil?
32
31
  end
33
32
 
34
33
  def is_cross_app?
@@ -36,7 +35,7 @@ module NewRelic
36
35
  end
37
36
 
38
37
  def cat_trip_id
39
- cross_app_payload && cross_app_payload.referring_trip_id || transaction.guid
38
+ cross_app_payload&.referring_trip_id || transaction.guid
40
39
  end
41
40
 
42
41
  def cross_app_monitor
@@ -74,7 +73,7 @@ module NewRelic
74
73
  end
75
74
 
76
75
  def record_cross_app_metrics
77
- if (id = cross_app_payload && cross_app_payload.id)
76
+ if (id = cross_app_payload&.id)
78
77
  app_time_in_seconds = [
79
78
  Process.clock_gettime(Process::CLOCK_REALTIME) - transaction.start_time,
80
79
  0.0
@@ -104,11 +103,11 @@ module NewRelic
104
103
  end
105
104
 
106
105
  def cat_referring_path_hash
107
- cross_app_payload && cross_app_payload.referring_path_hash
106
+ cross_app_payload&.referring_path_hash
108
107
  end
109
108
 
110
109
  def append_cat_info(payload)
111
- if (referring_guid = cross_app_payload && cross_app_payload.referring_guid)
110
+ if (referring_guid = cross_app_payload&.referring_guid)
112
111
  payload[:referring_transaction_guid] = referring_guid
113
112
  end
114
113
 
@@ -150,7 +149,7 @@ module NewRelic
150
149
  if Agent.config[:cross_process_id] && Agent.config[:cross_process_id].length > 0
151
150
  true
152
151
  else
153
- NewRelic::Agent.logger.debug("No cross_process_id configured")
152
+ NewRelic::Agent.logger.debug('No cross_process_id configured')
154
153
  false
155
154
  end
156
155
  end
@@ -159,15 +158,14 @@ module NewRelic
159
158
  if Agent.config[:encoding_key] && Agent.config[:encoding_key].length > 0
160
159
  true
161
160
  else
162
- NewRelic::Agent.logger.debug("No encoding_key set")
161
+ NewRelic::Agent.logger.debug('No encoding_key set')
163
162
  false
164
163
  end
165
164
  end
166
165
 
167
166
  def cross_application_tracer_enabled?
168
167
  !NewRelic::Agent.config[:"distributed_tracing.enabled"] &&
169
- (NewRelic::Agent.config[:"cross_application_tracer.enabled"] ||
170
- NewRelic::Agent.config[:cross_application_tracing])
168
+ NewRelic::Agent.config[:"cross_application_tracer.enabled"]
171
169
  end
172
170
 
173
171
  def obfuscator