newrelic_rpm 6.15.0 → 8.13.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (427) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +7 -1
  3. data/.rubocop.yml +1817 -0
  4. data/.rubocop_todo.yml +59 -0
  5. data/.simplecov +15 -0
  6. data/.snyk +11 -0
  7. data/.yardopts +1 -0
  8. data/Brewfile +12 -0
  9. data/CHANGELOG.md +754 -40
  10. data/CONTRIBUTING.md +32 -5
  11. data/DOCKER.md +167 -0
  12. data/Dockerfile +10 -0
  13. data/Gemfile +0 -1
  14. data/Guardfile +9 -8
  15. data/LICENSE +0 -6
  16. data/README.md +21 -20
  17. data/Rakefile +27 -29
  18. data/THIRD_PARTY_NOTICES.md +14 -199
  19. data/Thorfile +5 -0
  20. data/bin/newrelic +3 -2
  21. data/bin/newrelic_cmd +1 -0
  22. data/bin/nrdebug +76 -53
  23. data/config.dot +5 -5
  24. data/docker-compose.yml +107 -0
  25. data/init.rb +4 -6
  26. data/install.rb +2 -2
  27. data/lefthook.yml +9 -0
  28. data/lib/new_relic/agent/adaptive_sampler.rb +13 -9
  29. data/lib/new_relic/agent/agent/shutdown.rb +35 -0
  30. data/lib/new_relic/agent/agent/special_startup.rb +72 -0
  31. data/lib/new_relic/agent/agent/start_worker_thread.rb +163 -0
  32. data/lib/new_relic/agent/agent/startup.rb +197 -0
  33. data/lib/new_relic/agent/agent.rb +178 -555
  34. data/lib/new_relic/agent/agent_logger.rb +23 -19
  35. data/lib/new_relic/agent/attribute_filter.rb +66 -47
  36. data/lib/new_relic/agent/attribute_processing.rb +7 -7
  37. data/lib/new_relic/agent/attributes.rb +5 -4
  38. data/lib/new_relic/agent/audit_logger.rb +8 -3
  39. data/lib/new_relic/agent/autostart.rb +20 -19
  40. data/lib/new_relic/agent/chained_call.rb +1 -1
  41. data/lib/new_relic/agent/commands/agent_command.rb +3 -3
  42. data/lib/new_relic/agent/commands/agent_command_router.rb +12 -11
  43. data/lib/new_relic/agent/commands/thread_profiler_session.rb +9 -7
  44. data/lib/new_relic/agent/configuration/default_source.rb +1728 -1194
  45. data/lib/new_relic/agent/configuration/dotted_hash.rb +6 -5
  46. data/lib/new_relic/agent/configuration/environment_source.rb +11 -9
  47. data/lib/new_relic/agent/configuration/event_harvest_config.rb +40 -17
  48. data/lib/new_relic/agent/configuration/high_security_source.rb +9 -8
  49. data/lib/new_relic/agent/configuration/manager.rb +82 -69
  50. data/lib/new_relic/agent/configuration/manual_source.rb +1 -1
  51. data/lib/new_relic/agent/configuration/mask_defaults.rb +3 -3
  52. data/lib/new_relic/agent/configuration/security_policy_source.rb +90 -77
  53. data/lib/new_relic/agent/configuration/server_source.rb +21 -19
  54. data/lib/new_relic/agent/configuration/yaml_source.rb +31 -7
  55. data/lib/new_relic/agent/configuration.rb +1 -1
  56. data/lib/new_relic/agent/connect/request_builder.rb +18 -18
  57. data/lib/new_relic/agent/connect/response_handler.rb +5 -8
  58. data/lib/new_relic/agent/custom_event_aggregator.rb +14 -14
  59. data/lib/new_relic/agent/database/explain_plan_helpers.rb +4 -5
  60. data/lib/new_relic/agent/database/obfuscation_helpers.rb +14 -13
  61. data/lib/new_relic/agent/database/obfuscator.rb +2 -2
  62. data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +3 -3
  63. data/lib/new_relic/agent/database.rb +53 -47
  64. data/lib/new_relic/agent/database_adapter.rb +3 -1
  65. data/lib/new_relic/agent/datastores/metric_helper.rb +17 -18
  66. data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +7 -6
  67. data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +6 -10
  68. data/lib/new_relic/agent/datastores/mongo.rb +6 -11
  69. data/lib/new_relic/agent/datastores/nosql_obfuscator.rb +41 -0
  70. data/lib/new_relic/agent/datastores/redis.rb +5 -11
  71. data/lib/new_relic/agent/datastores.rb +11 -13
  72. data/lib/new_relic/agent/deprecator.rb +1 -1
  73. data/lib/new_relic/agent/distributed_tracing/cross_app_payload.rb +10 -10
  74. data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +39 -32
  75. data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +22 -22
  76. data/lib/new_relic/agent/distributed_tracing/distributed_trace_metrics.rb +19 -19
  77. data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +50 -52
  78. data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +5 -6
  79. data/lib/new_relic/agent/distributed_tracing/trace_context.rb +76 -77
  80. data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +39 -38
  81. data/lib/new_relic/agent/distributed_tracing.rb +32 -100
  82. data/lib/new_relic/agent/encoding_normalizer.rb +4 -2
  83. data/lib/new_relic/agent/error_collector.rb +73 -54
  84. data/lib/new_relic/agent/error_event_aggregator.rb +4 -5
  85. data/lib/new_relic/agent/error_filter.rb +174 -0
  86. data/lib/new_relic/agent/error_trace_aggregator.rb +4 -3
  87. data/lib/new_relic/agent/event_aggregator.rb +22 -21
  88. data/lib/new_relic/agent/event_buffer.rb +7 -8
  89. data/lib/new_relic/agent/event_listener.rb +1 -2
  90. data/lib/new_relic/agent/event_loop.rb +25 -23
  91. data/lib/new_relic/agent/external.rb +11 -44
  92. data/lib/new_relic/agent/guid_generator.rb +4 -11
  93. data/lib/new_relic/agent/harvester.rb +4 -5
  94. data/lib/new_relic/agent/heap.rb +6 -8
  95. data/lib/new_relic/agent/hostname.rb +20 -13
  96. data/lib/new_relic/agent/http_clients/abstract.rb +10 -11
  97. data/lib/new_relic/agent/http_clients/curb_wrappers.rb +6 -11
  98. data/lib/new_relic/agent/http_clients/excon_wrappers.rb +8 -9
  99. data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +4 -5
  100. data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +2 -4
  101. data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +8 -4
  102. data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +4 -5
  103. data/lib/new_relic/agent/http_clients/uri_util.rb +1 -3
  104. data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +8 -8
  105. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +38 -31
  106. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +12 -13
  107. data/lib/new_relic/agent/instrumentation/active_job.rb +14 -7
  108. data/lib/new_relic/agent/instrumentation/active_merchant.rb +20 -6
  109. data/lib/new_relic/agent/instrumentation/active_record.rb +29 -27
  110. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +71 -61
  111. data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +31 -44
  112. data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +4 -4
  113. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +27 -20
  114. data/lib/new_relic/agent/instrumentation/active_storage.rb +2 -2
  115. data/lib/new_relic/agent/instrumentation/active_storage_subscriber.rb +18 -15
  116. data/lib/new_relic/agent/instrumentation/active_support_logger/chain.rb +23 -0
  117. data/lib/new_relic/agent/instrumentation/active_support_logger/instrumentation.rb +20 -0
  118. data/lib/new_relic/agent/instrumentation/active_support_logger/prepend.rb +12 -0
  119. data/lib/new_relic/agent/instrumentation/active_support_logger.rb +24 -0
  120. data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +18 -10
  121. data/lib/new_relic/agent/instrumentation/authlogic.rb +10 -2
  122. data/lib/new_relic/agent/instrumentation/bunny/chain.rb +45 -0
  123. data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +150 -0
  124. data/lib/new_relic/agent/instrumentation/bunny/prepend.rb +35 -0
  125. data/lib/new_relic/agent/instrumentation/bunny.rb +11 -154
  126. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +68 -58
  127. data/lib/new_relic/agent/instrumentation/curb/chain.rb +91 -0
  128. data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +221 -0
  129. data/lib/new_relic/agent/instrumentation/curb/prepend.rb +61 -0
  130. data/lib/new_relic/agent/instrumentation/curb.rb +11 -243
  131. data/lib/new_relic/agent/instrumentation/data_mapper.rb +65 -54
  132. data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +35 -0
  133. data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +48 -0
  134. data/lib/new_relic/agent/instrumentation/delayed_job/prepend.rb +33 -0
  135. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +29 -53
  136. data/lib/new_relic/agent/instrumentation/elasticsearch/chain.rb +29 -0
  137. data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +66 -0
  138. data/lib/new_relic/agent/instrumentation/elasticsearch/prepend.rb +13 -0
  139. data/lib/new_relic/agent/instrumentation/elasticsearch.rb +31 -0
  140. data/lib/new_relic/agent/instrumentation/excon/middleware.rb +5 -5
  141. data/lib/new_relic/agent/instrumentation/excon.rb +22 -24
  142. data/lib/new_relic/agent/instrumentation/grape/chain.rb +24 -0
  143. data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +100 -0
  144. data/lib/new_relic/agent/instrumentation/grape/prepend.rb +17 -0
  145. data/lib/new_relic/agent/instrumentation/grape.rb +11 -112
  146. data/lib/new_relic/agent/instrumentation/grpc/client/chain.rb +97 -0
  147. data/lib/new_relic/agent/instrumentation/grpc/client/instrumentation.rb +89 -0
  148. data/lib/new_relic/agent/instrumentation/grpc/client/prepend.rb +111 -0
  149. data/lib/new_relic/agent/instrumentation/grpc/client/request_wrapper.rb +30 -0
  150. data/lib/new_relic/agent/instrumentation/grpc/helper.rb +32 -0
  151. data/lib/new_relic/agent/instrumentation/grpc/server/chain.rb +69 -0
  152. data/lib/new_relic/agent/instrumentation/grpc/server/instrumentation.rb +134 -0
  153. data/lib/new_relic/agent/instrumentation/grpc/server/rpc_desc_prepend.rb +35 -0
  154. data/lib/new_relic/agent/instrumentation/grpc/server/rpc_server_prepend.rb +26 -0
  155. data/lib/new_relic/agent/instrumentation/grpc_client.rb +23 -0
  156. data/lib/new_relic/agent/instrumentation/grpc_server.rb +25 -0
  157. data/lib/new_relic/agent/instrumentation/httpclient/chain.rb +24 -0
  158. data/lib/new_relic/agent/instrumentation/httpclient/instrumentation.rb +37 -0
  159. data/lib/new_relic/agent/instrumentation/httpclient/prepend.rb +15 -0
  160. data/lib/new_relic/agent/instrumentation/httpclient.rb +10 -32
  161. data/lib/new_relic/agent/instrumentation/httprb/chain.rb +22 -0
  162. data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +30 -0
  163. data/lib/new_relic/agent/instrumentation/httprb/prepend.rb +15 -0
  164. data/lib/new_relic/agent/instrumentation/httprb.rb +29 -0
  165. data/lib/new_relic/agent/instrumentation/ignore_actions.rb +4 -5
  166. data/lib/new_relic/agent/instrumentation/logger/chain.rb +21 -0
  167. data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +66 -0
  168. data/lib/new_relic/agent/instrumentation/logger/prepend.rb +13 -0
  169. data/lib/new_relic/agent/instrumentation/logger.rb +26 -0
  170. data/lib/new_relic/agent/instrumentation/memcache/chain.rb +15 -0
  171. data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +57 -128
  172. data/lib/new_relic/agent/instrumentation/memcache/helper.rb +59 -0
  173. data/lib/new_relic/agent/instrumentation/memcache/instrumentation.rb +90 -0
  174. data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +101 -0
  175. data/lib/new_relic/agent/instrumentation/memcache.rb +56 -72
  176. data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +13 -12
  177. data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +5 -7
  178. data/lib/new_relic/agent/instrumentation/mongo.rb +5 -136
  179. data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +21 -18
  180. data/lib/new_relic/agent/instrumentation/net_http/chain.rb +24 -0
  181. data/lib/new_relic/agent/instrumentation/{net_prepend.rb → net_http/instrumentation.rb} +13 -13
  182. data/lib/new_relic/agent/instrumentation/net_http/prepend.rb +21 -0
  183. data/lib/new_relic/agent/instrumentation/net_http.rb +44 -0
  184. data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +10 -9
  185. data/lib/new_relic/agent/instrumentation/padrino/chain.rb +38 -0
  186. data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +28 -0
  187. data/lib/new_relic/agent/instrumentation/padrino/prepend.rb +20 -0
  188. data/lib/new_relic/agent/instrumentation/padrino.rb +20 -58
  189. data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +3 -3
  190. data/lib/new_relic/agent/instrumentation/queue_time.rb +8 -9
  191. data/lib/new_relic/agent/instrumentation/rack/chain.rb +66 -0
  192. data/lib/new_relic/agent/instrumentation/rack/helpers.rb +33 -0
  193. data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +75 -0
  194. data/lib/new_relic/agent/instrumentation/rack/prepend.rb +43 -0
  195. data/lib/new_relic/agent/instrumentation/rack.rb +30 -140
  196. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +16 -52
  197. data/lib/new_relic/agent/instrumentation/rails_middleware.rb +1 -1
  198. data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +5 -4
  199. data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +3 -3
  200. data/lib/new_relic/agent/instrumentation/rails_notifications/action_view.rb +3 -2
  201. data/lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb +13 -3
  202. data/lib/new_relic/agent/instrumentation/rake/chain.rb +20 -0
  203. data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +149 -0
  204. data/lib/new_relic/agent/instrumentation/rake/prepend.rb +14 -0
  205. data/lib/new_relic/agent/instrumentation/rake.rb +16 -157
  206. data/lib/new_relic/agent/instrumentation/redis/chain.rb +45 -0
  207. data/lib/new_relic/agent/instrumentation/redis/constants.rb +17 -0
  208. data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +72 -0
  209. data/lib/new_relic/agent/instrumentation/redis/middleware.rb +16 -0
  210. data/lib/new_relic/agent/instrumentation/redis/prepend.rb +29 -0
  211. data/lib/new_relic/agent/instrumentation/redis.rb +18 -107
  212. data/lib/new_relic/agent/instrumentation/resque/chain.rb +21 -0
  213. data/lib/new_relic/agent/instrumentation/resque/helper.rb +19 -0
  214. data/lib/new_relic/agent/instrumentation/resque/instrumentation.rb +34 -0
  215. data/lib/new_relic/agent/instrumentation/resque/prepend.rb +15 -0
  216. data/lib/new_relic/agent/instrumentation/resque.rb +28 -39
  217. data/lib/new_relic/agent/instrumentation/sequel.rb +14 -16
  218. data/lib/new_relic/agent/instrumentation/sequel_helper.rb +2 -2
  219. data/lib/new_relic/agent/instrumentation/sidekiq/client.rb +20 -0
  220. data/lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb +30 -0
  221. data/lib/new_relic/agent/instrumentation/sidekiq/server.rb +37 -0
  222. data/lib/new_relic/agent/instrumentation/sidekiq.rb +23 -64
  223. data/lib/new_relic/agent/instrumentation/sinatra/chain.rb +55 -0
  224. data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +30 -36
  225. data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +125 -0
  226. data/lib/new_relic/agent/instrumentation/sinatra/prepend.rb +33 -0
  227. data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +2 -2
  228. data/lib/new_relic/agent/instrumentation/sinatra.rb +34 -163
  229. data/lib/new_relic/agent/instrumentation/sunspot.rb +11 -3
  230. data/lib/new_relic/agent/instrumentation/thread/chain.rb +24 -0
  231. data/lib/new_relic/agent/instrumentation/thread/instrumentation.rb +28 -0
  232. data/lib/new_relic/agent/instrumentation/thread/prepend.rb +22 -0
  233. data/lib/new_relic/agent/instrumentation/thread.rb +20 -0
  234. data/lib/new_relic/agent/instrumentation/tilt/chain.rb +24 -0
  235. data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +41 -0
  236. data/lib/new_relic/agent/instrumentation/tilt/prepend.rb +13 -0
  237. data/lib/new_relic/agent/instrumentation/tilt.rb +25 -0
  238. data/lib/new_relic/agent/instrumentation/typhoeus/chain.rb +22 -0
  239. data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +80 -0
  240. data/lib/new_relic/agent/instrumentation/typhoeus/prepend.rb +14 -0
  241. data/lib/new_relic/agent/instrumentation/typhoeus.rb +12 -91
  242. data/lib/new_relic/agent/instrumentation.rb +1 -1
  243. data/lib/new_relic/agent/internal_agent_error.rb +2 -2
  244. data/lib/new_relic/agent/javascript_instrumentor.rb +47 -41
  245. data/lib/new_relic/agent/linking_metadata.rb +44 -0
  246. data/lib/new_relic/agent/local_log_decorator.rb +37 -0
  247. data/lib/new_relic/agent/log_event_aggregator.rb +235 -0
  248. data/lib/new_relic/agent/log_once.rb +1 -1
  249. data/lib/new_relic/agent/log_priority.rb +20 -0
  250. data/lib/new_relic/agent/logging.rb +24 -21
  251. data/lib/new_relic/agent/memory_logger.rb +2 -2
  252. data/lib/new_relic/agent/messaging.rb +65 -81
  253. data/lib/new_relic/agent/method_tracer.rb +154 -149
  254. data/lib/new_relic/agent/method_tracer_helpers.rb +85 -3
  255. data/lib/new_relic/agent/monitors/cross_app_monitor.rb +25 -17
  256. data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +5 -4
  257. data/lib/new_relic/agent/monitors/inbound_request_monitor.rb +1 -2
  258. data/lib/new_relic/agent/monitors/synthetics_monitor.rb +6 -9
  259. data/lib/new_relic/agent/monitors.rb +6 -7
  260. data/lib/new_relic/agent/new_relic_service/encoders.rb +6 -6
  261. data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +5 -5
  262. data/lib/new_relic/agent/new_relic_service/marshaller.rb +2 -2
  263. data/lib/new_relic/agent/new_relic_service/security_policy_settings.rb +5 -4
  264. data/lib/new_relic/agent/new_relic_service.rb +248 -196
  265. data/lib/new_relic/agent/{noticible_error.rb → noticeable_error.rb} +2 -5
  266. data/lib/new_relic/agent/null_logger.rb +7 -3
  267. data/lib/new_relic/agent/obfuscator.rb +8 -10
  268. data/lib/new_relic/agent/parameter_filtering.rb +24 -10
  269. data/lib/new_relic/agent/payload_metric_mapping.rb +9 -10
  270. data/lib/new_relic/agent/pipe_channel_manager.rb +27 -17
  271. data/lib/new_relic/agent/pipe_service.rb +8 -5
  272. data/lib/new_relic/agent/prepend_supportability.rb +2 -2
  273. data/lib/new_relic/agent/priority_sampled_buffer.rb +8 -11
  274. data/lib/new_relic/agent/range_extensions.rb +8 -28
  275. data/lib/new_relic/agent/rules_engine/replacement_rule.rb +11 -11
  276. data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +13 -13
  277. data/lib/new_relic/agent/rules_engine.rb +5 -4
  278. data/lib/new_relic/agent/sampler.rb +3 -4
  279. data/lib/new_relic/agent/sampler_collection.rb +3 -4
  280. data/lib/new_relic/agent/samplers/cpu_sampler.rb +3 -2
  281. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +12 -9
  282. data/lib/new_relic/agent/samplers/memory_sampler.rb +24 -13
  283. data/lib/new_relic/agent/samplers/object_sampler.rb +1 -1
  284. data/lib/new_relic/agent/samplers/vm_sampler.rb +21 -19
  285. data/lib/new_relic/agent/span_event_aggregator.rb +12 -12
  286. data/lib/new_relic/agent/span_event_primitive.rb +62 -56
  287. data/lib/new_relic/agent/sql_sampler.rb +18 -18
  288. data/lib/new_relic/agent/stats.rb +78 -41
  289. data/lib/new_relic/agent/stats_engine/gc_profiler.rb +9 -11
  290. data/lib/new_relic/agent/stats_engine/stats_hash.rb +12 -13
  291. data/lib/new_relic/agent/stats_engine.rb +8 -8
  292. data/lib/new_relic/agent/synthetics_event_aggregator.rb +7 -8
  293. data/lib/new_relic/agent/system_info.rb +85 -65
  294. data/lib/new_relic/agent/threading/agent_thread.rb +18 -14
  295. data/lib/new_relic/agent/threading/backtrace_node.rb +12 -13
  296. data/lib/new_relic/agent/threading/backtrace_service.rb +14 -14
  297. data/lib/new_relic/agent/threading/thread_profile.rb +23 -23
  298. data/lib/new_relic/agent/timestamp_sampled_buffer.rb +1 -1
  299. data/lib/new_relic/agent/tracer.rb +76 -85
  300. data/lib/new_relic/agent/transaction/abstract_segment.rb +103 -40
  301. data/lib/new_relic/agent/transaction/datastore_segment.rb +21 -17
  302. data/lib/new_relic/agent/transaction/distributed_tracer.rb +63 -56
  303. data/lib/new_relic/agent/transaction/distributed_tracing.rb +43 -44
  304. data/lib/new_relic/agent/transaction/external_request_segment.rb +44 -34
  305. data/lib/new_relic/agent/transaction/message_broker_segment.rb +31 -36
  306. data/lib/new_relic/agent/transaction/request_attributes.rb +35 -35
  307. data/lib/new_relic/agent/transaction/segment.rb +14 -10
  308. data/lib/new_relic/agent/transaction/slowest_sample_buffer.rb +1 -3
  309. data/lib/new_relic/agent/transaction/synthetics_sample_buffer.rb +1 -1
  310. data/lib/new_relic/agent/transaction/trace.rb +15 -11
  311. data/lib/new_relic/agent/transaction/trace_builder.rb +10 -10
  312. data/lib/new_relic/agent/transaction/trace_context.rb +35 -35
  313. data/lib/new_relic/agent/transaction/trace_node.rb +25 -24
  314. data/lib/new_relic/agent/transaction/tracing.rb +14 -11
  315. data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +4 -4
  316. data/lib/new_relic/agent/transaction.rb +164 -145
  317. data/lib/new_relic/agent/transaction_error_primitive.rb +27 -25
  318. data/lib/new_relic/agent/transaction_event_aggregator.rb +12 -12
  319. data/lib/new_relic/agent/transaction_event_primitive.rb +32 -33
  320. data/lib/new_relic/agent/transaction_event_recorder.rb +16 -15
  321. data/lib/new_relic/agent/transaction_metrics.rb +10 -9
  322. data/lib/new_relic/agent/transaction_sampler.rb +5 -6
  323. data/lib/new_relic/agent/transaction_time_aggregator.rb +26 -25
  324. data/lib/new_relic/agent/utilization/aws.rb +33 -3
  325. data/lib/new_relic/agent/utilization/azure.rb +3 -3
  326. data/lib/new_relic/agent/utilization/gcp.rb +7 -7
  327. data/lib/new_relic/agent/utilization/pcf.rb +5 -4
  328. data/lib/new_relic/agent/utilization/vendor.rb +43 -28
  329. data/lib/new_relic/agent/utilization_data.rb +7 -5
  330. data/lib/new_relic/agent/vm/jruby_vm.rb +1 -1
  331. data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +2 -2
  332. data/lib/new_relic/agent/vm/mri_vm.rb +40 -15
  333. data/lib/new_relic/agent/vm/snapshot.rb +5 -5
  334. data/lib/new_relic/agent/vm.rb +1 -1
  335. data/lib/new_relic/agent/worker_loop.rb +10 -12
  336. data/lib/new_relic/agent.rb +64 -75
  337. data/lib/new_relic/cli/command.rb +20 -22
  338. data/lib/new_relic/cli/commands/deployments.rb +92 -42
  339. data/lib/new_relic/cli/commands/install.rb +12 -15
  340. data/lib/new_relic/coerce.rb +15 -13
  341. data/lib/new_relic/collection_helper.rb +50 -48
  342. data/lib/new_relic/constants.rb +1 -4
  343. data/lib/new_relic/control/class_methods.rb +3 -3
  344. data/lib/new_relic/control/frameworks/external.rb +2 -2
  345. data/lib/new_relic/control/frameworks/rails.rb +23 -17
  346. data/lib/new_relic/control/frameworks/rails3.rb +3 -4
  347. data/lib/new_relic/control/frameworks/rails4.rb +1 -1
  348. data/lib/new_relic/control/frameworks/rails_notifications.rb +1 -1
  349. data/lib/new_relic/control/frameworks/ruby.rb +3 -3
  350. data/lib/new_relic/control/frameworks/sinatra.rb +7 -1
  351. data/lib/new_relic/control/frameworks.rb +1 -1
  352. data/lib/new_relic/control/instance_methods.rb +23 -45
  353. data/lib/new_relic/control/instrumentation.rb +39 -11
  354. data/lib/new_relic/control/private_instance_methods.rb +48 -0
  355. data/lib/new_relic/control/server_methods.rb +3 -4
  356. data/lib/new_relic/control.rb +1 -2
  357. data/lib/new_relic/delayed_job_injection.rb +1 -1
  358. data/lib/new_relic/dependency_detection.rb +126 -19
  359. data/lib/new_relic/environment_report.rb +40 -32
  360. data/lib/new_relic/helper.rb +48 -7
  361. data/lib/new_relic/language_support.rb +29 -5
  362. data/lib/new_relic/latest_changes.rb +7 -6
  363. data/lib/new_relic/local_environment.rb +24 -18
  364. data/lib/new_relic/metric_data.rb +31 -26
  365. data/lib/new_relic/metric_spec.rb +8 -6
  366. data/lib/new_relic/noticed_error.rb +22 -30
  367. data/lib/new_relic/rack/agent_hooks.rb +1 -1
  368. data/lib/new_relic/rack/agent_middleware.rb +5 -3
  369. data/lib/new_relic/rack/browser_monitoring.rb +133 -123
  370. data/lib/new_relic/rack.rb +1 -1
  371. data/lib/new_relic/recipes/capistrano3.rb +3 -61
  372. data/lib/new_relic/recipes/capistrano_legacy.rb +23 -26
  373. data/lib/new_relic/recipes/helpers/send_deployment.rb +69 -0
  374. data/lib/new_relic/recipes.rb +1 -1
  375. data/lib/new_relic/supportability_helper.rb +9 -10
  376. data/lib/new_relic/traced_thread.rb +35 -0
  377. data/lib/new_relic/version.rb +6 -17
  378. data/lib/newrelic_rpm.rb +11 -35
  379. data/lib/sequel/extensions/newrelic_instrumentation.rb +12 -15
  380. data/lib/sequel/plugins/newrelic_instrumentation.rb +4 -10
  381. data/lib/tasks/all.rb +3 -3
  382. data/lib/tasks/config.rake +22 -117
  383. data/lib/tasks/coverage_report.rake +28 -0
  384. data/lib/tasks/helpers/config.html.erb +21 -0
  385. data/lib/tasks/{config.text.erb → helpers/config.text.erb} +0 -0
  386. data/lib/tasks/helpers/format.rb +123 -0
  387. data/lib/tasks/helpers/matches.rb +12 -0
  388. data/lib/tasks/helpers/prompt.rb +24 -0
  389. data/lib/tasks/helpers/removers.rb +33 -0
  390. data/lib/tasks/install.rake +4 -0
  391. data/lib/tasks/instrumentation_generator/README.md +63 -0
  392. data/lib/tasks/instrumentation_generator/TODO.md +33 -0
  393. data/lib/tasks/instrumentation_generator/instrumentation.thor +124 -0
  394. data/lib/tasks/instrumentation_generator/templates/Envfile.tt +9 -0
  395. data/lib/tasks/instrumentation_generator/templates/chain.tt +22 -0
  396. data/lib/tasks/instrumentation_generator/templates/chain_method.tt +8 -0
  397. data/lib/tasks/instrumentation_generator/templates/dependency_detection.tt +29 -0
  398. data/lib/tasks/instrumentation_generator/templates/instrumentation.tt +13 -0
  399. data/lib/tasks/instrumentation_generator/templates/instrumentation_method.tt +3 -0
  400. data/lib/tasks/instrumentation_generator/templates/newrelic.yml.tt +19 -0
  401. data/lib/tasks/instrumentation_generator/templates/prepend.tt +13 -0
  402. data/lib/tasks/instrumentation_generator/templates/prepend_method.tt +3 -0
  403. data/lib/tasks/instrumentation_generator/templates/test.tt +15 -0
  404. data/lib/tasks/multiverse.rake +4 -0
  405. data/lib/tasks/multiverse.rb +5 -32
  406. data/lib/tasks/newrelic.rb +1 -1
  407. data/lib/tasks/tests.rake +10 -15
  408. data/newrelic.yml +648 -3
  409. data/newrelic_rpm.gemspec +25 -25
  410. data/recipes/newrelic.rb +2 -2
  411. data/test/agent_helper.rb +219 -178
  412. metadata +164 -122
  413. data/ROADMAP.md +0 -24
  414. data/bin/mongrel_rpm +0 -33
  415. data/cert/cacert.pem +0 -1177
  416. data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +0 -44
  417. data/lib/new_relic/agent/datastores/mongo/statement_formatter.rb +0 -53
  418. data/lib/new_relic/agent/instrumentation/excon/connection.rb +0 -49
  419. data/lib/new_relic/agent/instrumentation/http.rb +0 -49
  420. data/lib/new_relic/agent/instrumentation/merb/controller.rb +0 -44
  421. data/lib/new_relic/agent/instrumentation/merb/errors.rb +0 -33
  422. data/lib/new_relic/agent/instrumentation/net.rb +0 -70
  423. data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +0 -125
  424. data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +0 -46
  425. data/lib/new_relic/agent/supported_versions.rb +0 -275
  426. data/lib/new_relic/control/frameworks/merb.rb +0 -29
  427. data/lib/tasks/config.html.erb +0 -32
@@ -1,8 +1,8 @@
1
1
  # Third Party Notices
2
2
 
3
- The New Relic Ruby Agent uses source code from third party libraries which carry
4
- their own copyright notices and license terms. These notices are provided
5
- below.
3
+ The New Relic Ruby agent may make use of source code from third party libraries
4
+ which carry their own copyright notices and license terms. Any such content will
5
+ be provided below.
6
6
 
7
7
  In the event that a required notice is missing or incorrect, please notify us
8
8
  by e-mailing [open-source@newrelic.com](mailto:open-source@newrelic.com).
@@ -11,203 +11,18 @@ For any licenses that require the disclosure of source
11
11
  code, the source code can be found at:
12
12
  [https://github.com/newrelic/newrelic-ruby-agent](https://github.com/newrelic/newrelic-ruby-agent).
13
13
 
14
- ## Content
15
14
 
16
- * [symantec](#symantec)
15
+ ## Current Notices and Terms
17
16
 
18
- ### symantec
17
+ As of version 7.0 (released April 23, 2021), the New Relic Ruby agent does not
18
+ include any third party software with its distribution.
19
19
 
20
- This product includes certificates from Symantec which are used under the
21
- following license (https://docs.broadcom.com/doc/root-certificate-license-agreement-en):
20
+ The Ruby agent team leverages a variety of open source third party software for
21
+ the development of the agent but not distributed with the agent. Some of these
22
+ software packages are referenced as development dependencies in the agent's
23
+ [newrelic_rpm.gemspec](newrelic_rpm.gemspec) file. We are grateful
24
+ to the maintainers and contributors for all of these packages.
22
25
 
23
- ```
24
- ROOT CERTIFICATE LICENSE AGREEMENT
25
- SYMANTEC CORPORATION AND/OR ITS AFFILIATES (“SYMANTEC”) IS WILLING TO PROVIDE THE
26
- ROOT CERTIFICATES TO YOU AS THE INDIVIDUAL, THE COMPANY, OR THE LEGAL ENTITY THAT
27
- WILL BE UTILIZING THE ROOT CERTIFICATES (REFERENCED BELOW AS “YOU” OR “YOUR”)
28
- ONLY ON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS OF THIS AGREEMENT
29
- (“AGREEMENT”). READ THE TERMS AND CONDITIONS OF THIS AGREEMENT CAREFULLY
30
- BEFORE USING THE ROOT CERTIFICATES. THIS IS A LEGAL AND ENFORCEABLE CONTRACT
31
- BETWEEN YOU AND SYMANTEC. BY USING THE ROOT CERTIFICATES, YOU AGREE TO THE
32
- TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE TO THESE TERMS AND
33
- CONDITIONS, MAKE NO FURTHER USE OF THE ROOT CERTIFICATES. UNLESS OTHERWISE
34
- DEFINED HEREIN, CAPITALIZED TERMS WILL HAVE THE MEANING GIVEN IN THE “DEFINITIONS”
35
- SECTION OF THIS AGREEMENT AND SUCH CAPITALIZED TERMS MAY BE USED IN THE
36
- SINGULAR OR IN THE PLURAL, AS THE CONTEXT REQUIRES.
37
-
38
- ROOT CERTIFICATE TERMS AND CONDITIONS
39
- 1. DEFINITIONS.
40
- "Certificate" means an electronic file that, at least, states a name or identifies the issuing Certificate
41
- Authority, identifies the subscriber, contains the subscriber's public key, identifies the Certificate's
42
- operational period, contains a Certificate serial number, and contains a digital signature of the issuing
43
- Certificate Authority.
44
- “Certificate Authority” or “CA” means a person or entity authorized to issue, suspend, or revoke
45
- Certificates.
46
- “Intermediate CA” means a CA Certificate signed by a Root Certificate Intermediate that issues
47
- Certificates either to end-entities or other Certificate Authorities, but not to both.
48
- "Products" means all versions of Your product or service with which the Root Certificates are incorporated
49
- (including successor products and services or any major or minor upgrades thereto).
50
- "Root Certificate" means a self-signed Certificate issued by a top-level Certificate Authority to itself, which
51
- includes such Certificate Authority's public key. The Root Certificates and Root Certificate files to be
52
- provided by Company to Customer pursuant to this Agreement are available for download at
53
- https://www.verisign.com/support/roots.html, https://www.thawte.com/roots/index.html or
54
- https://www.geotrust.com/resources/rootcertificates/index.html.
55
- 2. LICENSE. During the term of this Agreement, Symantec grants You a royalty-free, non-exclusive, nontransferable license to (a) use the Root Certificate for the purposes of testing (without the right to modify);
56
- (b) make copies of Root Certificates only in order to embed and incorporate them, unmodified and in full,
57
- as roots in Your Products; (c) distribute the Root Certificates as embedded and incorporated in such
58
- Products; and (d) use the relevant logos and trademarks of Symantec in Your marketing materials,
59
- advertisements, product data sheets, product packaging and websites solely conjunction with the
60
- distribution of the Root Certificates in accordance with Symantec’s published guidelines for such usage.
61
- You shall not have the right to further distribute the Root Certificates other than as described herein
62
- without an additional license grant, in a separate writing, from Symantec.
63
- 3. RESTRICTIONS. You may not: (a) modify or create any derivative works of Root Certificates; (b)
64
- assign, sublicense, sell, rent, or lease Symantec's root keys or Root Certificates; (c) use such Root
65
- Certificates except as expressly permitted under this Agreement; (d) remove or alter any trademark, logo,
66
- copyright, or other proprietary notices, legends, symbols, or labels provided in the Root Certificates; or (e)
67
- certify, or cause a third party to certify, the public key contained in the Root Certificates by issuing or
68
- creating a Certificate containing such public key.
69
- 4. CUSTOMER’S OBLIGATIONS.
70
- 4.1. During the term of this Agreement, You shall use commercially reasonable efforts regularly check the
71
- applicable Symantec URL for updates to the Root Certificates and update Root Certificates embedded
72
- into Your Products with the most currently available Root Certificates, unmodified and in full, or as a patch
73
- or update. If Symantec updates its Root Certificates,, You shall use commercially reasonable efforts to (i)
74
- discontinue all copying and use of the Root Certificates which have been replaced, and (ii) to use
75
- Symantec’s then-current Root Certificates. Any updates to the Root Certificates are incorporated into and
76
- subject to the terms of this Agreement.
77
- 4.2. You shall appoint at least one (1) individual as the administrative contact designated to address any
78
- Root Certificate issues and shall provide the contact information for such individual to dl-tssroot@symantec.com.
79
- 4.3 In the event You become aware of or suspect any event that diminishes the integrity of Symantec's
80
- data or public key system ("Compromise"), You shall immediately notify Symantec at dl-tss-
81
- root@symantec.com of such Compromise, and take reasonable steps to assist and cooperate with
82
- Symantec to remedy the Compromise.
83
- 4.4 In the event that Symantec modifies these terms of use for the Root certificates for all end users,
84
- Symantec shall post the modified terms for the Agreement on the applicable URL and may post the
85
- modified terms on the Symantec corporate website. You shall be responsible for regularly checking the
86
- applicable URL for modifications to this Agreement. Such modifications shall be effective and binding on
87
- Customer within thirty (30) days of Symantec’s posting such modifications to its website. If you do not
88
- accept the modified Agreement, discontinue use of the Root Certificates and this Agreement will be
89
- deemed as terminated.
90
- 5. CONFIDENTIALITY.
91
- 5.1. Confidential Information. "Confidential Information" means the root private keys corresponding to the
92
- public key in a Root Certificate, and any confidential, trade secret, or other proprietary information
93
- disclosed by a party to the other party under this Agreement, except for Information that: (i) is public
94
- knowledge at the time of disclosure, (ii) was known by the receiving party before disclosure by the
95
- disclosing party, or becomes public knowledge or otherwise known to the receiving party after such
96
- disclosure, other than by breach of a confidentiality obligation, or (iii) is independently developed by the
97
- receiving party by persons without access to Confidential Information of the disclosing party.
98
- 5.2. Protection of Confidential Information. The receiving party shall: (i) not disclose the Confidential
99
- information to any third party, (ii) not use the Confidential Information except for purposes of performing
100
- this Agreement, and (iii) take steps consistent with its protection of its own confidential and proprietary
101
- information (but in no event exercise less than reasonable care) to prevent unauthorized disclosure of the
102
- Confidential Information. Each party acknowledges that breach of this Section 5 may cause irreparable
103
- harm to the disclosing party entitling the disclosing party to injunctive relief, among other remedies.
104
- 5.3. Mutual Cooperation. Each party will notify and cooperate with the other party in enforcing the
105
- disclosing party's rights if such party becomes aware of a threatened or actual violation of the
106
- confidentiality requirements of this Section 5. Each party shall have confidentiality agreements with its
107
- employees, agents or independent contractors sufficient in scope to fulfill its confidentiality obligations
108
- under this Agreement.
109
- 6. INTELLECTUAL PROPERTY. You acknowledge that Symantec, including its wholly owned
110
- subsidiaries, retains all intellectual property rights and title (including any patent, copyright, trademark,
111
- trade secret, and other rights) in and to the Root Certificates, the public and private keys corresponding to
112
- such Root Certificates ("Symantec Intellectual Property"). This Agreement does not give You any
113
- intellectual property rights in the Symantec intellectual property except for the license granted in Section
114
- 2. To the extent You use Symantec's trademarks or logos as permitted herein, You agree to comply with
115
- all usage requirements set forth in the then current version of Symantec's Logo and Trademark Usage
116
- Guide (http://www.symantec.com/about/profile/policies/trademarks.jsp) and any other guides and
117
- procedures of Symantec.
118
- 7. NO WARRANTIES. THE ROOT CERTIFICATES, INCLUDING UPDATES, ARE PROVIDED "AS IS"
119
- WITHOUT ANY WARRANTY WHATSOEVER. SYMANTEC HEREBY DISCLAIMS ALL WARRANTIES,
120
- WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING WITHOUT LIMITATION, ANY
121
- IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
122
- NONINFRINGEMENT OF THIRD PARTY RIGHTS.
123
- 8. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY WILL
124
- SYMANTEC OR ITS LICENSORS BE LIABLE TO YOU OR ANY THIRD PARTY FOR ANY
125
- CONSEQUENTIAL, INDIRECT, SPECIAL, INCIDENTAL, OR EXEMPLARY DAMAGES, WHETHER
126
- FORESEEABLE OR UNFORESEEABLE, EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE
127
- POSSIBILITY OF SUCH DAMAGES. YOU WILL TAKE REASONABLE MEASURES TO INSURE THAT
128
- THE TERMS AND CONDITIONS SET FORTH IN THE PRECEDING SENTENCE OF THIS SECTION 8
129
- ARE INCORPORATED INTO ANY AGREEMENT BETWEEN YOU AND YOUR CUSTOMERS OR
130
- LICENSEES. SYMANTEC SHALL NOT BE LIABLE TO YOU OR ANY THIRD PARTY FOR ANY
131
- DAMAGES CAUSED BY YOUR OR A THIRD PARTY’S CONTINUED USE OF ANY OUTDATED
132
- ROOTS FOR WHICH AN UPDATED VERSION IS MADE AVAILABLE BY SYMANTEC. FURTHER,
133
- UNDER NO CIRCUMSTANCES WILL SYMANTEC'S LIABILITY FOR ANY ACTION OR CLAIM EXCEED
134
- USD$1,000, REGARDLESS OF WHETHER SUCH ACTION OR CLAIM IS BASED IN CONTRACT,
135
- TORT, STRICT LIABILITY, OR OTHERWISE.
136
- 9. TERM AND TERMINATION.
137
- 9.1. Term. This Agreement shall become effective as of the earlier of, Your first use of the Root
138
- Certificates, and shall remain in effect until the earlier of (i) Your discontinued use of the Root Certificates;
139
- (ii) termination by either party under the terms of Section 9.2, below; or (iii) Symantec’s notice to You that
140
- Symantec is no longer providing Root Certificates for use.
141
- 9.2. Termination for Default/Insolvency. Either party shall be entitled to terminate this Agreement in the
142
- event of a failure by the other party to perform any of its material obligations under this Agreement if such
143
- breach is not cured within thirty (30) days after receipt of written notice thereof from the non-defaulting
144
- party or within forty-eight (48) hours after receipt of such written notice if a breach by You may
145
- compromise the security of the Symantec Trust Network or other system. This Agreement shall terminate
146
- upon the election of and notice from a party to the other if the other party is adjudged insolvent or
147
- bankrupt, or the institution of any proceedings by or against the other party seeking relief, reorganization,
148
- or arrangement under any laws relating to insolvency, or any assignment for the benefit of creditors, or
149
- the appointment of a receiver, liquidator, or trustee of any of the other party's property or assets, or the
150
- liquidation, dissolution, or winding up of the other party's business.
151
- 9.3. Effect of Expiration or Termination. Upon expiration or termination of this Agreement, except for a
152
- breach by You, You may continue to distribute the current version of Your Products which incorporate the
153
- Root Certificates. Any updates or upgrades thereto may not include the Root Certificates and You shall
154
- stop making copies of Root Certificates, shall stop including Root Certificates in Your Products, and shall
155
- stop using Symantec’s logos and trademarks. The provisions of Sections 3, 4.3, 5, 6, 7, 8, 9.3, and 10
156
- shall survive termination of this Agreement.
157
- 10. GENERAL.
158
- 10.1. Governing Laws. This Agreement and any disputes relating to the services provided hereunder shall
159
- be governed and interpreted according to each of the following laws, respectively, without regard to its
160
- conflicts of law provisions: (a) the laws of the State of California, if You are located in North America or
161
- Latin America; or (b) the law of England, if You are located in Europe, Middle East or Africa; or (c) the
162
- laws of Singapore, if You are located in Asia Pacific including Japan. The United Nations Convention on
163
- Contracts for the International Sale of Goods shall not apply to this Agreement.
164
- 10.2. Binding Upon Successors; Assignment. This Agreement shall be binding upon, and inure to the
165
- benefit of, the successors, executors, heirs, representatives, administrators, and assigns of the parties
166
- hereto. Notwithstanding the foregoing, You may not assign Your rights or obligations under this
167
- Agreement without the prior written consent of Symantec. Any such purported assignment of this
168
- Agreement without obtaining written consent shall be void and of no effect.
169
- 10.3. Severability; Enforcement; No Waiver. The unenforceability of any provision or provisions of this
170
- Agreement shall not impair the enforceability of any other part of this Agreement. If any provision of this
171
- Agreement shall be deemed invalid or unenforceable, in whole or in part, this Agreement shall be deemed
172
- amended to delete or modify, as necessary, the invalid or unenforceable provision to render it valid,
173
- enforceable, and, insofar as possible, consistent with the original intent of the parties. The failure of a
174
- party, at any time or from time to time, to require performance of any obligations of the other party
175
- hereunder shall not be deemed a waiver and shall not affect its right to enforce any provision of this
176
- Agreement at a subsequent time.
177
- 10.4. Entire Agreement; Amendments; Waivers. This Agreement constitutes the entire understanding and
178
- agreement of the parties, whether written or oral, with respect to the subject matter hereof and supersede
179
- all prior and contemporaneous agreements or understandings between the parties. Any term or provision
180
- of this Agreement may be amended, and the observance of any term of this Agreement may be waived,
181
- only by writing signed by the parties to be bound thereby.
182
- 10.5. Compliance with Law, Export Requirements and Foreign Reshipment Liability. Each party shall
183
- comply with all applicable federal, state and local laws and regulations in connection with its performance
184
- under this Agreement. Services, including documentation, may include controlled technology or technical
185
- data (collectively “Controlled Technology”) that is subject to the U.S. Export Administration Regulations
186
- (EAR), and diversion contrary to U.S. law is prohibited. You agree to comply with all relevant laws
187
- including the U.S. EAR and the laws of any country from which Controlled Technology is exported. All
188
- Controlled Technology is prohibited for export or re-export to Cuba, North Korea, Iran, Sudan and Syria
189
- and to any country or its nationals subject to relevant embargo or sanction or to any entity or person for
190
- which an export license is required per any relevant restricted party list, without first obtaining a license.
191
- Furthermore, You hereby agree that You will not use or allow use of Controlled Technology in connection
192
- with chemical, biological, or nuclear weapons, or missiles, drones or space launch vehicles capable of
193
- delivering such weapons. Symantec shall have the right to suspend performance of any of its obligations
194
- under this Agreement, without any prior notice being required and without any liability to Customer, if You
195
- fail to comply with this provision.
196
- 10.6. Notices. You will make all notices, demands or requests to Symantec with respect to this Agreement
197
- in writing to the "Contact" address listed on the website from where you downloaded the Root Certificates,
198
- with a copy to: General Counsel – Legal Department, Symantec Corporation, 350 Ellis Street, Mountain
199
- View, California 94043, USA. Notices shall be effective on the date received (unless the notice specifies a
200
- later date) only if it is sent by a courier service that confirms delivery in writing or if sent by certified or
201
- registered mail, postage prepaid, return receipt requested. Symantec may post notices and updates
202
- regarding the Agreement or the Root Certificates at the URL provided to You for the Root Certificates.
203
- You shall be responsible for regularly checking the applicable URL for notices from Symantec regarding
204
- the Agreement or the Root Certificates. No notices, demands, or requests to Symantec with respect to
205
- this Agreement may be delivered by electronic mail. You shall immediately notify Symantec of any legal
206
- notices served on You that might affect Symantec, and shall promptly forward the original or a copy of
207
- such notice to Symantec.
208
- 10.7. Independent Parties. The relationship between You and Symantec is that of independent
209
- contractors. Neither party nor its employees, consultants, contractors, or agents are agents, employees,
210
- or joint venturers of the other party, nor do they have any authority to bind the other party by contract or
211
- otherwise to any obligation.
212
- Root Certificate License Agreement v3.0 (January 2014)
213
- ```
26
+ For versions older than 7.0, please consult the `THIRD_PARTY_NOTICES.md`
27
+ document distributed with the agent. Any version of the agent not containing
28
+ that document are not thought to include any third party software.
data/Thorfile ADDED
@@ -0,0 +1,5 @@
1
+ # This file is distributed under New Relic's license terms.
2
+ # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
3
+ # frozen_string_literal: true
4
+
5
+ Dir["./lib/tasks/**/*.thor"].sort.each { |f| load f }
data/bin/newrelic CHANGED
@@ -1,13 +1,14 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  # executes one of the commands in the new_relic/commands directory
3
4
  # pass the name of the command as an argument
4
5
 
5
- $LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), '..','lib'))
6
+ $LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
6
7
  require 'new_relic/cli/command'
7
8
  begin
8
9
  NewRelic::Cli::Command.run
9
10
  rescue NewRelic::Cli::Command::CommandFailure => failure
10
11
  STDERR.puts failure.message
11
12
  STDERR.puts failure.options if failure.options
12
- exit 1
13
+ exit(1)
13
14
  end
data/bin/newrelic_cmd CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  # This command has been renamed "newrelic"
3
4
  # executes one of the commands in the new_relic/commands directory
4
5
  # pass the name of the command as an argument
data/bin/nrdebug CHANGED
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- # encoding: utf-8
4
3
  # This file is distributed under New Relic's license terms.
5
4
  # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
5
+ # frozen_string_literal: true
6
6
 
7
7
  require 'tempfile'
8
8
  require 'rbconfig'
9
9
 
10
- def fail(msg, opts={})
10
+ def fail(msg, opts = {})
11
11
  $stderr.puts(msg)
12
12
  usage() if opts[:usage]
13
13
  exit(-1)
@@ -84,7 +84,7 @@ class ProcessDataProvider
84
84
 
85
85
  def self.for_process(pid)
86
86
  case RbConfig::CONFIG['target_os']
87
- when /linux/ then LinuxProcessDataProvider.new(pid)
87
+ when /linux/ then LinuxProcessDataProvider.new(pid)
88
88
  when /darwin/ then DarwinProcessDataProvider.new(pid)
89
89
  end
90
90
  end
@@ -96,11 +96,11 @@ class LinuxProcessDataProvider < ProcessDataProvider
96
96
  end
97
97
 
98
98
  def procline
99
- File.read(proc_path('cmdline')).gsub("\000", " ")
99
+ File.read(proc_path('cmdline')).tr("\000", " ")
100
100
  end
101
101
 
102
102
  def environment
103
- File.read(proc_path('environ')).gsub("\000", "\n")
103
+ File.read(proc_path('environ')).tr("\000", "\n")
104
104
  end
105
105
  end
106
106
 
@@ -133,8 +133,29 @@ class RubyProcess
133
133
  backtrace_file = Tempfile.new('nrdebug_ruby_bt')
134
134
  File.chmod(0666, backtrace_file.path)
135
135
 
136
- backtrace_gathering_code = 'Thread.list.each { |t| bt = t.backtrace rescue nil; puts \"#{t.inspect}\n#{bt && bt.join(\"\n\")}\n\n\" }'
137
- gdb_script_body = <<-END
136
+ body = gdb_script_body(backtrace_file)
137
+
138
+ script_file = write_script_file(body)
139
+
140
+ gdb_stderr = Tempfile.new('nrdebug_gdb_stderr')
141
+
142
+ gdb_cmd = "gdb -batch -x #{script_file.path} 2>#{gdb_stderr.path}"
143
+ gdb_output = ShellWrapper.execute(gdb_cmd)
144
+ ruby_backtrace = File.read(backtrace_file.path)
145
+
146
+ script_file.close!
147
+ backtrace_file.close!
148
+ gdb_stderr.close!
149
+
150
+ [gdb_output, ruby_backtrace]
151
+ end
152
+
153
+ private
154
+
155
+ def gdb_script_body(backtrace_file)
156
+ backtrace_gathering_code = 'Thread.list.each { |t| bt = t.backtrace rescue nil; ' \
157
+ 'puts \"#{t.inspect}\n#{bt && bt.join(\"\n\")}\n\n\" }'
158
+ <<-END
138
159
  attach #{pid}
139
160
  t a a bt
140
161
  call (void)close(1)
@@ -147,30 +168,21 @@ class RubyProcess
147
168
  call (void)fflush(0)
148
169
  quit
149
170
  END
150
- Logger.log("Using gdb script:\n#{gdb_script_body}")
171
+ end
151
172
 
173
+ def write_script_file(body)
174
+ Logger.log("Using gdb script:\n#{body}")
152
175
  script_file = Tempfile.new('nrdebug_gdb_script')
153
- script_file.write(gdb_script_body)
176
+ script_file.write(body)
154
177
  script_file.close
155
-
156
- gdb_stderr = Tempfile.new('nrdebug_gdb_stderr')
157
-
158
- gdb_cmd = "gdb -batch -x #{script_file.path} 2>#{gdb_stderr.path}"
159
- gdb_output = ShellWrapper.execute(gdb_cmd)
160
- ruby_backtrace = File.read(backtrace_file.path)
161
-
162
- script_file.close!
163
- backtrace_file.close!
164
- gdb_stderr.close!
165
-
166
- [gdb_output, ruby_backtrace]
178
+ script_file
167
179
  end
168
180
  end
169
181
 
170
182
  class ProcessReport
171
183
  attr_reader :target, :path
172
184
 
173
- def initialize(target, path=nil)
185
+ def initialize(target, path = nil)
174
186
  @target = target
175
187
  @path = path
176
188
  end
@@ -178,14 +190,14 @@ class ProcessReport
178
190
  def open
179
191
  if @path
180
192
  File.open(@path, "w") do |f|
181
- yield f
193
+ yield(f)
182
194
  end
183
195
  else
184
- yield $stdout
196
+ yield($stdout)
185
197
  end
186
198
  end
187
199
 
188
- def section(f, name=nil)
200
+ def section(f, name = nil)
189
201
  content = begin
190
202
  yield
191
203
  rescue StandardError => e
@@ -200,50 +212,59 @@ class ProcessReport
200
212
 
201
213
  def generate
202
214
  open do |f|
203
- section(f, "Time") { Time.now }
204
- section(f, "PID") { @target.pid }
205
- section(f, "Command") { @target.procline }
206
- section(f, "RSS") { @target.rss }
207
- section(f, "CPU") { @target.cpu }
208
- section(f, "Parent PID") { @target.ppid }
209
- section(f, "OS") { ShellWrapper.execute('uname -a') }
210
- section(f, "Environment") { @target.environment }
215
+ add_environment_sections(f)
211
216
 
212
217
  section(f) do
213
218
  c_backtraces, ruby_backtraces = @target.gather_backtraces
214
- if c_backtraces.match(/could not attach/i)
219
+ if c_backtraces =~ /could not attach/i
215
220
  fail("Failed to attach to target process. Please try again with sudo.")
216
221
  end
217
- section(f, "C Backtraces") { c_backtraces }
222
+
223
+ section(f, "C Backtraces") { c_backtraces }
218
224
  section(f, "Ruby Backtrace(s)") { ruby_backtraces }
219
225
  end
220
226
 
221
227
  section(f, "Open files") { @target.open_files }
222
228
  section(f, "Log") do
223
- commands = Logger.messages.map { |(_,msg)| msg }
229
+ commands = Logger.messages.map { |(_, msg)| msg }
224
230
  commands.join("\n")
225
231
  end
226
232
  end
227
233
  end
234
+
235
+ private
236
+
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 }
246
+ end
228
247
  end
229
248
 
230
249
  def prompt_for_confirmation(target_pid, target_cmd)
231
- puts "Are you sure you want to attach to PID #{target_pid} ('#{target_cmd}')}?"
232
- puts ''
233
- puts '************************** !WARNING! **************************'
234
- puts "Extracting debug information from this process may cause it to CRASH OR HANG."
235
- puts ''
236
- puts "It is highly recommended that you only run this script against processes that"
237
- puts "are already unresponsive."
238
- puts ''
239
- puts "Additionally, the output may contain sensitive information from the program's"
240
- puts "command line arguments, environment, or open file list. Please examine the"
241
- puts "output before sharing it."
242
- puts '************************** !WARNING! **************************'
243
- puts ''
244
- puts "To continue, type 'continue':"
245
-
246
- until ($stdin.gets.strip == 'continue') do
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
+ PROMPT
266
+
267
+ until $stdin.gets.strip == 'continue'
247
268
  puts "Please type 'continue' to continue, or ctrl-c to abort."
248
269
  end
249
270
  end
@@ -256,11 +277,13 @@ fail("Could not find gdb, please ensure it is installed and in your PATH") if gd
256
277
 
257
278
  target = RubyProcess.new(target_pid)
258
279
  if !target.attachable?
259
- fail("You do not appear to have permissions to attach to the target process.\nPlease check the process owner and try again with sudo if necessary")
280
+ fail("You do not appear to have permissions to attach to the target process.\nPlease check the process owner " \
281
+ 'and try again with sudo if necessary')
260
282
  end
261
283
  if !target.alive?
262
284
  fail("Could not find process with PID #{target_pid}")
263
285
  end
286
+
264
287
  target_cmd = target.procline
265
288
 
266
289
  prompt_for_confirmation(target_pid, target_cmd)
data/config.dot CHANGED
@@ -90,7 +90,7 @@ digraph AgentEnabled {
90
90
  "Agent#log_seed_token"
91
91
  "Agent#log_error"
92
92
  "Agent#monitoring?"
93
- "Agent#check_trasaction_sampler_status"
93
+ "Agent#check_transaction_sampler_status"
94
94
  "Agent#check_sql_sampler_status"
95
95
  "Agent#config_transaction_tracer"
96
96
  "Agent#set_sql_recording!"
@@ -134,8 +134,8 @@ digraph AgentEnabled {
134
134
 
135
135
  "MetricFrame.update_apdex"
136
136
 
137
- "TranactionInfo#force_persist_sample?"
138
- "TranactionInfo#include_guid?"
137
+ "TransactionInfo#force_persist_sample?"
138
+ "TransactionInfo#include_guid?"
139
139
 
140
140
  "TransactionSampleBuilder#initialize"
141
141
  "TransactionSampleBuilder#set_transaction_info"
@@ -257,8 +257,8 @@ digraph AgentEnabled {
257
257
 
258
258
  "MetricFrame.update_apdex" -> "[apdex_t]"
259
259
 
260
- "TranactionInfo#force_persist_sample?" -> "[apdex_t]"
261
- "TranactionInfo#include_guid?" -> "[apdex_t]"
260
+ "TransactionInfo#force_persist_sample?" -> "[apdex_t]"
261
+ "TransactionInfo#include_guid?" -> "[apdex_t]"
262
262
 
263
263
  "TransactionSampleBuilder#initialize" -> "[transaction_tracer.limit_segments]"
264
264
  "TransactionSampleBuilder#set_transaction_info" -> "[capture_params]"
@@ -0,0 +1,107 @@
1
+ version: "3.9"
2
+ services:
3
+ elasticsearch7:
4
+ image: elasticsearch:7.16.2
5
+ ports:
6
+ - "9200:9200"
7
+ environment:
8
+ - discovery.type=single-node
9
+ - bootstrap.memory_lock=true
10
+ - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
11
+ mem_limit: 1g
12
+ elasticsearch8:
13
+ image: elasticsearch:8.4.2
14
+ ports:
15
+ - "9250:9250"
16
+ environment:
17
+ - discovery.type=single-node
18
+ - xpack.security.enabled=false
19
+ - http.port=9250
20
+ - bootstrap.memory_lock=true
21
+ - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
22
+ mem_limit: 1g
23
+ mysql:
24
+ image: mysql:5.7
25
+ restart: always
26
+ environment:
27
+ MYSQL_ROOT_PASSWORD: mysql_root_password
28
+ MYSQL_DATABASE: app
29
+ expose:
30
+ - "3306"
31
+ volumes:
32
+ - mysql:/var/lib/mysql
33
+ rabbitmq:
34
+ image: rabbitmq:3.9.12
35
+ restart: always
36
+ environment:
37
+ RABBITMQ_NODENAME: rabbit
38
+ expose:
39
+ - "5672"
40
+ - "15672"
41
+ - "25672"
42
+ - "4369"
43
+ memcached:
44
+ image: memcached:1.6.12
45
+ restart: always
46
+ expose:
47
+ - "11211"
48
+ mongodb:
49
+ image: mongo:5.0.4
50
+ restart: always
51
+ volumes:
52
+ - /data/db
53
+ expose:
54
+ - "27017"
55
+ postgres:
56
+ image: postgres:14.2
57
+ restart: always
58
+ environment:
59
+ POSTGRES_USER: admin
60
+ POSTGRES_PASSWORD: postgres_password
61
+ volumes:
62
+ - postgres:/var/lib/postgresql/data
63
+ expose:
64
+ - "5432"
65
+ redis:
66
+ image: redis:6.2.6
67
+ restart: always
68
+ volumes:
69
+ - /var/lib/redis
70
+ expose:
71
+ - "6379"
72
+ app:
73
+ build:
74
+ context: .
75
+ args:
76
+ - ruby_version=${RUBY_VERSION:-3.1}
77
+ image: newrelic_rpm
78
+ tty: true
79
+ stdin_open: true
80
+ environment:
81
+ MYSQL_USERNAME: root
82
+ MYSQL_PASSWORD: mysql_root_password
83
+ DATABASE_NAME: app
84
+ MYSQL_HOST: mysql
85
+ POSTGRES_USERNAME: admin
86
+ POSTGRES_PASSWORD: postgres_password
87
+ command: ["irb"]
88
+ volumes:
89
+ - ".:/usr/src/app"
90
+ depends_on:
91
+ - elasticsearch7
92
+ - elasticsearch8
93
+ - mysql
94
+ - memcached
95
+ - mongodb
96
+ - postgres
97
+ - rabbitmq
98
+ - redis
99
+ sysctls:
100
+ - "net.ipv6.conf.all.disable_ipv6=0"
101
+ volumes:
102
+ mongodb:
103
+ driver: local
104
+ mysql:
105
+ driver: local
106
+ postgres:
107
+ driver: local
data/init.rb CHANGED
@@ -1,6 +1,6 @@
1
- # encoding: utf-8
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.
3
+ # frozen_string_literal: true
4
4
 
5
5
  # This is the initialization for the New Relic Ruby Agent when used as
6
6
  # a plugin
@@ -14,19 +14,17 @@ require 'new_relic/control'
14
14
 
15
15
  # Initializer for the NewRelic Ruby Agent
16
16
 
17
- # After verison 2.0 of Rails we can access the configuration directly.
17
+ # After version 2.0 of Rails we can access the configuration directly.
18
18
  # We need it to add dev mode routes after initialization finished.
19
19
 
20
20
  begin
21
-
22
21
  current_config = if defined?(config)
23
22
  config
24
23
  elsif defined?(Rails.configuration)
25
24
  Rails.configuration
26
25
  end
27
26
 
28
- NewRelic::Control.instance.init_plugin :config => current_config
29
-
27
+ NewRelic::Control.instance.init_plugin(:config => current_config)
30
28
  rescue => e
31
- ::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)
32
30
  end