newrelic_rpm 4.8.0.341 → 6.13.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (343) hide show
  1. checksums.yaml +5 -5
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +31 -0
  3. data/.github/ISSUE_TEMPLATE/config.yml +5 -0
  4. data/.github/ISSUE_TEMPLATE/feature_request.md +24 -0
  5. data/.github/actions/annotate/README.md +79 -0
  6. data/.github/actions/annotate/action.yml +6 -0
  7. data/.github/actions/annotate/dist/index.js +433 -0
  8. data/.github/actions/annotate/index.js +25 -0
  9. data/.github/actions/annotate/package-lock.json +172 -0
  10. data/.github/actions/annotate/package.json +30 -0
  11. data/.github/actions/annotate/pre-commit +5 -0
  12. data/.github/actions/build-ruby/README.md +79 -0
  13. data/.github/actions/build-ruby/action.yml +15 -0
  14. data/.github/actions/build-ruby/dist/index.js +52683 -0
  15. data/.github/actions/build-ruby/index.js +514 -0
  16. data/.github/actions/build-ruby/package-lock.json +581 -0
  17. data/.github/actions/build-ruby/package.json +32 -0
  18. data/.github/actions/build-ruby/pre-commit +5 -0
  19. data/.github/pull_request_template.md +16 -0
  20. data/.github/workflows/ci.yml +212 -0
  21. data/.github/workflows/pr_review_checklist.yml +22 -0
  22. data/.github/workflows/release.yml +78 -0
  23. data/.github/workflows/scripts/rubygems-authenticate.py +13 -0
  24. data/.github/workflows/scripts/rubygems-publish.rb +32 -0
  25. data/.github/workflows/snyk.yml +27 -0
  26. data/.github/workflows/stale.yml +21 -0
  27. data/.gitignore +9 -0
  28. data/.yardopts +4 -1
  29. data/CHANGELOG.md +868 -3
  30. data/CONTRIBUTING.md +106 -19
  31. data/Gemfile +6 -2
  32. data/Guardfile +18 -1
  33. data/LICENSE +208 -38
  34. data/README.md +81 -88
  35. data/ROADMAP.md +24 -0
  36. data/Rakefile +2 -0
  37. data/THIRD_PARTY_NOTICES.md +213 -0
  38. data/bin/nrdebug +1 -1
  39. data/config.dot +3 -12
  40. data/init.rb +1 -1
  41. data/install.rb +1 -1
  42. data/lib/new_relic/agent.rb +145 -31
  43. data/lib/new_relic/agent/adaptive_sampler.rb +104 -0
  44. data/lib/new_relic/agent/agent.rb +192 -190
  45. data/lib/new_relic/agent/agent_logger.rb +5 -1
  46. data/lib/new_relic/agent/attribute_filter.rb +85 -25
  47. data/lib/new_relic/agent/attribute_processing.rb +1 -1
  48. data/lib/new_relic/agent/attributes.rb +152 -0
  49. data/lib/new_relic/agent/audit_logger.rb +1 -1
  50. data/lib/new_relic/agent/autostart.rb +20 -15
  51. data/lib/new_relic/agent/chained_call.rb +1 -1
  52. data/lib/new_relic/agent/commands/agent_command.rb +1 -1
  53. data/lib/new_relic/agent/commands/agent_command_router.rb +3 -22
  54. data/lib/new_relic/agent/commands/thread_profiler_session.rb +1 -1
  55. data/lib/new_relic/agent/configuration.rb +1 -1
  56. data/lib/new_relic/agent/configuration/default_source.rb +375 -67
  57. data/lib/new_relic/agent/configuration/dotted_hash.rb +1 -1
  58. data/lib/new_relic/agent/configuration/environment_source.rb +5 -3
  59. data/lib/new_relic/agent/configuration/event_harvest_config.rb +45 -0
  60. data/lib/new_relic/agent/configuration/high_security_source.rb +2 -3
  61. data/lib/new_relic/agent/configuration/manager.rb +54 -43
  62. data/lib/new_relic/agent/configuration/manual_source.rb +1 -1
  63. data/lib/new_relic/agent/configuration/mask_defaults.rb +1 -1
  64. data/lib/new_relic/agent/configuration/security_policy_source.rb +238 -0
  65. data/lib/new_relic/agent/configuration/server_source.rb +46 -5
  66. data/lib/new_relic/agent/configuration/yaml_source.rb +12 -7
  67. data/lib/new_relic/agent/connect/request_builder.rb +61 -0
  68. data/lib/new_relic/agent/connect/response_handler.rb +61 -0
  69. data/lib/new_relic/agent/custom_event_aggregator.rb +17 -6
  70. data/lib/new_relic/agent/database.rb +21 -3
  71. data/lib/new_relic/agent/database/explain_plan_helpers.rb +12 -1
  72. data/lib/new_relic/agent/database/obfuscation_helpers.rb +2 -2
  73. data/lib/new_relic/agent/database/obfuscator.rb +1 -1
  74. data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +1 -1
  75. data/lib/new_relic/agent/datastores.rb +12 -11
  76. data/lib/new_relic/agent/datastores/metric_helper.rb +2 -3
  77. data/lib/new_relic/agent/datastores/mongo.rb +2 -2
  78. data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +3 -3
  79. data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +1 -1
  80. data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +9 -9
  81. data/lib/new_relic/agent/datastores/mongo/statement_formatter.rb +1 -1
  82. data/lib/new_relic/agent/datastores/redis.rb +1 -1
  83. data/lib/new_relic/agent/deprecator.rb +1 -1
  84. data/lib/new_relic/agent/distributed_tracing.rb +216 -0
  85. data/lib/new_relic/agent/distributed_tracing/cross_app_payload.rb +44 -0
  86. data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +248 -0
  87. data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +84 -0
  88. data/lib/new_relic/agent/distributed_tracing/distributed_trace_metrics.rb +75 -0
  89. data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +165 -0
  90. data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +39 -0
  91. data/lib/new_relic/agent/distributed_tracing/trace_context.rb +246 -0
  92. data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +126 -0
  93. data/lib/new_relic/agent/encoding_normalizer.rb +1 -1
  94. data/lib/new_relic/agent/error_collector.rb +51 -20
  95. data/lib/new_relic/agent/error_event_aggregator.rb +14 -7
  96. data/lib/new_relic/agent/error_trace_aggregator.rb +2 -1
  97. data/lib/new_relic/agent/event_aggregator.rb +34 -15
  98. data/lib/new_relic/agent/event_buffer.rb +1 -1
  99. data/lib/new_relic/agent/event_listener.rb +1 -1
  100. data/lib/new_relic/agent/event_loop.rb +1 -1
  101. data/lib/new_relic/agent/external.rb +31 -29
  102. data/lib/new_relic/agent/guid_generator.rb +28 -0
  103. data/lib/new_relic/agent/harvester.rb +1 -1
  104. data/lib/new_relic/agent/heap.rb +140 -0
  105. data/lib/new_relic/agent/hostname.rb +16 -2
  106. data/lib/new_relic/agent/http_clients/abstract.rb +82 -0
  107. data/lib/new_relic/agent/http_clients/curb_wrappers.rb +25 -20
  108. data/lib/new_relic/agent/http_clients/excon_wrappers.rb +29 -14
  109. data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +18 -22
  110. data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +11 -12
  111. data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +17 -5
  112. data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +5 -7
  113. data/lib/new_relic/agent/http_clients/uri_util.rb +12 -11
  114. data/lib/new_relic/agent/instrumentation.rb +1 -1
  115. data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +26 -43
  116. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +56 -74
  117. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +82 -56
  118. data/lib/new_relic/agent/instrumentation/active_job.rb +19 -17
  119. data/lib/new_relic/agent/instrumentation/active_merchant.rb +1 -1
  120. data/lib/new_relic/agent/instrumentation/active_record.rb +85 -38
  121. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +82 -24
  122. data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +168 -0
  123. data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +102 -31
  124. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +47 -57
  125. data/lib/new_relic/agent/instrumentation/active_storage.rb +23 -0
  126. data/lib/new_relic/agent/instrumentation/active_storage_subscriber.rb +63 -0
  127. data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +24 -8
  128. data/lib/new_relic/agent/instrumentation/authlogic.rb +1 -1
  129. data/lib/new_relic/agent/instrumentation/bunny.rb +115 -44
  130. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +18 -12
  131. data/lib/new_relic/agent/instrumentation/curb.rb +121 -35
  132. data/lib/new_relic/agent/instrumentation/data_mapper.rb +6 -4
  133. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +61 -25
  134. data/lib/new_relic/agent/instrumentation/excon.rb +2 -2
  135. data/lib/new_relic/agent/instrumentation/excon/connection.rb +8 -5
  136. data/lib/new_relic/agent/instrumentation/excon/middleware.rb +4 -3
  137. data/lib/new_relic/agent/instrumentation/grape.rb +46 -35
  138. data/lib/new_relic/agent/instrumentation/http.rb +8 -5
  139. data/lib/new_relic/agent/instrumentation/httpclient.rb +7 -5
  140. data/lib/new_relic/agent/instrumentation/ignore_actions.rb +1 -1
  141. data/lib/new_relic/agent/instrumentation/memcache.rb +5 -3
  142. data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +10 -6
  143. data/lib/new_relic/agent/instrumentation/merb/controller.rb +1 -1
  144. data/lib/new_relic/agent/instrumentation/merb/errors.rb +1 -1
  145. data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +13 -5
  146. data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +20 -11
  147. data/lib/new_relic/agent/instrumentation/mongo.rb +11 -5
  148. data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +39 -7
  149. data/lib/new_relic/agent/instrumentation/net.rb +60 -23
  150. data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +100 -0
  151. data/lib/new_relic/agent/instrumentation/padrino.rb +40 -16
  152. data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +1 -1
  153. data/lib/new_relic/agent/instrumentation/queue_time.rb +1 -1
  154. data/lib/new_relic/agent/instrumentation/rack.rb +36 -13
  155. data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +1 -1
  156. data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +1 -1
  157. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +1 -1
  158. data/lib/new_relic/agent/instrumentation/rails_middleware.rb +1 -1
  159. data/lib/new_relic/agent/instrumentation/{rails5 → rails_notifications}/action_cable.rb +8 -5
  160. data/lib/new_relic/agent/instrumentation/{rails5 → rails_notifications}/action_controller.rb +4 -4
  161. data/lib/new_relic/agent/instrumentation/{rails4 → rails_notifications}/action_view.rb +4 -4
  162. data/lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb +1 -1
  163. data/lib/new_relic/agent/instrumentation/rake.rb +56 -22
  164. data/lib/new_relic/agent/instrumentation/redis.rb +141 -56
  165. data/lib/new_relic/agent/instrumentation/resque.rb +21 -37
  166. data/lib/new_relic/agent/instrumentation/sequel.rb +2 -3
  167. data/lib/new_relic/agent/instrumentation/sequel_helper.rb +1 -1
  168. data/lib/new_relic/agent/instrumentation/sidekiq.rb +48 -24
  169. data/lib/new_relic/agent/instrumentation/sinatra.rb +62 -23
  170. data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +1 -1
  171. data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +1 -1
  172. data/lib/new_relic/agent/instrumentation/sunspot.rb +1 -1
  173. data/lib/new_relic/agent/instrumentation/typhoeus.rb +27 -10
  174. data/lib/new_relic/agent/internal_agent_error.rb +1 -1
  175. data/lib/new_relic/agent/javascript_instrumentor.rb +19 -16
  176. data/lib/new_relic/agent/log_once.rb +1 -1
  177. data/lib/new_relic/agent/logging.rb +139 -0
  178. data/lib/new_relic/agent/memory_logger.rb +1 -1
  179. data/lib/new_relic/agent/messaging.rb +15 -59
  180. data/lib/new_relic/agent/method_tracer.rb +42 -25
  181. data/lib/new_relic/agent/method_tracer_helpers.rb +5 -5
  182. data/lib/new_relic/agent/monitors.rb +27 -0
  183. data/lib/new_relic/agent/monitors/cross_app_monitor.rb +110 -0
  184. data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +27 -0
  185. data/lib/new_relic/agent/{inbound_request_monitor.rb → monitors/inbound_request_monitor.rb} +4 -4
  186. data/lib/new_relic/agent/{synthetics_monitor.rb → monitors/synthetics_monitor.rb} +4 -7
  187. data/lib/new_relic/agent/new_relic_service.rb +174 -63
  188. data/lib/new_relic/agent/new_relic_service/encoders.rb +1 -1
  189. data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +1 -2
  190. data/lib/new_relic/agent/new_relic_service/marshaller.rb +6 -27
  191. data/lib/new_relic/agent/new_relic_service/security_policy_settings.rb +61 -0
  192. data/lib/new_relic/agent/noticible_error.rb +22 -0
  193. data/lib/new_relic/agent/null_logger.rb +1 -1
  194. data/lib/new_relic/agent/obfuscator.rb +1 -1
  195. data/lib/new_relic/agent/parameter_filtering.rb +19 -6
  196. data/lib/new_relic/agent/payload_metric_mapping.rb +1 -1
  197. data/lib/new_relic/agent/pipe_channel_manager.rb +1 -1
  198. data/lib/new_relic/agent/pipe_service.rb +5 -1
  199. data/lib/new_relic/agent/prepend_supportability.rb +1 -1
  200. data/lib/new_relic/agent/priority_sampled_buffer.rb +95 -0
  201. data/lib/new_relic/agent/range_extensions.rb +1 -1
  202. data/lib/new_relic/agent/rules_engine.rb +1 -1
  203. data/lib/new_relic/agent/rules_engine/replacement_rule.rb +1 -1
  204. data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +1 -1
  205. data/lib/new_relic/agent/sampler.rb +1 -1
  206. data/lib/new_relic/agent/sampler_collection.rb +1 -1
  207. data/lib/new_relic/agent/samplers/cpu_sampler.rb +1 -1
  208. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +1 -1
  209. data/lib/new_relic/agent/samplers/memory_sampler.rb +1 -1
  210. data/lib/new_relic/agent/samplers/object_sampler.rb +1 -1
  211. data/lib/new_relic/agent/samplers/vm_sampler.rb +1 -1
  212. data/lib/new_relic/agent/span_event_aggregator.rb +49 -0
  213. data/lib/new_relic/agent/span_event_primitive.rb +206 -0
  214. data/lib/new_relic/agent/sql_sampler.rb +23 -7
  215. data/lib/new_relic/agent/stats.rb +1 -1
  216. data/lib/new_relic/agent/stats_engine.rb +4 -4
  217. data/lib/new_relic/agent/stats_engine/gc_profiler.rb +1 -1
  218. data/lib/new_relic/agent/stats_engine/stats_hash.rb +1 -1
  219. data/lib/new_relic/agent/supported_versions.rb +3 -3
  220. data/lib/new_relic/agent/synthetics_event_aggregator.rb +6 -13
  221. data/lib/new_relic/agent/system_info.rb +18 -8
  222. data/lib/new_relic/agent/threading/agent_thread.rb +6 -4
  223. data/lib/new_relic/agent/threading/backtrace_node.rb +1 -1
  224. data/lib/new_relic/agent/threading/backtrace_service.rb +4 -4
  225. data/lib/new_relic/agent/threading/thread_profile.rb +10 -24
  226. data/lib/new_relic/agent/timestamp_sampled_buffer.rb +19 -0
  227. data/lib/new_relic/agent/tracer.rb +509 -0
  228. data/lib/new_relic/agent/transaction.rb +191 -278
  229. data/lib/new_relic/agent/transaction/abstract_segment.rb +38 -5
  230. data/lib/new_relic/agent/transaction/datastore_segment.rb +30 -5
  231. data/lib/new_relic/agent/transaction/distributed_tracer.rb +171 -0
  232. data/lib/new_relic/agent/transaction/distributed_tracing.rb +123 -71
  233. data/lib/new_relic/agent/transaction/external_request_segment.rb +41 -89
  234. data/lib/new_relic/agent/transaction/message_broker_segment.rb +7 -8
  235. data/lib/new_relic/agent/transaction/request_attributes.rb +1 -1
  236. data/lib/new_relic/agent/transaction/segment.rb +42 -2
  237. data/lib/new_relic/agent/transaction/slowest_sample_buffer.rb +1 -1
  238. data/lib/new_relic/agent/transaction/synthetics_sample_buffer.rb +1 -1
  239. data/lib/new_relic/agent/transaction/trace.rb +7 -23
  240. data/lib/new_relic/agent/transaction/trace_builder.rb +1 -2
  241. data/lib/new_relic/agent/transaction/trace_context.rb +168 -0
  242. data/lib/new_relic/agent/transaction/trace_node.rb +12 -8
  243. data/lib/new_relic/agent/transaction/tracing.rb +2 -100
  244. data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -1
  245. data/lib/new_relic/agent/transaction_error_primitive.rb +13 -22
  246. data/lib/new_relic/agent/transaction_event_aggregator.rb +7 -16
  247. data/lib/new_relic/agent/transaction_event_primitive.rb +31 -42
  248. data/lib/new_relic/agent/transaction_event_recorder.rb +8 -16
  249. data/lib/new_relic/agent/transaction_metrics.rb +1 -1
  250. data/lib/new_relic/agent/transaction_sampler.rb +3 -14
  251. data/lib/new_relic/agent/transaction_time_aggregator.rb +155 -0
  252. data/lib/new_relic/agent/utilization/aws.rb +1 -1
  253. data/lib/new_relic/agent/utilization/azure.rb +1 -1
  254. data/lib/new_relic/agent/utilization/gcp.rb +1 -1
  255. data/lib/new_relic/agent/utilization/pcf.rb +1 -1
  256. data/lib/new_relic/agent/utilization/vendor.rb +1 -1
  257. data/lib/new_relic/agent/utilization_data.rb +37 -2
  258. data/lib/new_relic/agent/vm.rb +1 -1
  259. data/lib/new_relic/agent/vm/jruby_vm.rb +1 -1
  260. data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +1 -1
  261. data/lib/new_relic/agent/vm/mri_vm.rb +1 -1
  262. data/lib/new_relic/agent/vm/snapshot.rb +1 -1
  263. data/lib/new_relic/agent/worker_loop.rb +1 -1
  264. data/lib/new_relic/cli/command.rb +1 -1
  265. data/lib/new_relic/cli/commands/deployments.rb +2 -2
  266. data/lib/new_relic/cli/commands/install.rb +4 -3
  267. data/lib/new_relic/coerce.rb +32 -7
  268. data/lib/new_relic/collection_helper.rb +1 -1
  269. data/lib/new_relic/constants.rb +38 -0
  270. data/lib/new_relic/control.rb +1 -1
  271. data/lib/new_relic/control/class_methods.rb +8 -2
  272. data/lib/new_relic/control/frameworks.rb +1 -1
  273. data/lib/new_relic/control/frameworks/external.rb +1 -1
  274. data/lib/new_relic/control/frameworks/merb.rb +1 -1
  275. data/lib/new_relic/control/frameworks/rails.rb +1 -1
  276. data/lib/new_relic/control/frameworks/rails3.rb +1 -1
  277. data/lib/new_relic/control/frameworks/rails4.rb +1 -1
  278. data/lib/new_relic/control/frameworks/{rails5.rb → rails_notifications.rb} +2 -2
  279. data/lib/new_relic/control/frameworks/ruby.rb +1 -1
  280. data/lib/new_relic/control/frameworks/sinatra.rb +1 -1
  281. data/lib/new_relic/control/instance_methods.rb +30 -4
  282. data/lib/new_relic/control/instrumentation.rb +1 -1
  283. data/lib/new_relic/control/server_methods.rb +1 -1
  284. data/lib/new_relic/delayed_job_injection.rb +1 -1
  285. data/lib/new_relic/dependency_detection.rb +5 -5
  286. data/lib/new_relic/environment_report.rb +6 -2
  287. data/lib/new_relic/helper.rb +1 -1
  288. data/lib/new_relic/language_support.rb +1 -1
  289. data/lib/new_relic/latest_changes.rb +4 -4
  290. data/lib/new_relic/local_environment.rb +1 -1
  291. data/lib/new_relic/metric_data.rb +1 -1
  292. data/lib/new_relic/metric_spec.rb +1 -1
  293. data/lib/new_relic/noticed_error.rb +39 -18
  294. data/lib/new_relic/rack.rb +1 -1
  295. data/lib/new_relic/rack/agent_hooks.rb +1 -1
  296. data/lib/new_relic/rack/agent_middleware.rb +2 -2
  297. data/lib/new_relic/rack/browser_monitoring.rb +16 -9
  298. data/lib/new_relic/recipes.rb +1 -1
  299. data/lib/new_relic/recipes/capistrano3.rb +6 -3
  300. data/lib/new_relic/recipes/capistrano_legacy.rb +1 -1
  301. data/lib/new_relic/supportability_helper.rb +15 -1
  302. data/lib/new_relic/version.rb +4 -4
  303. data/lib/newrelic_rpm.rb +1 -1
  304. data/lib/sequel/extensions/newrelic_instrumentation.rb +3 -3
  305. data/lib/sequel/plugins/newrelic_instrumentation.rb +2 -2
  306. data/lib/tasks/all.rb +1 -1
  307. data/lib/tasks/config.rake +1 -2
  308. data/lib/tasks/multiverse.rb +35 -1
  309. data/lib/tasks/newrelic.rb +1 -1
  310. data/lib/tasks/tests.rake +6 -1
  311. data/newrelic_rpm.gemspec +23 -17
  312. data/recipes/newrelic.rb +1 -1
  313. data/test/agent_helper.rb +357 -78
  314. metadata +154 -60
  315. data/.travis.yml +0 -173
  316. data/lib/new_relic/agent/busy_calculator.rb +0 -117
  317. data/lib/new_relic/agent/commands/xray_session.rb +0 -55
  318. data/lib/new_relic/agent/commands/xray_session_collection.rb +0 -161
  319. data/lib/new_relic/agent/cross_app_monitor.rb +0 -140
  320. data/lib/new_relic/agent/cross_app_tracing.rb +0 -143
  321. data/lib/new_relic/agent/distributed_trace_monitor.rb +0 -29
  322. data/lib/new_relic/agent/distributed_trace_payload.rb +0 -223
  323. data/lib/new_relic/agent/distributed_trace_priority_sampled_buffer.rb +0 -72
  324. data/lib/new_relic/agent/http_clients/abstract_request.rb +0 -31
  325. data/lib/new_relic/agent/instrumentation/active_record_4.rb +0 -42
  326. data/lib/new_relic/agent/instrumentation/active_record_5.rb +0 -36
  327. data/lib/new_relic/agent/instrumentation/evented_subscriber.rb +0 -104
  328. data/lib/new_relic/agent/instrumentation/rails4/action_controller.rb +0 -32
  329. data/lib/new_relic/agent/instrumentation/rails5/action_view.rb +0 -27
  330. data/lib/new_relic/agent/sampled_buffer.rb +0 -68
  331. data/lib/new_relic/agent/sized_buffer.rb +0 -23
  332. data/lib/new_relic/agent/synthetics_event_buffer.rb +0 -40
  333. data/lib/new_relic/agent/throughput_monitor.rb +0 -59
  334. data/lib/new_relic/agent/transaction/attributes.rb +0 -153
  335. data/lib/new_relic/agent/transaction/xray_sample_buffer.rb +0 -64
  336. data/lib/new_relic/agent/transaction_state.rb +0 -145
  337. data/lib/new_relic/agent/transaction_timings.rb +0 -57
  338. data/lib/new_relic/metrics.rb +0 -13
  339. data/lib/tasks/versions.html.erb +0 -28
  340. data/lib/tasks/versions.postface.html +0 -8
  341. data/lib/tasks/versions.preface.html +0 -9
  342. data/lib/tasks/versions.rake +0 -65
  343. data/lib/tasks/versions.txt.erb +0 -14
@@ -0,0 +1,24 @@
1
+ # Ruby Agent Roadmap
2
+
3
+ ## Product Vision
4
+ The goal of the Ruby agent is to provide complete visibility into the health of your service. The agent provides metrics about the runtime health of your service and the process it runs in, and traces that show how specific requests are performing. It also provides information about the environment in which it is running, so you can identify issues with specific hosts, regions, deployments, and other facets.
5
+
6
+ New Relic is moving toward OpenTelemetry. OpenTelemetry is a unified standard for service instrumentation. You will soon see an updated version of the agent that uses the OpenTelemetry SDK and auto-instrumentation as its foundation. OpenTelemetry will include a broad set of high-quality community-contributed instrumentation and a powerful vendor-neutral API for adding your own instrumentation.
7
+
8
+
9
+ ## Roadmap
10
+ ### Description
11
+ This roadmap project is broken down into the following sections:
12
+
13
+ - **Now**:
14
+ - This section contains features that are currently in progress.
15
+ - **Next**:
16
+ - This section contains work planned within the next three months. These features may still be deprioritized and moved to Future.
17
+ - **Future**:
18
+ - This section is for ideas for future work that is aligned with the product vision and possible opportunities for community contribution. It contains a list of features that anyone can implement. No guarantees can be provided on if or when these features will be completed.
19
+
20
+
21
+ **The roadmap project is found [here](https://github.com/orgs/newrelic/projects/12)**
22
+
23
+ #### Disclaimers
24
+ > This roadmap is subject to change at any time. Future items should not be considered commitments.
data/Rakefile CHANGED
@@ -113,6 +113,7 @@ namespace :cross_agent_tests do
113
113
  cross_agent_tests_upstream_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'cross_agent_tests'))
114
114
  cross_agent_tests_local_path = File.expand_path(File.join(File.dirname(__FILE__), 'test', 'fixtures', 'cross_agent_tests'))
115
115
 
116
+ # Note: before you pull, make sure your local repo is on the correct, synced branch!
116
117
  desc 'Pull latest changes from cross_agent_tests repo'
117
118
  task :pull do
118
119
  puts "Updating embedded cross_agent_tests from #{cross_agent_tests_upstream_path}..."
@@ -136,3 +137,4 @@ task :console do
136
137
  ARGV.clear
137
138
  Pry.start
138
139
  end
140
+
@@ -0,0 +1,213 @@
1
+ # Third Party Notices
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.
6
+
7
+ In the event that a required notice is missing or incorrect, please notify us
8
+ by e-mailing [open-source@newrelic.com](mailto:open-source@newrelic.com).
9
+
10
+ For any licenses that require the disclosure of source
11
+ code, the source code can be found at:
12
+ [https://github.com/newrelic/newrelic-ruby-agent](https://github.com/newrelic/newrelic-ruby-agent).
13
+
14
+ ## Content
15
+
16
+ * [symantec](#symantec)
17
+
18
+ ### symantec
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):
22
+
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
+ ```
@@ -2,7 +2,7 @@
2
2
 
3
3
  # encoding: utf-8
4
4
  # This file is distributed under New Relic's license terms.
5
- # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
5
+ # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
6
6
 
7
7
  require 'tempfile'
8
8
  require 'rbconfig'
data/config.dot CHANGED
@@ -1,7 +1,6 @@
1
1
  digraph AgentEnabled {
2
2
  node[color=green]
3
3
  "[agent_enabled]"
4
- "[developer_mode]"
5
4
  "[monitor_mode]"
6
5
  "[slow_sql.explain_threshold]"
7
6
  "[slow_sql.stack_trace_threshold]"
@@ -19,9 +18,9 @@ digraph AgentEnabled {
19
18
  "[error_collector.capture_source]"
20
19
  "[error_collector.enabled]"
21
20
  "[error_collector.ignore_errors]"
21
+ "[error_collector.max_backtrace_frames]"
22
22
  "[browser_monitoring.auto_instrument]"
23
23
  "[license_key]"
24
- "[ssl]"
25
24
  "[verify_certificate]"
26
25
  "[api_host]"
27
26
  "[api_port]"
@@ -43,7 +42,7 @@ digraph AgentEnabled {
43
42
  "[dispatcher]"
44
43
  "[force_send]"
45
44
  "[textmate]"
46
- "[post_size_limit]"
45
+ "[max_payload_size_in_bytes]"
47
46
  "[sync_startup]"
48
47
  "[send_data_on_exit]"
49
48
  "[high_security]"
@@ -164,14 +163,12 @@ digraph AgentEnabled {
164
163
  "Control#server_from_host" -> "[host]"
165
164
  "Control#server_from_host" -> "[port]"
166
165
  "Control#server_from_host" -> "Control#convert_to_ip_address"
167
- "Control#http_connection" -> "[ssl]"
168
166
  "Control#http_connection" -> "[verify_certificate]"
169
167
  "Control#http_connection" -> "Control#proxy_server"
170
168
  "Control#set_log_level!" -> "[log_level]"
171
169
  "Control#log_path" -> "[log_file_path]"
172
170
  "Control#log_path" -> "Control#log_to_stdout?"
173
171
  "Control#log_to_stdout?" -> "[log_file_path]"
174
- "Control#convert_to_ip_address" -> "[ssl]"
175
172
  "Control#convert_to_ip_address" -> "[verify_certificate]"
176
173
  "Control#server" -> "Control#server_from_host"
177
174
  "Control#setup_log" -> "Control#set_log_level!"
@@ -201,7 +198,6 @@ digraph AgentEnabled {
201
198
  "Agent#validate_settings" -> "[validate_token]"
202
199
  "Agent#log_error" -> "Control#server"
203
200
  "Agent#monitoring?" -> "[monitor_mode]"
204
- "Agent#check_trasaction_sampler_status" -> "[developer_mode]"
205
201
  "Agent#check_sql_sampler_status" -> "[slow_sql.enabled]"
206
202
  "Agent#check_sql_sampler_status" -> "[slow_sql.record_sql]"
207
203
  "Agent#check_sql_sampler_status" -> "[transaction_tracer.enabled]"
@@ -216,7 +212,6 @@ digraph AgentEnabled {
216
212
  "MethodTracer#remove_method_tracer" -> "[agent_enabled]"
217
213
 
218
214
  "Rails#init_config" -> "[agent_enabled]"
219
- "Rails#init_config" -> "[developer_mode]"
220
215
 
221
216
  "ErrorCollector#initialize" -> "[error_collector.enabled]"
222
217
  "ErrorCollector#initialize" -> "[error_collector.capture_source]"
@@ -226,7 +221,7 @@ digraph AgentEnabled {
226
221
  "NewRelicService#initialize" -> "[timeout]"
227
222
  "NewRelicService#initialize" -> "[license_key]"
228
223
  "NewRelicService#initialize" -> "Control#server"
229
- "NewRelicService#check_post_size" -> "[post_size_limit]"
224
+ "NewRelicService#check_post_size" -> "[max_payload_size_in_bytes]"
230
225
  "NewRelicService#connect" -> "Control#server_from_host"
231
226
  "NewRelicService#send_request" -> "Control#http_connection"
232
227
 
@@ -240,10 +235,6 @@ digraph AgentEnabled {
240
235
  "TransactionSampler#configure!" -> "[transaction_tracer.explain_threshold]"
241
236
  "TransactionSampler#configure!" -> "[transaction_tracer.explain_enabled]"
242
237
  "TransactionSampler#configure!" -> "[transaction_tracer.transaction_threshold]"
243
- "TransactionSampler#configure!" -> "[developer_mode]"
244
- "TransactionSampler#notice_push_scope" -> "[developer_mode]"
245
- "TransactionSampler#capture_segment_trace" -> "[developer_mode]"
246
- "TransactionSampler#store_segment_for_developer_mode" -> "[developer_mode]"
247
238
 
248
239
  "NoticedError#initialize" -> "[high_security]"
249
240
 
data/init.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  # This file is distributed under New Relic's license terms.
3
- # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
3
+ # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
4
4
 
5
5
  # This is the initialization for the New Relic Ruby Agent when used as
6
6
  # a plugin
data/install.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  # This file is distributed under New Relic's license terms.
3
- # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
3
+ # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
4
4
 
5
5
  if __FILE__ == $0 || $0 =~ /script\/plugin/ || File.basename($0) == 'rake'
6
6
  $LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), 'lib'))
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  # This file is distributed under New Relic's license terms.
3
- # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
3
+ # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
4
4
 
5
5
  require 'forwardable'
6
6
 
@@ -26,16 +26,15 @@ module NewRelic
26
26
 
27
27
  require 'new_relic/version'
28
28
  require 'new_relic/local_environment'
29
- require 'new_relic/metrics'
30
29
  require 'new_relic/metric_spec'
31
30
  require 'new_relic/metric_data'
32
31
  require 'new_relic/noticed_error'
32
+ require 'new_relic/agent/noticible_error'
33
33
  require 'new_relic/supportability_helper'
34
34
 
35
35
  require 'new_relic/agent/encoding_normalizer'
36
36
  require 'new_relic/agent/stats'
37
37
  require 'new_relic/agent/chained_call'
38
- require 'new_relic/agent/cross_app_monitor'
39
38
  require 'new_relic/agent/agent'
40
39
  require 'new_relic/agent/method_tracer'
41
40
  require 'new_relic/agent/worker_loop'
@@ -45,7 +44,6 @@ module NewRelic
45
44
  require 'new_relic/agent/sql_sampler'
46
45
  require 'new_relic/agent/commands/thread_profiler_session'
47
46
  require 'new_relic/agent/error_collector'
48
- require 'new_relic/agent/busy_calculator'
49
47
  require 'new_relic/agent/sampler'
50
48
  require 'new_relic/agent/database'
51
49
  require 'new_relic/agent/datastores'
@@ -55,6 +53,10 @@ module NewRelic
55
53
  require 'new_relic/agent/http_clients/uri_util'
56
54
  require 'new_relic/agent/system_info'
57
55
  require 'new_relic/agent/external'
56
+ require 'new_relic/agent/deprecator'
57
+ require 'new_relic/agent/logging'
58
+ require 'new_relic/agent/distributed_tracing'
59
+ require 'new_relic/agent/attribute_processing'
58
60
 
59
61
  require 'new_relic/agent/instrumentation/controller_instrumentation'
60
62
 
@@ -76,7 +78,11 @@ module NewRelic
76
78
  class ForceDisconnectException < StandardError; end
77
79
 
78
80
  # An exception that forces an agent to restart.
79
- class ForceRestartException < StandardError; end
81
+ class ForceRestartException < StandardError
82
+ def message
83
+ "#{super}, restarting."
84
+ end
85
+ end
80
86
 
81
87
  # Used to blow out of a periodic task without logging a an error, such as for routine
82
88
  # failures.
@@ -99,6 +105,8 @@ module NewRelic
99
105
 
100
106
  @agent = nil
101
107
  @logger = nil
108
+ @tracer_lock = Mutex.new
109
+ @tracer_queue = []
102
110
 
103
111
  # The singleton Agent instance. Used internally.
104
112
  def agent #:nodoc:
@@ -110,6 +118,7 @@ module NewRelic
110
118
 
111
119
  def agent=(new_instance)#:nodoc:
112
120
  @agent = new_instance
121
+ add_deferred_method_tracers_now
113
122
  end
114
123
 
115
124
  alias instance agent #:nodoc:
@@ -124,6 +133,30 @@ module NewRelic
124
133
  @logger = log
125
134
  end
126
135
 
136
+ # A third-party class may call add_method_tracer before the agent
137
+ # is initialized; these methods enable us to defer these calls
138
+ # until we have started up and can process them.
139
+ #
140
+ def add_or_defer_method_tracer(receiver, method_name, metric_name_code, options)
141
+ @tracer_lock.synchronize do
142
+ if @agent
143
+ receiver.send(:_add_method_tracer_now, method_name, metric_name_code, options)
144
+ else
145
+ @tracer_queue << [receiver, method_name, metric_name_code, options]
146
+ end
147
+ end
148
+ end
149
+
150
+ def add_deferred_method_tracers_now
151
+ @tracer_lock.synchronize do
152
+ @tracer_queue.each do |receiver, method_name, metric_name_code, options|
153
+ receiver.send(:_add_method_tracer_now, method_name, metric_name_code, options)
154
+ end
155
+
156
+ @tracer_queue = []
157
+ end
158
+ end
159
+
127
160
  def config
128
161
  @config ||= Configuration::Manager.new
129
162
  end
@@ -179,11 +212,17 @@ module NewRelic
179
212
  # This method is safe to use from any thread.
180
213
  #
181
214
  # @api public
215
+
216
+ SUPPORTABILITY_INCREMENT_METRIC = 'Supportability/API/increment_metric'.freeze
217
+
182
218
  def increment_metric(metric_name, amount=1) #THREAD_LOCAL_ACCESS
183
219
  return unless agent
184
-
185
- { 'Supportability/API/increment_metric' => 1, metric_name => amount }.each do |metric, increment_amount|
186
- agent.stats_engine.tl_record_unscoped_metrics(metric) {|stats| stats.increment_count(increment_amount) }
220
+ if amount == 1
221
+ metrics = [metric_name, SUPPORTABILITY_INCREMENT_METRIC]
222
+ agent.stats_engine.tl_record_unscoped_metrics(metrics) {|stats| stats.increment_count}
223
+ else
224
+ agent.stats_engine.tl_record_unscoped_metrics(metric_name) {|stats| stats.increment_count(amount)}
225
+ agent.stats_engine.tl_record_unscoped_metrics(SUPPORTABILITY_INCREMENT_METRIC) {|stats| stats.increment_count}
187
226
  end
188
227
  end
189
228
 
@@ -313,10 +352,9 @@ module NewRelic
313
352
  # @api public
314
353
  #
315
354
  def manual_start(options={})
316
- record_api_supportability_metric(:manual_start)
317
-
318
355
  raise "Options must be a hash" unless Hash === options
319
356
  NewRelic::Control.instance.init_plugin({ :agent_enabled => true, :sync_startup => true }.merge(options))
357
+ record_api_supportability_metric(:manual_start)
320
358
  end
321
359
 
322
360
  # Register this method as a callback for processes that fork
@@ -454,7 +492,7 @@ module NewRelic
454
492
  # Yield to the block without collecting any metrics or traces in
455
493
  # any of the subsequent calls. If executed recursively, will keep
456
494
  # track of the first entry point and turn on tracing again after
457
- # leaving that block. This uses the thread local TransactionState.
495
+ # leaving that block. This uses the thread local Tracer::State.
458
496
  #
459
497
  # @api public
460
498
  #
@@ -477,16 +515,10 @@ module NewRelic
477
515
  # @api public
478
516
  #
479
517
  def disable_transaction_tracing
518
+ Deprecator.deprecate :disable_transaction_tracing,
519
+ 'disable_all_tracing or ignore_transaction'
480
520
  record_api_supportability_metric(:disable_transaction_tracing)
481
-
482
- return yield unless agent
483
-
484
- state = agent.set_record_tt(false)
485
- begin
486
- yield
487
- ensure
488
- agent.set_record_tt(state)
489
- end
521
+ yield
490
522
  end
491
523
 
492
524
  # This method sets the state of sql recording in the transaction
@@ -517,19 +549,13 @@ module NewRelic
517
549
 
518
550
  # Check to see if we are capturing metrics currently on this thread.
519
551
  def tl_is_execution_traced?
520
- NewRelic::Agent::TransactionState.tl_get.is_execution_traced?
521
- end
522
-
523
- # helper method to check the thread local to determine whether the
524
- # transaction in progress is traced or not
525
- def tl_is_transaction_traced?
526
- NewRelic::Agent::TransactionState.tl_get.is_transaction_traced?
552
+ NewRelic::Agent::Tracer.state.is_execution_traced?
527
553
  end
528
554
 
529
555
  # helper method to check the thread local to determine whether sql
530
556
  # is being recorded or not
531
557
  def tl_is_sql_recorded?
532
- NewRelic::Agent::TransactionState.tl_get.is_sql_recorded?
558
+ NewRelic::Agent::Tracer.state.is_sql_recorded?
533
559
  end
534
560
 
535
561
  # @!group Adding custom attributes to traces
@@ -542,6 +568,12 @@ module NewRelic
542
568
  # these custom attributes will also be present in the script injected into
543
569
  # the response body, making them available on Insights PageView events.
544
570
  #
571
+ #
572
+ # @param [Hash] params A Hash of attributes to be attached to the transaction event.
573
+ # Keys should be strings or symbols, and values
574
+ # may be strings, symbols, numeric values or
575
+ # booleans.
576
+ #
545
577
  # @api public
546
578
  #
547
579
  def add_custom_attributes(params) #THREAD_LOCAL_ACCESS
@@ -550,11 +582,43 @@ module NewRelic
550
582
  if params.is_a? Hash
551
583
  txn = Transaction.tl_current
552
584
  txn.add_custom_attributes(params) if txn
585
+
586
+ segment = ::NewRelic::Agent::Tracer.current_segment
587
+ if segment
588
+ # Make sure not to override existing segment-level custom attributes
589
+ segment_custom_keys = segment.attributes.custom_attributes.keys.map(&:to_sym)
590
+ segment.add_custom_attributes(params.reject { |k, _v| segment_custom_keys.include?(k.to_sym) })
591
+ end
553
592
  else
554
593
  ::NewRelic::Agent.logger.warn("Bad argument passed to #add_custom_attributes. Expected Hash but got #{params.class}")
555
594
  end
556
595
  end
557
596
 
597
+ # Add custom attributes to the span event for the current span. Attributes will be visible on spans in the
598
+ # New Relic Distributed Tracing UI and on span events in New Relic Insights.
599
+ #
600
+ # Custom attributes will not be transmitted when +high_security+ setting is enabled or
601
+ # +custom_attributes+ setting is disabled.
602
+ #
603
+ # @param [Hash] params A Hash of attributes to be attached to the span event.
604
+ # Keys should be strings or symbols, and values
605
+ # may be strings, symbols, numeric values or
606
+ # booleans.
607
+ #
608
+ # @see https://docs.newrelic.com/docs/using-new-relic/welcome-new-relic/get-started/glossary#span
609
+ # @api public
610
+ def add_custom_span_attributes params
611
+ record_api_supportability_metric :add_custom_span_attributes
612
+
613
+ if params.is_a? Hash
614
+ if segment = NewRelic::Agent::Tracer.current_segment
615
+ segment.add_custom_attributes params
616
+ end
617
+ else
618
+ ::NewRelic::Agent.logger.warn "Bad argument passed to #add_custom_span_attributes. Expected Hash but got #{params.class}"
619
+ end
620
+ end
621
+
558
622
  # @!endgroup
559
623
 
560
624
  # @!group Transaction naming
@@ -563,7 +627,9 @@ module NewRelic
563
627
  # apply a reasonable default based on framework routing, but in
564
628
  # cases where this is insufficient, this can be used to manually
565
629
  # control the name of the transaction.
566
- # The category of transaction can be specified via the +:category+ option:
630
+ #
631
+ # The category of transaction can be specified via the +:category+ option.
632
+ # The following are the only valid categories:
567
633
  #
568
634
  # * <tt>:category => :controller</tt> indicates that this is a
569
635
  # controller action and will appear with all the other actions.
@@ -613,8 +679,8 @@ module NewRelic
613
679
  # @param [String] method the name of the finder method or other method to
614
680
  # identify the operation with.
615
681
  #
616
- def with_database_metric_name(model, method = nil, product = nil, &block) #THREAD_LOCAL_ACCESS
617
- if txn = Transaction.tl_current
682
+ def with_database_metric_name(model, method = nil, product = nil, &block)
683
+ if txn = Tracer.current_transaction
618
684
  txn.with_database_metric_name(model, method, product, &block)
619
685
  else
620
686
  yield
@@ -635,6 +701,54 @@ module NewRelic
635
701
  NewRelic::Agent.logger.debug "Ignoring exception during %p event notification" % [event_type]
636
702
  end
637
703
 
704
+ # @!group Trace and Entity metadata
705
+
706
+ TRACE_ID_KEY = 'trace.id'.freeze
707
+ SPAN_ID_KEY = 'span.id'.freeze
708
+ ENTITY_NAME_KEY = 'entity.name'.freeze
709
+ ENTITY_TYPE_KEY = 'entity.type'.freeze
710
+ ENTITY_GUID_KEY = 'entity.guid'.freeze
711
+ HOSTNAME_KEY = 'hostname'.freeze
712
+
713
+ ENTITY_TYPE = 'SERVICE'.freeze
714
+
715
+ # Returns a new hash containing trace and entity metadata that can be used
716
+ # to relate data to a trace or to an entity in APM.
717
+ #
718
+ # This hash includes:
719
+ # * trace.id - The current trace id, if there is a current trace id. This
720
+ # value may be omitted.
721
+ # * span.id - The current span id, if there is a current span. This
722
+ # value may be omitted.
723
+ # * entity.name - The name of the current application. This is read from
724
+ # the +app_name+ key in your config. If there are multiple application
725
+ # names, the first one is used.
726
+ # * entity.type - The entity type is hardcoded to the string +'SERVICE'+.
727
+ # * entity.guid - The guid of the current entity.
728
+ # * hostname - The fully qualified hostname.
729
+ #
730
+ # @api public
731
+ def linking_metadata
732
+ metadata = Hash.new
733
+ metadata[ENTITY_NAME_KEY] = config[:app_name][0]
734
+ metadata[ENTITY_TYPE_KEY] = ENTITY_TYPE
735
+ metadata[HOSTNAME_KEY] = Hostname.get
736
+
737
+ if entity_guid = config[:entity_guid]
738
+ metadata[ENTITY_GUID_KEY] = entity_guid
739
+ end
740
+
741
+ if trace_id = Tracer.current_trace_id
742
+ metadata[TRACE_ID_KEY] = trace_id
743
+ end
744
+ if span_id = Tracer.current_span_id
745
+ metadata[SPAN_ID_KEY] = span_id
746
+ end
747
+ metadata
748
+ end
749
+
750
+ #@!endgroup
751
+
638
752
  # @!group Manual browser monitoring configuration
639
753
 
640
754
  # This method returns a string suitable for inclusion in a page - known as