newrelic_rpm 6.9.0.363 → 6.13.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (314) hide show
  1. checksums.yaml +4 -4
  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 +6 -0
  28. data/CHANGELOG.md +254 -10
  29. data/CONTRIBUTING.md +106 -19
  30. data/Gemfile +6 -2
  31. data/LICENSE +208 -38
  32. data/README.md +81 -85
  33. data/ROADMAP.md +24 -0
  34. data/Rakefile +2 -0
  35. data/THIRD_PARTY_NOTICES.md +213 -0
  36. data/bin/nrdebug +1 -1
  37. data/init.rb +1 -1
  38. data/install.rb +1 -1
  39. data/lib/new_relic/agent.rb +14 -6
  40. data/lib/new_relic/agent/adaptive_sampler.rb +1 -1
  41. data/lib/new_relic/agent/agent.rb +15 -6
  42. data/lib/new_relic/agent/agent_logger.rb +1 -1
  43. data/lib/new_relic/agent/attribute_filter.rb +1 -1
  44. data/lib/new_relic/agent/attribute_processing.rb +1 -1
  45. data/lib/new_relic/agent/attributes.rb +3 -1
  46. data/lib/new_relic/agent/audit_logger.rb +1 -1
  47. data/lib/new_relic/agent/autostart.rb +1 -1
  48. data/lib/new_relic/agent/chained_call.rb +1 -1
  49. data/lib/new_relic/agent/commands/agent_command.rb +1 -1
  50. data/lib/new_relic/agent/commands/agent_command_router.rb +1 -1
  51. data/lib/new_relic/agent/commands/thread_profiler_session.rb +1 -1
  52. data/lib/new_relic/agent/configuration.rb +1 -1
  53. data/lib/new_relic/agent/configuration/default_source.rb +28 -1
  54. data/lib/new_relic/agent/configuration/dotted_hash.rb +1 -1
  55. data/lib/new_relic/agent/configuration/environment_source.rb +1 -1
  56. data/lib/new_relic/agent/configuration/event_harvest_config.rb +1 -1
  57. data/lib/new_relic/agent/configuration/high_security_source.rb +1 -1
  58. data/lib/new_relic/agent/configuration/manager.rb +1 -1
  59. data/lib/new_relic/agent/configuration/manual_source.rb +1 -1
  60. data/lib/new_relic/agent/configuration/mask_defaults.rb +1 -1
  61. data/lib/new_relic/agent/configuration/security_policy_source.rb +1 -1
  62. data/lib/new_relic/agent/configuration/server_source.rb +1 -1
  63. data/lib/new_relic/agent/configuration/yaml_source.rb +1 -1
  64. data/lib/new_relic/agent/connect/request_builder.rb +1 -1
  65. data/lib/new_relic/agent/connect/response_handler.rb +1 -1
  66. data/lib/new_relic/agent/custom_event_aggregator.rb +1 -1
  67. data/lib/new_relic/agent/database.rb +1 -1
  68. data/lib/new_relic/agent/database/explain_plan_helpers.rb +1 -1
  69. data/lib/new_relic/agent/database/obfuscation_helpers.rb +2 -2
  70. data/lib/new_relic/agent/database/obfuscator.rb +1 -1
  71. data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +1 -1
  72. data/lib/new_relic/agent/datastores.rb +1 -1
  73. data/lib/new_relic/agent/datastores/metric_helper.rb +1 -1
  74. data/lib/new_relic/agent/datastores/mongo.rb +2 -2
  75. data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +1 -1
  76. data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +1 -1
  77. data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +1 -1
  78. data/lib/new_relic/agent/datastores/mongo/statement_formatter.rb +1 -1
  79. data/lib/new_relic/agent/datastores/redis.rb +1 -1
  80. data/lib/new_relic/agent/deprecator.rb +1 -1
  81. data/lib/new_relic/agent/distributed_tracing.rb +1 -1
  82. data/lib/new_relic/agent/distributed_tracing/cross_app_payload.rb +3 -2
  83. data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +1 -1
  84. data/lib/new_relic/agent/distributed_tracing/{distributed_trace_intrinsics.rb → distributed_trace_attributes.rb} +9 -5
  85. data/lib/new_relic/agent/distributed_tracing/distributed_trace_metrics.rb +1 -1
  86. data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +3 -4
  87. data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +1 -1
  88. data/lib/new_relic/agent/distributed_tracing/trace_context.rb +1 -1
  89. data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +2 -2
  90. data/lib/new_relic/agent/encoding_normalizer.rb +1 -1
  91. data/lib/new_relic/agent/error_collector.rb +31 -12
  92. data/lib/new_relic/agent/error_event_aggregator.rb +5 -5
  93. data/lib/new_relic/agent/error_trace_aggregator.rb +1 -1
  94. data/lib/new_relic/agent/event_aggregator.rb +1 -1
  95. data/lib/new_relic/agent/event_buffer.rb +1 -1
  96. data/lib/new_relic/agent/event_listener.rb +1 -1
  97. data/lib/new_relic/agent/event_loop.rb +1 -1
  98. data/lib/new_relic/agent/external.rb +1 -1
  99. data/lib/new_relic/agent/guid_generator.rb +1 -1
  100. data/lib/new_relic/agent/harvester.rb +1 -1
  101. data/lib/new_relic/agent/heap.rb +1 -1
  102. data/lib/new_relic/agent/hostname.rb +8 -2
  103. data/lib/new_relic/agent/http_clients/abstract.rb +82 -0
  104. data/lib/new_relic/agent/http_clients/curb_wrappers.rb +25 -20
  105. data/lib/new_relic/agent/http_clients/excon_wrappers.rb +29 -14
  106. data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +18 -22
  107. data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +11 -12
  108. data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +17 -5
  109. data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +5 -7
  110. data/lib/new_relic/agent/http_clients/uri_util.rb +12 -11
  111. data/lib/new_relic/agent/instrumentation.rb +1 -1
  112. data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +5 -6
  113. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +5 -1
  114. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +12 -3
  115. data/lib/new_relic/agent/instrumentation/active_job.rb +1 -1
  116. data/lib/new_relic/agent/instrumentation/active_merchant.rb +1 -1
  117. data/lib/new_relic/agent/instrumentation/active_record.rb +85 -38
  118. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +82 -24
  119. data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +1 -1
  120. data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +92 -34
  121. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +8 -3
  122. data/lib/new_relic/agent/instrumentation/active_storage.rb +1 -1
  123. data/lib/new_relic/agent/instrumentation/active_storage_subscriber.rb +9 -5
  124. data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +24 -8
  125. data/lib/new_relic/agent/instrumentation/authlogic.rb +1 -1
  126. data/lib/new_relic/agent/instrumentation/bunny.rb +114 -51
  127. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +1 -1
  128. data/lib/new_relic/agent/instrumentation/curb.rb +92 -27
  129. data/lib/new_relic/agent/instrumentation/data_mapper.rb +4 -2
  130. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +61 -25
  131. data/lib/new_relic/agent/instrumentation/excon.rb +1 -1
  132. data/lib/new_relic/agent/instrumentation/excon/connection.rb +7 -4
  133. data/lib/new_relic/agent/instrumentation/excon/middleware.rb +3 -2
  134. data/lib/new_relic/agent/instrumentation/grape.rb +1 -1
  135. data/lib/new_relic/agent/instrumentation/http.rb +6 -3
  136. data/lib/new_relic/agent/instrumentation/httpclient.rb +5 -3
  137. data/lib/new_relic/agent/instrumentation/ignore_actions.rb +1 -1
  138. data/lib/new_relic/agent/instrumentation/memcache.rb +4 -2
  139. data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +7 -3
  140. data/lib/new_relic/agent/instrumentation/merb/controller.rb +1 -1
  141. data/lib/new_relic/agent/instrumentation/merb/errors.rb +1 -1
  142. data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +12 -4
  143. data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +9 -7
  144. data/lib/new_relic/agent/instrumentation/mongo.rb +10 -4
  145. data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +36 -3
  146. data/lib/new_relic/agent/instrumentation/net.rb +59 -22
  147. data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +26 -2
  148. data/lib/new_relic/agent/instrumentation/padrino.rb +40 -16
  149. data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +1 -1
  150. data/lib/new_relic/agent/instrumentation/queue_time.rb +1 -1
  151. data/lib/new_relic/agent/instrumentation/rack.rb +36 -13
  152. data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +1 -1
  153. data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +1 -1
  154. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +1 -1
  155. data/lib/new_relic/agent/instrumentation/rails_middleware.rb +1 -1
  156. data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +1 -1
  157. data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +1 -1
  158. data/lib/new_relic/agent/instrumentation/rails_notifications/action_view.rb +1 -1
  159. data/lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb +1 -1
  160. data/lib/new_relic/agent/instrumentation/rake.rb +55 -20
  161. data/lib/new_relic/agent/instrumentation/redis.rb +141 -56
  162. data/lib/new_relic/agent/instrumentation/resque.rb +1 -1
  163. data/lib/new_relic/agent/instrumentation/sequel.rb +1 -1
  164. data/lib/new_relic/agent/instrumentation/sequel_helper.rb +1 -1
  165. data/lib/new_relic/agent/instrumentation/sidekiq.rb +48 -24
  166. data/lib/new_relic/agent/instrumentation/sinatra.rb +62 -23
  167. data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +1 -1
  168. data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +1 -1
  169. data/lib/new_relic/agent/instrumentation/sunspot.rb +1 -1
  170. data/lib/new_relic/agent/instrumentation/typhoeus.rb +23 -6
  171. data/lib/new_relic/agent/internal_agent_error.rb +1 -1
  172. data/lib/new_relic/agent/javascript_instrumentor.rb +1 -1
  173. data/lib/new_relic/agent/log_once.rb +1 -1
  174. data/lib/new_relic/agent/logging.rb +2 -2
  175. data/lib/new_relic/agent/memory_logger.rb +1 -1
  176. data/lib/new_relic/agent/messaging.rb +1 -1
  177. data/lib/new_relic/agent/method_tracer.rb +16 -5
  178. data/lib/new_relic/agent/method_tracer_helpers.rb +2 -2
  179. data/lib/new_relic/agent/monitors.rb +1 -1
  180. data/lib/new_relic/agent/monitors/cross_app_monitor.rb +1 -1
  181. data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +1 -1
  182. data/lib/new_relic/agent/monitors/inbound_request_monitor.rb +1 -1
  183. data/lib/new_relic/agent/monitors/synthetics_monitor.rb +1 -1
  184. data/lib/new_relic/agent/new_relic_service.rb +26 -5
  185. data/lib/new_relic/agent/new_relic_service/encoders.rb +1 -1
  186. data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +1 -1
  187. data/lib/new_relic/agent/new_relic_service/marshaller.rb +1 -1
  188. data/lib/new_relic/agent/new_relic_service/security_policy_settings.rb +1 -1
  189. data/lib/new_relic/agent/noticible_error.rb +22 -0
  190. data/lib/new_relic/agent/null_logger.rb +1 -1
  191. data/lib/new_relic/agent/obfuscator.rb +1 -1
  192. data/lib/new_relic/agent/parameter_filtering.rb +1 -1
  193. data/lib/new_relic/agent/payload_metric_mapping.rb +1 -1
  194. data/lib/new_relic/agent/pipe_channel_manager.rb +1 -1
  195. data/lib/new_relic/agent/pipe_service.rb +1 -1
  196. data/lib/new_relic/agent/prepend_supportability.rb +1 -1
  197. data/lib/new_relic/agent/priority_sampled_buffer.rb +8 -5
  198. data/lib/new_relic/agent/range_extensions.rb +1 -1
  199. data/lib/new_relic/agent/rules_engine.rb +1 -1
  200. data/lib/new_relic/agent/rules_engine/replacement_rule.rb +1 -1
  201. data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +1 -1
  202. data/lib/new_relic/agent/sampler.rb +1 -1
  203. data/lib/new_relic/agent/sampler_collection.rb +1 -1
  204. data/lib/new_relic/agent/samplers/cpu_sampler.rb +1 -1
  205. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +1 -1
  206. data/lib/new_relic/agent/samplers/memory_sampler.rb +1 -1
  207. data/lib/new_relic/agent/samplers/object_sampler.rb +1 -1
  208. data/lib/new_relic/agent/samplers/vm_sampler.rb +1 -1
  209. data/lib/new_relic/agent/span_event_aggregator.rb +1 -1
  210. data/lib/new_relic/agent/span_event_primitive.rb +71 -37
  211. data/lib/new_relic/agent/sql_sampler.rb +4 -4
  212. data/lib/new_relic/agent/stats.rb +1 -1
  213. data/lib/new_relic/agent/stats_engine.rb +1 -1
  214. data/lib/new_relic/agent/stats_engine/gc_profiler.rb +1 -1
  215. data/lib/new_relic/agent/stats_engine/stats_hash.rb +1 -1
  216. data/lib/new_relic/agent/supported_versions.rb +1 -1
  217. data/lib/new_relic/agent/synthetics_event_aggregator.rb +1 -1
  218. data/lib/new_relic/agent/system_info.rb +13 -4
  219. data/lib/new_relic/agent/threading/agent_thread.rb +1 -1
  220. data/lib/new_relic/agent/threading/backtrace_node.rb +1 -1
  221. data/lib/new_relic/agent/threading/backtrace_service.rb +1 -1
  222. data/lib/new_relic/agent/threading/thread_profile.rb +1 -1
  223. data/lib/new_relic/agent/timestamp_sampled_buffer.rb +1 -1
  224. data/lib/new_relic/agent/tracer.rb +31 -16
  225. data/lib/new_relic/agent/transaction.rb +67 -46
  226. data/lib/new_relic/agent/transaction/abstract_segment.rb +29 -2
  227. data/lib/new_relic/agent/transaction/datastore_segment.rb +1 -1
  228. data/lib/new_relic/agent/transaction/distributed_tracer.rb +3 -3
  229. data/lib/new_relic/agent/transaction/distributed_tracing.rb +2 -2
  230. data/lib/new_relic/agent/transaction/external_request_segment.rb +28 -12
  231. data/lib/new_relic/agent/transaction/message_broker_segment.rb +1 -1
  232. data/lib/new_relic/agent/transaction/request_attributes.rb +1 -1
  233. data/lib/new_relic/agent/transaction/segment.rb +23 -3
  234. data/lib/new_relic/agent/transaction/slowest_sample_buffer.rb +1 -1
  235. data/lib/new_relic/agent/transaction/synthetics_sample_buffer.rb +1 -1
  236. data/lib/new_relic/agent/transaction/trace.rb +1 -1
  237. data/lib/new_relic/agent/transaction/trace_builder.rb +1 -1
  238. data/lib/new_relic/agent/transaction/trace_context.rb +1 -1
  239. data/lib/new_relic/agent/transaction/trace_node.rb +1 -1
  240. data/lib/new_relic/agent/transaction/tracing.rb +1 -1
  241. data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -1
  242. data/lib/new_relic/agent/transaction_error_primitive.rb +8 -6
  243. data/lib/new_relic/agent/transaction_event_aggregator.rb +1 -1
  244. data/lib/new_relic/agent/transaction_event_primitive.rb +3 -3
  245. data/lib/new_relic/agent/transaction_event_recorder.rb +1 -1
  246. data/lib/new_relic/agent/transaction_metrics.rb +1 -1
  247. data/lib/new_relic/agent/transaction_sampler.rb +1 -1
  248. data/lib/new_relic/agent/transaction_time_aggregator.rb +1 -1
  249. data/lib/new_relic/agent/utilization/aws.rb +1 -1
  250. data/lib/new_relic/agent/utilization/azure.rb +1 -1
  251. data/lib/new_relic/agent/utilization/gcp.rb +1 -1
  252. data/lib/new_relic/agent/utilization/pcf.rb +1 -1
  253. data/lib/new_relic/agent/utilization/vendor.rb +1 -1
  254. data/lib/new_relic/agent/utilization_data.rb +1 -1
  255. data/lib/new_relic/agent/vm.rb +1 -1
  256. data/lib/new_relic/agent/vm/jruby_vm.rb +1 -1
  257. data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +1 -1
  258. data/lib/new_relic/agent/vm/mri_vm.rb +1 -1
  259. data/lib/new_relic/agent/vm/snapshot.rb +1 -1
  260. data/lib/new_relic/agent/worker_loop.rb +1 -1
  261. data/lib/new_relic/cli/command.rb +1 -1
  262. data/lib/new_relic/cli/commands/deployments.rb +1 -1
  263. data/lib/new_relic/cli/commands/install.rb +4 -3
  264. data/lib/new_relic/coerce.rb +1 -1
  265. data/lib/new_relic/collection_helper.rb +1 -1
  266. data/lib/new_relic/constants.rb +5 -1
  267. data/lib/new_relic/control.rb +1 -1
  268. data/lib/new_relic/control/class_methods.rb +1 -1
  269. data/lib/new_relic/control/frameworks.rb +1 -1
  270. data/lib/new_relic/control/frameworks/external.rb +1 -1
  271. data/lib/new_relic/control/frameworks/merb.rb +1 -1
  272. data/lib/new_relic/control/frameworks/rails.rb +1 -1
  273. data/lib/new_relic/control/frameworks/rails3.rb +1 -1
  274. data/lib/new_relic/control/frameworks/rails4.rb +1 -1
  275. data/lib/new_relic/control/frameworks/rails_notifications.rb +1 -1
  276. data/lib/new_relic/control/frameworks/ruby.rb +1 -1
  277. data/lib/new_relic/control/frameworks/sinatra.rb +1 -1
  278. data/lib/new_relic/control/instance_methods.rb +1 -1
  279. data/lib/new_relic/control/instrumentation.rb +1 -1
  280. data/lib/new_relic/control/server_methods.rb +1 -1
  281. data/lib/new_relic/delayed_job_injection.rb +1 -1
  282. data/lib/new_relic/dependency_detection.rb +1 -1
  283. data/lib/new_relic/environment_report.rb +6 -2
  284. data/lib/new_relic/helper.rb +1 -1
  285. data/lib/new_relic/language_support.rb +1 -1
  286. data/lib/new_relic/latest_changes.rb +2 -2
  287. data/lib/new_relic/local_environment.rb +1 -1
  288. data/lib/new_relic/metric_data.rb +1 -1
  289. data/lib/new_relic/metric_spec.rb +1 -1
  290. data/lib/new_relic/noticed_error.rb +29 -10
  291. data/lib/new_relic/rack.rb +1 -1
  292. data/lib/new_relic/rack/agent_hooks.rb +1 -1
  293. data/lib/new_relic/rack/agent_middleware.rb +1 -1
  294. data/lib/new_relic/rack/browser_monitoring.rb +3 -2
  295. data/lib/new_relic/recipes.rb +1 -1
  296. data/lib/new_relic/recipes/capistrano3.rb +1 -1
  297. data/lib/new_relic/recipes/capistrano_legacy.rb +1 -1
  298. data/lib/new_relic/supportability_helper.rb +1 -1
  299. data/lib/new_relic/version.rb +3 -3
  300. data/lib/newrelic_rpm.rb +1 -1
  301. data/lib/sequel/extensions/newrelic_instrumentation.rb +1 -1
  302. data/lib/sequel/plugins/newrelic_instrumentation.rb +1 -1
  303. data/lib/tasks/all.rb +1 -1
  304. data/lib/tasks/multiverse.rb +35 -1
  305. data/lib/tasks/newrelic.rb +1 -1
  306. data/lib/tasks/tests.rake +1 -1
  307. data/newrelic_rpm.gemspec +10 -9
  308. data/recipes/newrelic.rb +1 -1
  309. data/test/agent_helper.rb +237 -70
  310. metadata +42 -18
  311. data/.travis.yml +0 -210
  312. data/lib/new_relic/agent/http_clients/abstract_request.rb +0 -31
  313. data/lib/new_relic/metrics.rb +0 -13
  314. data/true +0 -0
@@ -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/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,10 +26,10 @@ 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'
@@ -56,7 +56,8 @@ module NewRelic
56
56
  require 'new_relic/agent/deprecator'
57
57
  require 'new_relic/agent/logging'
58
58
  require 'new_relic/agent/distributed_tracing'
59
-
59
+ require 'new_relic/agent/attribute_processing'
60
+
60
61
  require 'new_relic/agent/instrumentation/controller_instrumentation'
61
62
 
62
63
  require 'new_relic/agent/samplers/cpu_sampler'
@@ -581,6 +582,13 @@ module NewRelic
581
582
  if params.is_a? Hash
582
583
  txn = Transaction.tl_current
583
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
584
592
  else
585
593
  ::NewRelic::Agent.logger.warn("Bad argument passed to #add_custom_attributes. Expected Hash but got #{params.class}")
586
594
  end
@@ -620,7 +628,7 @@ module NewRelic
620
628
  # cases where this is insufficient, this can be used to manually
621
629
  # control the name of the transaction.
622
630
  #
623
- # The category of transaction can be specified via the +:category+ option.
631
+ # The category of transaction can be specified via the +:category+ option.
624
632
  # The following are the only valid categories:
625
633
  #
626
634
  # * <tt>:category => :controller</tt> indicates that this is a
@@ -671,8 +679,8 @@ module NewRelic
671
679
  # @param [String] method the name of the finder method or other method to
672
680
  # identify the operation with.
673
681
  #
674
- def with_database_metric_name(model, method = nil, product = nil, &block) #THREAD_LOCAL_ACCESS
675
- if txn = Transaction.tl_current
682
+ def with_database_metric_name(model, method = nil, product = nil, &block)
683
+ if txn = Tracer.current_transaction
676
684
  txn.with_database_metric_name(model, method, product, &block)
677
685
  else
678
686
  yield
@@ -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
  module NewRelic
6
6
  module Agent
@@ -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 'socket'
6
6
  require 'net/https'
@@ -134,7 +134,7 @@ module NewRelic
134
134
  # and request before/after from Rack.
135
135
  attr_reader :events
136
136
 
137
- # listens and responds to events that need to process headers
137
+ # listens and responds to events that need to process headers
138
138
  # for synthetics and distributed tracing
139
139
  attr_reader :monitors
140
140
  # Transaction and metric renaming rules as provided by the
@@ -244,12 +244,19 @@ module NewRelic
244
244
  Agent.config.remove_config_type(:server)
245
245
  end
246
246
 
247
+ # If the @worker_thread encounters an error during the attempt to connect to the collector
248
+ # then the connect attempts enter an exponential backoff retry loop. To avoid potential
249
+ # race conditions with shutting down while also attempting to reconnect, we join the
250
+ # @worker_thread with a timeout threshold. This allows potentially connecting and flushing
251
+ # pending data to the server, but without waiting indefinitely for a reconnect to succeed.
252
+ # The use-case where this typically arises is in cronjob scheduled rake tasks where there's
253
+ # also some network stability/latency issues happening.
247
254
  def stop_event_loop
248
255
  @event_loop.stop if @event_loop
249
256
  # Wait the end of the event loop thread.
250
257
  if @worker_thread
251
258
  unless @worker_thread.join(3)
252
- ::NewRelic::Agent.logger.error "Event loop thread did not stop within 3 seconds"
259
+ ::NewRelic::Agent.logger.debug "Event loop thread did not stop within 3 seconds"
253
260
  end
254
261
  end
255
262
  end
@@ -757,10 +764,8 @@ module NewRelic
757
764
  # /agents/agent-specs/Collector-Response-Handling.md, retry
758
765
  # connections after a specific backoff sequence to prevent
759
766
  # hammering the server.
760
- CONNECT_RETRY_PERIODS = [15, 15, 30, 60, 120, 300]
761
-
762
767
  def connect_retry_period
763
- CONNECT_RETRY_PERIODS[connect_attempts] || 300
768
+ NewRelic::CONNECT_RETRY_PERIODS[connect_attempts] || NewRelic::MAX_RETRY_PERIOD
764
769
  end
765
770
 
766
771
  def note_connect_failure
@@ -948,6 +953,10 @@ module NewRelic
948
953
  rescue NewRelic::Agent::UnrecoverableAgentException => e
949
954
  handle_unrecoverable_agent_error(e)
950
955
  rescue StandardError, Timeout::Error, NewRelic::Agent::ServerConnectionException => e
956
+ # Allow a killed (aborting) thread to continue exiting during shutdown.
957
+ # See: https://github.com/newrelic/newrelic-ruby-agent/issues/340
958
+ raise if Thread.current.status == 'aborting'
959
+
951
960
  log_error(e)
952
961
  if opts[:keep_retrying]
953
962
  note_connect_failure
@@ -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 'thread'
6
6
  require 'logger'
@@ -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 class applies filtering rules as specified in the Agent Attributes
6
6
  # cross-agent spec.
@@ -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
  module NewRelic
6
6
  module Agent
@@ -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 'new_relic/agent/attribute_processing'
6
6
 
@@ -11,6 +11,8 @@ module NewRelic
11
11
  VALUE_LIMIT = 255
12
12
  COUNT_LIMIT = 64
13
13
 
14
+ attr_reader :custom_attributes
15
+
14
16
  def initialize(filter)
15
17
  @filter = filter
16
18