newrelic_rpm 7.0.0 → 8.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (320) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -1
  3. data/.rubocop.yml +1941 -0
  4. data/.yardopts +1 -0
  5. data/Brewfile +10 -0
  6. data/CHANGELOG.md +431 -1
  7. data/CONTRIBUTING.md +32 -5
  8. data/DOCKER.md +167 -0
  9. data/Dockerfile +10 -0
  10. data/Guardfile +8 -8
  11. data/LICENSE +0 -6
  12. data/README.md +20 -18
  13. data/Rakefile +39 -29
  14. data/THIRD_PARTY_NOTICES.md +14 -199
  15. data/bin/mongrel_rpm +8 -9
  16. data/bin/newrelic +1 -1
  17. data/bin/nrdebug +14 -14
  18. data/docker-compose.yml +85 -0
  19. data/init.rb +0 -2
  20. data/lefthook.yml +9 -0
  21. data/lib/new_relic/agent/adaptive_sampler.rb +9 -5
  22. data/lib/new_relic/agent/agent.rb +72 -49
  23. data/lib/new_relic/agent/agent_logger.rb +15 -9
  24. data/lib/new_relic/agent/attribute_filter.rb +31 -31
  25. data/lib/new_relic/agent/attributes.rb +2 -2
  26. data/lib/new_relic/agent/audit_logger.rb +4 -0
  27. data/lib/new_relic/agent/autostart.rb +19 -17
  28. data/lib/new_relic/agent/commands/agent_command.rb +2 -2
  29. data/lib/new_relic/agent/commands/agent_command_router.rb +6 -5
  30. data/lib/new_relic/agent/commands/thread_profiler_session.rb +7 -6
  31. data/lib/new_relic/agent/configuration/default_source.rb +731 -476
  32. data/lib/new_relic/agent/configuration/dotted_hash.rb +3 -3
  33. data/lib/new_relic/agent/configuration/environment_source.rb +5 -4
  34. data/lib/new_relic/agent/configuration/event_harvest_config.rb +39 -16
  35. data/lib/new_relic/agent/configuration/high_security_source.rb +7 -7
  36. data/lib/new_relic/agent/configuration/manager.rb +74 -64
  37. data/lib/new_relic/agent/configuration/mask_defaults.rb +1 -1
  38. data/lib/new_relic/agent/configuration/security_policy_source.rb +73 -73
  39. data/lib/new_relic/agent/configuration/server_source.rb +14 -12
  40. data/lib/new_relic/agent/configuration/yaml_source.rb +26 -5
  41. data/lib/new_relic/agent/connect/request_builder.rb +14 -15
  42. data/lib/new_relic/agent/connect/response_handler.rb +0 -3
  43. data/lib/new_relic/agent/custom_event_aggregator.rb +9 -9
  44. data/lib/new_relic/agent/database/explain_plan_helpers.rb +3 -4
  45. data/lib/new_relic/agent/database/obfuscation_helpers.rb +12 -12
  46. data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +2 -2
  47. data/lib/new_relic/agent/database.rb +30 -31
  48. data/lib/new_relic/agent/datastores/metric_helper.rb +13 -11
  49. data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +2 -3
  50. data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +3 -5
  51. data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +1 -2
  52. data/lib/new_relic/agent/datastores/mongo.rb +5 -10
  53. data/lib/new_relic/agent/datastores/redis.rb +2 -4
  54. data/lib/new_relic/agent/datastores.rb +7 -9
  55. data/lib/new_relic/agent/distributed_tracing/cross_app_payload.rb +9 -9
  56. data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +21 -16
  57. data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +10 -12
  58. data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +42 -43
  59. data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +3 -3
  60. data/lib/new_relic/agent/distributed_tracing/trace_context.rb +41 -43
  61. data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +25 -25
  62. data/lib/new_relic/agent/distributed_tracing.rb +17 -18
  63. data/lib/new_relic/agent/encoding_normalizer.rb +1 -1
  64. data/lib/new_relic/agent/error_collector.rb +65 -50
  65. data/lib/new_relic/agent/error_event_aggregator.rb +1 -1
  66. data/lib/new_relic/agent/error_filter.rb +173 -0
  67. data/lib/new_relic/agent/error_trace_aggregator.rb +1 -1
  68. data/lib/new_relic/agent/event_aggregator.rb +1 -1
  69. data/lib/new_relic/agent/event_buffer.rb +6 -7
  70. data/lib/new_relic/agent/event_listener.rb +0 -1
  71. data/lib/new_relic/agent/event_loop.rb +14 -14
  72. data/lib/new_relic/agent/external.rb +1 -34
  73. data/lib/new_relic/agent/guid_generator.rb +2 -9
  74. data/lib/new_relic/agent/harvester.rb +3 -4
  75. data/lib/new_relic/agent/heap.rb +1 -3
  76. data/lib/new_relic/agent/hostname.rb +16 -10
  77. data/lib/new_relic/agent/http_clients/abstract.rb +7 -9
  78. data/lib/new_relic/agent/http_clients/curb_wrappers.rb +1 -5
  79. data/lib/new_relic/agent/http_clients/excon_wrappers.rb +4 -4
  80. data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +3 -3
  81. data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +1 -2
  82. data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +8 -3
  83. data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +2 -3
  84. data/lib/new_relic/agent/http_clients/uri_util.rb +0 -1
  85. data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +2 -3
  86. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +28 -26
  87. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +5 -7
  88. data/lib/new_relic/agent/instrumentation/active_job.rb +12 -5
  89. data/lib/new_relic/agent/instrumentation/active_merchant.rb +17 -3
  90. data/lib/new_relic/agent/instrumentation/active_record.rb +20 -18
  91. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +56 -46
  92. data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +28 -25
  93. data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +3 -3
  94. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +22 -16
  95. data/lib/new_relic/agent/instrumentation/active_storage.rb +1 -1
  96. data/lib/new_relic/agent/instrumentation/active_support_logger/chain.rb +23 -0
  97. data/lib/new_relic/agent/instrumentation/active_support_logger/instrumentation.rb +20 -0
  98. data/lib/new_relic/agent/instrumentation/active_support_logger/prepend.rb +12 -0
  99. data/lib/new_relic/agent/instrumentation/active_support_logger.rb +24 -0
  100. data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +18 -9
  101. data/lib/new_relic/agent/instrumentation/authlogic.rb +10 -0
  102. data/lib/new_relic/agent/instrumentation/bunny/chain.rb +1 -1
  103. data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +8 -9
  104. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +52 -46
  105. data/lib/new_relic/agent/instrumentation/curb/chain.rb +20 -21
  106. data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +34 -38
  107. data/lib/new_relic/agent/instrumentation/curb/prepend.rb +10 -11
  108. data/lib/new_relic/agent/instrumentation/data_mapper.rb +22 -10
  109. data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +5 -7
  110. data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +5 -9
  111. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +23 -4
  112. data/lib/new_relic/agent/instrumentation/excon/middleware.rb +2 -2
  113. data/lib/new_relic/agent/instrumentation/excon.rb +3 -23
  114. data/lib/new_relic/agent/instrumentation/grape/chain.rb +1 -2
  115. data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +6 -7
  116. data/lib/new_relic/agent/instrumentation/grape.rb +2 -3
  117. data/lib/new_relic/agent/instrumentation/httpclient/chain.rb +2 -3
  118. data/lib/new_relic/agent/instrumentation/httpclient/instrumentation.rb +0 -1
  119. data/lib/new_relic/agent/instrumentation/httpclient/prepend.rb +0 -2
  120. data/lib/new_relic/agent/instrumentation/httprb/chain.rb +2 -2
  121. data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +6 -6
  122. data/lib/new_relic/agent/instrumentation/httprb/prepend.rb +1 -1
  123. data/lib/new_relic/agent/instrumentation/ignore_actions.rb +2 -3
  124. data/lib/new_relic/agent/instrumentation/logger/chain.rb +21 -0
  125. data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +58 -0
  126. data/lib/new_relic/agent/instrumentation/logger/prepend.rb +13 -0
  127. data/lib/new_relic/agent/instrumentation/logger.rb +26 -0
  128. data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +7 -2
  129. data/lib/new_relic/agent/instrumentation/memcache/helper.rb +5 -1
  130. data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +9 -2
  131. data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +9 -10
  132. data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +5 -6
  133. data/lib/new_relic/agent/instrumentation/mongo.rb +3 -141
  134. data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +4 -4
  135. data/lib/new_relic/agent/instrumentation/net_http/chain.rb +3 -4
  136. data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +5 -5
  137. data/lib/new_relic/agent/instrumentation/net_http/prepend.rb +4 -4
  138. data/lib/new_relic/agent/instrumentation/net_http.rb +7 -2
  139. data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +2 -3
  140. data/lib/new_relic/agent/instrumentation/padrino/chain.rb +23 -19
  141. data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +3 -2
  142. data/lib/new_relic/agent/instrumentation/padrino/prepend.rb +2 -2
  143. data/lib/new_relic/agent/instrumentation/padrino.rb +2 -5
  144. data/lib/new_relic/agent/instrumentation/queue_time.rb +8 -8
  145. data/lib/new_relic/agent/instrumentation/rack/chain.rb +8 -7
  146. data/lib/new_relic/agent/instrumentation/rack/helpers.rb +2 -1
  147. data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +4 -5
  148. data/lib/new_relic/agent/instrumentation/rack/prepend.rb +2 -2
  149. data/lib/new_relic/agent/instrumentation/rack.rb +1 -1
  150. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +11 -47
  151. data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +2 -2
  152. data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +0 -1
  153. data/lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb +11 -0
  154. data/lib/new_relic/agent/instrumentation/rake/chain.rb +0 -5
  155. data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +6 -6
  156. data/lib/new_relic/agent/instrumentation/rake.rb +1 -1
  157. data/lib/new_relic/agent/instrumentation/redis/chain.rb +6 -6
  158. data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +2 -2
  159. data/lib/new_relic/agent/instrumentation/redis/prepend.rb +1 -1
  160. data/lib/new_relic/agent/instrumentation/redis.rb +5 -1
  161. data/lib/new_relic/agent/instrumentation/resque/chain.rb +2 -3
  162. data/lib/new_relic/agent/instrumentation/resque/helper.rb +19 -0
  163. data/lib/new_relic/agent/instrumentation/resque/instrumentation.rb +9 -7
  164. data/lib/new_relic/agent/instrumentation/resque/prepend.rb +1 -2
  165. data/lib/new_relic/agent/instrumentation/resque.rb +17 -8
  166. data/lib/new_relic/agent/instrumentation/sequel.rb +7 -9
  167. data/lib/new_relic/agent/instrumentation/sequel_helper.rb +1 -1
  168. data/lib/new_relic/agent/instrumentation/sidekiq.rb +22 -1
  169. data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +0 -1
  170. data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +12 -5
  171. data/lib/new_relic/agent/instrumentation/sinatra.rb +21 -11
  172. data/lib/new_relic/agent/instrumentation/sunspot.rb +11 -1
  173. data/lib/new_relic/agent/instrumentation/thread/chain.rb +24 -0
  174. data/lib/new_relic/agent/instrumentation/thread/instrumentation.rb +27 -0
  175. data/lib/new_relic/agent/instrumentation/thread/prepend.rb +22 -0
  176. data/lib/new_relic/agent/instrumentation/thread.rb +20 -0
  177. data/lib/new_relic/agent/instrumentation/tilt/chain.rb +24 -0
  178. data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +40 -0
  179. data/lib/new_relic/agent/instrumentation/tilt/prepend.rb +13 -0
  180. data/lib/new_relic/agent/instrumentation/tilt.rb +25 -0
  181. data/lib/new_relic/agent/instrumentation/typhoeus/chain.rb +4 -4
  182. data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +3 -5
  183. data/lib/new_relic/agent/instrumentation/typhoeus/prepend.rb +1 -1
  184. data/lib/new_relic/agent/internal_agent_error.rb +1 -1
  185. data/lib/new_relic/agent/javascript_instrumentor.rb +38 -33
  186. data/lib/new_relic/agent/linking_metadata.rb +45 -0
  187. data/lib/new_relic/agent/local_log_decorator.rb +37 -0
  188. data/lib/new_relic/agent/log_event_aggregator.rb +234 -0
  189. data/lib/new_relic/agent/log_priority.rb +20 -0
  190. data/lib/new_relic/agent/logging.rb +11 -8
  191. data/lib/new_relic/agent/memory_logger.rb +1 -1
  192. data/lib/new_relic/agent/messaging.rb +46 -62
  193. data/lib/new_relic/agent/method_tracer.rb +145 -144
  194. data/lib/new_relic/agent/method_tracer_helpers.rb +82 -2
  195. data/lib/new_relic/agent/monitors/cross_app_monitor.rb +21 -13
  196. data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +2 -2
  197. data/lib/new_relic/agent/monitors/inbound_request_monitor.rb +0 -1
  198. data/lib/new_relic/agent/monitors/synthetics_monitor.rb +4 -7
  199. data/lib/new_relic/agent/monitors.rb +1 -2
  200. data/lib/new_relic/agent/new_relic_service/encoders.rb +4 -4
  201. data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +1 -1
  202. data/lib/new_relic/agent/new_relic_service/marshaller.rb +1 -1
  203. data/lib/new_relic/agent/new_relic_service/security_policy_settings.rb +4 -3
  204. data/lib/new_relic/agent/new_relic_service.rb +61 -53
  205. data/lib/new_relic/agent/noticible_error.rb +0 -2
  206. data/lib/new_relic/agent/null_logger.rb +6 -2
  207. data/lib/new_relic/agent/obfuscator.rb +6 -8
  208. data/lib/new_relic/agent/parameter_filtering.rb +16 -8
  209. data/lib/new_relic/agent/payload_metric_mapping.rb +8 -9
  210. data/lib/new_relic/agent/pipe_channel_manager.rb +15 -12
  211. data/lib/new_relic/agent/pipe_service.rb +6 -3
  212. data/lib/new_relic/agent/priority_sampled_buffer.rb +4 -7
  213. data/lib/new_relic/agent/rules_engine/replacement_rule.rb +9 -9
  214. data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +12 -12
  215. data/lib/new_relic/agent/rules_engine.rb +2 -2
  216. data/lib/new_relic/agent/sampler.rb +2 -3
  217. data/lib/new_relic/agent/sampler_collection.rb +2 -3
  218. data/lib/new_relic/agent/samplers/cpu_sampler.rb +1 -1
  219. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +10 -7
  220. data/lib/new_relic/agent/samplers/memory_sampler.rb +9 -3
  221. data/lib/new_relic/agent/samplers/vm_sampler.rb +18 -18
  222. data/lib/new_relic/agent/span_event_aggregator.rb +10 -10
  223. data/lib/new_relic/agent/span_event_primitive.rb +48 -45
  224. data/lib/new_relic/agent/sql_sampler.rb +9 -9
  225. data/lib/new_relic/agent/stats.rb +62 -37
  226. data/lib/new_relic/agent/stats_engine/gc_profiler.rb +7 -9
  227. data/lib/new_relic/agent/stats_engine/stats_hash.rb +8 -9
  228. data/lib/new_relic/agent/stats_engine.rb +7 -7
  229. data/lib/new_relic/agent/synthetics_event_aggregator.rb +1 -2
  230. data/lib/new_relic/agent/system_info.rb +22 -20
  231. data/lib/new_relic/agent/threading/agent_thread.rb +4 -5
  232. data/lib/new_relic/agent/threading/backtrace_node.rb +6 -9
  233. data/lib/new_relic/agent/threading/backtrace_service.rb +12 -13
  234. data/lib/new_relic/agent/threading/thread_profile.rb +16 -19
  235. data/lib/new_relic/agent/tracer.rb +57 -72
  236. data/lib/new_relic/agent/transaction/abstract_segment.rb +38 -10
  237. data/lib/new_relic/agent/transaction/datastore_segment.rb +7 -6
  238. data/lib/new_relic/agent/transaction/distributed_tracer.rb +8 -9
  239. data/lib/new_relic/agent/transaction/distributed_tracing.rb +21 -22
  240. data/lib/new_relic/agent/transaction/external_request_segment.rb +6 -5
  241. data/lib/new_relic/agent/transaction/message_broker_segment.rb +24 -30
  242. data/lib/new_relic/agent/transaction/request_attributes.rb +7 -7
  243. data/lib/new_relic/agent/transaction/segment.rb +6 -3
  244. data/lib/new_relic/agent/transaction/slowest_sample_buffer.rb +0 -2
  245. data/lib/new_relic/agent/transaction/trace.rb +8 -8
  246. data/lib/new_relic/agent/transaction/trace_context.rb +14 -16
  247. data/lib/new_relic/agent/transaction/trace_node.rb +16 -16
  248. data/lib/new_relic/agent/transaction/tracing.rb +9 -6
  249. data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -2
  250. data/lib/new_relic/agent/transaction.rb +132 -119
  251. data/lib/new_relic/agent/transaction_error_primitive.rb +18 -16
  252. data/lib/new_relic/agent/transaction_event_aggregator.rb +7 -8
  253. data/lib/new_relic/agent/transaction_event_primitive.rb +29 -29
  254. data/lib/new_relic/agent/transaction_event_recorder.rb +1 -1
  255. data/lib/new_relic/agent/transaction_metrics.rb +8 -7
  256. data/lib/new_relic/agent/transaction_sampler.rb +0 -1
  257. data/lib/new_relic/agent/transaction_time_aggregator.rb +11 -11
  258. data/lib/new_relic/agent/utilization/aws.rb +32 -2
  259. data/lib/new_relic/agent/utilization/azure.rb +1 -1
  260. data/lib/new_relic/agent/utilization/vendor.rb +15 -2
  261. data/lib/new_relic/agent/utilization_data.rb +3 -4
  262. data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +1 -1
  263. data/lib/new_relic/agent/vm/mri_vm.rb +13 -1
  264. data/lib/new_relic/agent/vm/snapshot.rb +4 -4
  265. data/lib/new_relic/agent/worker_loop.rb +8 -10
  266. data/lib/new_relic/agent.rb +36 -41
  267. data/lib/new_relic/cli/command.rb +15 -17
  268. data/lib/new_relic/cli/commands/deployments.rb +21 -23
  269. data/lib/new_relic/cli/commands/install.rb +6 -10
  270. data/lib/new_relic/coerce.rb +5 -8
  271. data/lib/new_relic/collection_helper.rb +48 -47
  272. data/lib/new_relic/constants.rb +0 -4
  273. data/lib/new_relic/control/class_methods.rb +2 -2
  274. data/lib/new_relic/control/frameworks/external.rb +1 -1
  275. data/lib/new_relic/control/frameworks/rails.rb +5 -6
  276. data/lib/new_relic/control/frameworks/rails3.rb +2 -3
  277. data/lib/new_relic/control/frameworks/ruby.rb +2 -2
  278. data/lib/new_relic/control/frameworks/sinatra.rb +6 -0
  279. data/lib/new_relic/control/instance_methods.rb +4 -5
  280. data/lib/new_relic/control/instrumentation.rb +35 -5
  281. data/lib/new_relic/control/server_methods.rb +2 -3
  282. data/lib/new_relic/control.rb +0 -1
  283. data/lib/new_relic/dependency_detection.rb +7 -9
  284. data/lib/new_relic/environment_report.rb +16 -18
  285. data/lib/new_relic/helper.rb +45 -5
  286. data/lib/new_relic/language_support.rb +20 -2
  287. data/lib/new_relic/latest_changes.rb +2 -2
  288. data/lib/new_relic/local_environment.rb +9 -7
  289. data/lib/new_relic/metric_data.rb +6 -7
  290. data/lib/new_relic/metric_spec.rb +3 -3
  291. data/lib/new_relic/noticed_error.rb +18 -19
  292. data/lib/new_relic/rack/agent_middleware.rb +2 -2
  293. data/lib/new_relic/rack/browser_monitoring.rb +9 -9
  294. data/lib/new_relic/recipes/capistrano3.rb +11 -13
  295. data/lib/new_relic/recipes/capistrano_legacy.rb +11 -14
  296. data/lib/new_relic/supportability_helper.rb +2 -2
  297. data/lib/new_relic/traced_thread.rb +35 -0
  298. data/lib/new_relic/version.rb +5 -16
  299. data/lib/newrelic_rpm.rb +10 -34
  300. data/lib/sequel/extensions/newrelic_instrumentation.rb +4 -7
  301. data/lib/sequel/plugins/newrelic_instrumentation.rb +3 -9
  302. data/lib/tasks/all.rb +2 -2
  303. data/lib/tasks/config.html.erb +14 -25
  304. data/lib/tasks/config.rake +36 -27
  305. data/lib/tasks/multiverse.rb +4 -6
  306. data/lib/tasks/tests.rake +3 -7
  307. data/newrelic.yml +610 -3
  308. data/newrelic_rpm.gemspec +14 -14
  309. data/recipes/newrelic.rb +1 -1
  310. data/test/agent_helper.rb +98 -59
  311. metadata +69 -20
  312. data/ROADMAP.md +0 -24
  313. data/lib/new_relic/agent/datastores/mongo/statement_formatter.rb +0 -53
  314. data/lib/new_relic/agent/instrumentation/excon/connection.rb +0 -49
  315. data/lib/new_relic/agent/instrumentation/merb/controller.rb +0 -44
  316. data/lib/new_relic/agent/instrumentation/merb/errors.rb +0 -33
  317. data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +0 -125
  318. data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +0 -46
  319. data/lib/new_relic/agent/supported_versions.rb +0 -275
  320. data/lib/new_relic/control/frameworks/merb.rb +0 -29
@@ -11,27 +11,25 @@ require 'new_relic/agent/threading/backtrace_node'
11
11
  module NewRelic
12
12
  module Agent
13
13
  module Threading
14
-
15
14
  class ThreadProfile
16
-
17
15
  attr_reader :profile_id, :traces, :sample_period,
18
16
  :duration, :poll_count, :backtrace_count, :failure_count,
19
17
  :created_at, :command_arguments, :profile_agent_code
20
18
  attr_accessor :finished_at
21
19
 
22
- def initialize(command_arguments={})
23
- @command_arguments = command_arguments
24
- @profile_id = command_arguments.fetch('profile_id', -1)
25
- @duration = command_arguments.fetch('duration', 120)
26
- @sample_period = command_arguments.fetch('sample_period', 0.1)
20
+ def initialize(command_arguments = {})
21
+ @command_arguments = command_arguments
22
+ @profile_id = command_arguments.fetch('profile_id', -1)
23
+ @duration = command_arguments.fetch('duration', 120)
24
+ @sample_period = command_arguments.fetch('sample_period', 0.1)
27
25
  @profile_agent_code = command_arguments.fetch('profile_agent_code', false)
28
26
  @finished = false
29
27
 
30
28
  @traces = {
31
- :agent => BacktraceRoot.new,
29
+ :agent => BacktraceRoot.new,
32
30
  :background => BacktraceRoot.new,
33
- :other => BacktraceRoot.new,
34
- :request => BacktraceRoot.new
31
+ :other => BacktraceRoot.new,
32
+ :request => BacktraceRoot.new
35
33
  }
36
34
 
37
35
  @poll_count = 0
@@ -39,7 +37,7 @@ module NewRelic
39
37
  @failure_count = 0
40
38
  @unique_threads = []
41
39
 
42
- @created_at = Time.now
40
+ @created_at = Process.clock_gettime(Process::CLOCK_REALTIME)
43
41
  end
44
42
 
45
43
  def requested_period
@@ -69,17 +67,17 @@ module NewRelic
69
67
  end
70
68
  end
71
69
 
72
- def convert_N_trace_nodes_to_arrays(count_to_keep) #THREAD_LOCAL_ACCESS
70
+ def convert_N_trace_nodes_to_arrays(count_to_keep) # THREAD_LOCAL_ACCESS
73
71
  all_nodes = @traces.values.map { |n| n.flattened }.flatten
74
72
 
75
- NewRelic::Agent.instance.stats_engine.
76
- tl_record_supportability_metric_count("ThreadProfiler/NodeCount", all_nodes.size)
73
+ NewRelic::Agent.instance.stats_engine
74
+ .tl_record_supportability_metric_count("ThreadProfiler/NodeCount", all_nodes.size)
77
75
 
78
76
  all_nodes.sort! do |a, b|
79
77
  # we primarily prefer higher runnable_count
80
78
  comparison = b.runnable_count <=> a.runnable_count
81
79
  # we secondarily prefer lower depth
82
- comparison = a.depth <=> b.depth if comparison == 0
80
+ comparison = a.depth <=> b.depth if comparison == 0
83
81
  # it is thus impossible for any child to preceed their parent
84
82
  comparison
85
83
  end
@@ -102,9 +100,9 @@ module NewRelic
102
100
  convert_N_trace_nodes_to_arrays(THREAD_PROFILER_NODES)
103
101
 
104
102
  {
105
- "OTHER" => @traces[:other ].as_array,
106
- "REQUEST" => @traces[:request ].as_array,
107
- "AGENT" => @traces[:agent ].as_array,
103
+ "OTHER" => @traces[:other].as_array,
104
+ "REQUEST" => @traces[:request].as_array,
105
+ "AGENT" => @traces[:agent].as_array,
108
106
  "BACKGROUND" => @traces[:background].as_array
109
107
  }
110
108
  end
@@ -128,7 +126,6 @@ module NewRelic
128
126
  "@profile_id: #{profile_id} "\
129
127
  "@command_arguments=#{@command_arguments.inspect}>"
130
128
  end
131
-
132
129
  end
133
130
  end
134
131
  end
@@ -86,9 +86,9 @@ module NewRelic
86
86
  #
87
87
  # @api public
88
88
  def in_transaction(name: nil,
89
- partial_name: nil,
90
- category: nil,
91
- options: {})
89
+ partial_name: nil,
90
+ category: nil,
91
+ options: {})
92
92
 
93
93
  finishable = start_transaction_or_segment(
94
94
  name: name,
@@ -130,15 +130,11 @@ module NewRelic
130
130
  #
131
131
  # @api public
132
132
  def start_transaction_or_segment(name: nil,
133
- partial_name: nil,
134
- category: nil,
135
- options: {})
136
- if name.nil? && partial_name.nil?
137
- raise ArgumentError, 'missing required argument: name or partial_name'
138
- end
139
- if category.nil?
140
- raise ArgumentError, 'missing required argument: category'
141
- end
133
+ partial_name: nil,
134
+ category:,
135
+ options: {})
136
+
137
+ raise ArgumentError, 'missing required argument: name or partial_name' if name.nil? && partial_name.nil?
142
138
 
143
139
  if name
144
140
  options[:transaction_name] = name
@@ -154,7 +150,6 @@ module NewRelic
154
150
  else
155
151
  Transaction.start_new_transaction(state, category, options)
156
152
  end
157
-
158
153
  rescue ArgumentError
159
154
  raise
160
155
  rescue => exception
@@ -163,16 +158,12 @@ module NewRelic
163
158
 
164
159
  # Takes name or partial_name and a category.
165
160
  # Returns a transaction instance or nil
166
- def start_transaction(name: nil,
167
- partial_name: nil,
168
- category: nil,
169
- **options)
170
- if name.nil? && partial_name.nil?
171
- raise ArgumentError, 'missing required argument: name or partial_name'
172
- end
173
- if category.nil?
174
- raise ArgumentError, 'missing required argument: category'
175
- end
161
+ def start_transaction(category:,
162
+ name: nil,
163
+ partial_name: nil,
164
+ **options)
165
+
166
+ raise ArgumentError, 'missing required argument: name or partial_name' if name.nil? && partial_name.nil?
176
167
 
177
168
  return current_transaction if current_transaction
178
169
 
@@ -186,8 +177,8 @@ module NewRelic
186
177
  end
187
178
 
188
179
  Transaction.start_new_transaction(state,
189
- category,
190
- options)
180
+ category,
181
+ options)
191
182
  rescue ArgumentError
192
183
  raise
193
184
  rescue => exception
@@ -238,17 +229,13 @@ module NewRelic
238
229
  # +finish+ on it at the end of the code you're tracing
239
230
  #
240
231
  # @api public
241
- def start_segment(name:nil,
242
- unscoped_metrics:nil,
243
- start_time: nil,
244
- parent: nil)
245
-
246
- # ruby 2.0.0 does not support required kwargs
247
- raise ArgumentError, 'missing required argument: name' if name.nil?
232
+ def start_segment(name:,
233
+ unscoped_metrics: nil,
234
+ start_time: nil,
235
+ parent: nil)
248
236
 
249
237
  segment = Transaction::Segment.new name, unscoped_metrics, start_time
250
238
  start_and_add_segment segment, parent
251
-
252
239
  rescue ArgumentError
253
240
  raise
254
241
  rescue => exception
@@ -294,20 +281,19 @@ module NewRelic
294
281
  #
295
282
  # @api public
296
283
  def start_datastore_segment(product: nil,
297
- operation: nil,
298
- collection: nil,
299
- host: nil,
300
- port_path_or_id: nil,
301
- database_name: nil,
302
- start_time: nil,
303
- parent: nil)
284
+ operation: nil,
285
+ collection: nil,
286
+ host: nil,
287
+ port_path_or_id: nil,
288
+ database_name: nil,
289
+ start_time: nil,
290
+ parent: nil)
304
291
 
305
292
  product ||= UNKNOWN
306
293
  operation ||= OTHER
307
294
 
308
295
  segment = Transaction::DatastoreSegment.new product, operation, collection, host, port_path_or_id, database_name
309
296
  start_and_add_segment segment, parent
310
-
311
297
  rescue ArgumentError
312
298
  raise
313
299
  rescue => exception
@@ -341,20 +327,14 @@ module NewRelic
341
327
  # you're tracing
342
328
  #
343
329
  # @api public
344
- def start_external_request_segment(library: nil,
345
- uri: nil,
346
- procedure: nil,
347
- start_time: nil,
348
- parent: nil)
349
-
350
- # ruby 2.0.0 does not support required kwargs
351
- raise ArgumentError, 'missing required argument: library' if library.nil?
352
- raise ArgumentError, 'missing required argument: uri' if uri.nil?
353
- raise ArgumentError, 'missing required argument: procedure' if procedure.nil?
330
+ def start_external_request_segment(library:,
331
+ uri:,
332
+ procedure:,
333
+ start_time: nil,
334
+ parent: nil)
354
335
 
355
336
  segment = Transaction::ExternalRequestSegment.new library, uri, procedure, start_time
356
337
  start_and_add_segment segment, parent
357
-
358
338
  rescue ArgumentError
359
339
  raise
360
340
  rescue => exception
@@ -363,7 +343,7 @@ module NewRelic
363
343
 
364
344
  # Will potentially capture and notice an error at the
365
345
  # segment that was executing when error occurred.
366
- # if passed +segment+ is something that doesn't
346
+ # if passed +segment+ is something that doesn't
367
347
  # respond to +notice_segment_error+ then this method
368
348
  # is effectively just a yield to the given &block
369
349
  def capture_segment_error segment
@@ -377,20 +357,14 @@ module NewRelic
377
357
  end
378
358
 
379
359
  # For New Relic internal use only.
380
- def start_message_broker_segment(action: nil,
381
- library: nil,
382
- destination_type: nil,
383
- destination_name: nil,
384
- headers: nil,
385
- parameters: nil,
386
- start_time: nil,
387
- parent: nil)
388
-
389
- # ruby 2.0.0 does not support required kwargs
390
- raise ArgumentError, 'missing required argument: action' if action.nil?
391
- raise ArgumentError, 'missing required argument: library' if library.nil?
392
- raise ArgumentError, 'missing required argument: destination_type' if destination_type.nil?
393
- raise ArgumentError, 'missing required argument: destination_name' if destination_name.nil?
360
+ def start_message_broker_segment(action:,
361
+ library:,
362
+ destination_type:,
363
+ destination_name:,
364
+ headers: nil,
365
+ parameters: nil,
366
+ start_time: nil,
367
+ parent: nil)
394
368
 
395
369
  segment = Transaction::MessageBrokerSegment.new(
396
370
  action: action,
@@ -402,7 +376,6 @@ module NewRelic
402
376
  start_time: start_time
403
377
  )
404
378
  start_and_add_segment segment, parent
405
-
406
379
  rescue ArgumentError
407
380
  raise
408
381
  rescue => exception
@@ -432,12 +405,25 @@ module NewRelic
432
405
 
433
406
  alias_method :tl_clear, :clear_state
434
407
 
408
+ def thread_block_with_current_transaction(*args, &block)
409
+ current_txn = ::Thread.current[:newrelic_tracer_state].current_transaction if ::Thread.current[:newrelic_tracer_state]
410
+ Proc.new do
411
+ begin
412
+ NewRelic::Agent::Tracer.state.current_transaction = current_txn
413
+ segment = NewRelic::Agent::Tracer.start_segment(name: "Ruby/Thread/#{::Thread.current.object_id}")
414
+ block.call(*args) if block.respond_to?(:call)
415
+ ensure
416
+ segment.finish if segment
417
+ end
418
+ end
419
+ end
420
+
435
421
  private
436
422
 
437
423
  def start_and_add_segment segment, parent = nil
438
424
  tracer_state = state
439
425
  if (txn = tracer_state.current_transaction) &&
440
- tracer_state.tracing_enabled?
426
+ tracer_state.tracing_enabled?
441
427
  txn.add_segment segment, parent
442
428
  else
443
429
  segment.record_metrics = false
@@ -455,7 +441,6 @@ module NewRelic
455
441
  # This is THE location to store thread local information during a transaction
456
442
  # Need a new piece of data? Add a method here, NOT a new thread local variable.
457
443
  class State
458
-
459
444
  def initialize
460
445
  @untraced = []
461
446
  @current_transaction = nil
@@ -463,7 +448,7 @@ module NewRelic
463
448
  end
464
449
 
465
450
  # This starts the timer for the transaction.
466
- def reset(transaction=nil)
451
+ def reset(transaction = nil)
467
452
  # We purposefully don't reset @untraced or @record_sql
468
453
  # since those are managed by NewRelic::Agent.disable_* calls explicitly
469
454
  # and (more importantly) outside the scope of a transaction
@@ -473,7 +458,7 @@ module NewRelic
473
458
  end
474
459
 
475
460
  # Current transaction stack
476
- attr_reader :current_transaction
461
+ attr_accessor :current_transaction
477
462
 
478
463
  # Execution tracing on current thread
479
464
  attr_accessor :untraced
@@ -20,13 +20,14 @@ module NewRelic
20
20
  # after its parent. We will use the optimized exclusive duration
21
21
  # calculation in all other cases.
22
22
  #
23
- attr_reader :start_time, :end_time, :duration, :exclusive_duration, :guid
23
+ attr_reader :start_time, :end_time, :duration, :exclusive_duration, :guid, :starting_thread_id
24
24
  attr_accessor :name, :parent, :children_time, :transaction, :transaction_name
25
25
  attr_writer :record_metrics, :record_scoped_metric, :record_on_finish
26
26
  attr_reader :noticed_error
27
27
 
28
- def initialize name=nil, start_time=nil
28
+ def initialize name = nil, start_time = nil
29
29
  @name = name
30
+ @starting_thread_id = ::Thread.current.object_id
30
31
  @transaction_name = nil
31
32
  @transaction = nil
32
33
  @guid = NewRelic::Agent::GuidGenerator.generate_guid
@@ -45,17 +46,22 @@ module NewRelic
45
46
  @record_scoped_metric = true
46
47
  @record_on_finish = false
47
48
  @noticed_error = nil
49
+ @code_filepath = nil
50
+ @code_function = nil
51
+ @code_lineno = nil
52
+ @code_namespace = nil
48
53
  end
49
54
 
50
55
  def start
51
- @start_time ||= Time.now
56
+ @start_time ||= Process.clock_gettime(Process::CLOCK_REALTIME)
52
57
  return unless transaction
53
58
  parent.child_start self if parent
54
59
  end
55
60
 
56
61
  def finish
57
- @end_time = Time.now
58
- @duration = end_time.to_f - start_time.to_f
62
+ @end_time = Process.clock_gettime(Process::CLOCK_REALTIME)
63
+ @duration = end_time - start_time
64
+
59
65
  return unless transaction
60
66
  run_complete_callbacks
61
67
  finalize if record_on_finish?
@@ -94,7 +100,7 @@ module NewRelic
94
100
  end
95
101
 
96
102
  def time_range
97
- @start_time.to_f .. @end_time.to_f
103
+ @start_time.to_f..@end_time.to_f
98
104
  end
99
105
 
100
106
  def children_time_ranges
@@ -109,6 +115,28 @@ module NewRelic
109
115
  @concurrent_children
110
116
  end
111
117
 
118
+ def code_information=(info = {})
119
+ return unless info[:filepath]
120
+
121
+ @code_filepath = info[:filepath]
122
+ @code_function = info[:function]
123
+ @code_lineno = info[:lineno]
124
+ @code_namespace = info[:namespace]
125
+ end
126
+
127
+ def all_code_information_present?
128
+ @code_filepath && @code_function && @code_lineno && @code_namespace
129
+ end
130
+
131
+ def code_attributes
132
+ return ::NewRelic::EMPTY_HASH unless all_code_information_present?
133
+
134
+ @code_attributes ||= {'code.filepath' => @code_filepath,
135
+ 'code.function' => @code_function,
136
+ 'code.lineno' => @code_lineno,
137
+ 'code.namespace' => @code_namespace}
138
+ end
139
+
112
140
  INSPECT_IGNORE = [:@transaction, :@transaction_state].freeze
113
141
 
114
142
  def inspect
@@ -131,7 +159,7 @@ module NewRelic
131
159
  @noticed_error = noticed_error
132
160
  end
133
161
 
134
- def notice_error exception, options={}
162
+ def notice_error exception, options = {}
135
163
  if Agent.config[:high_security]
136
164
  NewRelic::Agent.logger.debug \
137
165
  "Segment: #{name} ignores notice_error for " \
@@ -156,7 +184,7 @@ module NewRelic
156
184
 
157
185
  def child_start segment
158
186
  @active_children += 1
159
- @concurrent_children = @concurrent_children || @active_children > 1
187
+ @concurrent_children ||= @active_children > 1
160
188
 
161
189
  transaction.async = true if @concurrent_children
162
190
  end
@@ -180,7 +208,7 @@ module NewRelic
180
208
 
181
209
  def descendant_complete child, descendant
182
210
  RangeExtensions.merge_or_append descendant.time_range,
183
- children_time_ranges
211
+ children_time_ranges
184
212
  # If this child's time was previously added to this segment's
185
213
  # aggregate children time, we need to re-record it using a time range
186
214
  # for proper exclusive time calculation
@@ -227,7 +255,7 @@ module NewRelic
227
255
 
228
256
  def record_child_time_as_range child
229
257
  RangeExtensions.merge_or_append child.time_range,
230
- children_time_ranges
258
+ children_time_ranges
231
259
  child.range_recorded = true
232
260
  end
233
261
 
@@ -11,13 +11,11 @@ module NewRelic
11
11
  module Agent
12
12
  class Transaction
13
13
  class DatastoreSegment < Segment
14
-
15
14
  UNKNOWN = 'unknown'.freeze
16
15
 
17
16
  attr_reader :product, :operation, :collection, :sql_statement, :nosql_statement, :host, :port_path_or_id
18
17
  attr_accessor :database_name, :record_sql
19
18
 
20
-
21
19
  def initialize product, operation, collection = nil, host = nil, port_path_or_id = nil, database_name = nil, start_time = nil
22
20
  @product = product
23
21
  @operation = operation
@@ -63,7 +61,7 @@ module NewRelic
63
61
  end
64
62
 
65
63
  # @api private
66
- def _notice_sql sql, config=nil, explainer=nil, binds=nil, name=nil
64
+ def _notice_sql sql, config = nil, explainer = nil, binds = nil, name = nil
67
65
  return unless record_sql?
68
66
  @sql_statement = Database::Statement.new sql, config, explainer, binds, name, host, port_path_or_id, database_name
69
67
  end
@@ -120,8 +118,8 @@ module NewRelic
120
118
  NEWLINE = "\n".freeze
121
119
 
122
120
  def add_backtrace_parameter
123
- return unless duration >= Agent.config[:'transaction_tracer.stack_trace_threshold']
124
- params[:backtrace] = caller.join(NEWLINE)
121
+ return unless duration >= Agent.config[:'transaction_tracer.stack_trace_threshold']
122
+ params[:backtrace] = caller.join(NEWLINE)
125
123
  end
126
124
 
127
125
  def notice_sql_statement
@@ -138,8 +136,11 @@ module NewRelic
138
136
  end
139
137
 
140
138
  def record_span_event
139
+ # don't record a span event if the transaction is ignored
140
+ return if transaction.ignore?
141
+
141
142
  aggregator = ::NewRelic::Agent.agent.span_event_aggregator
142
- priority = transaction.priority
143
+ priority = transaction.priority
143
144
 
144
145
  aggregator.record(priority: priority) do
145
146
  SpanEventPrimitive.for_datastore_segment(self)
@@ -26,7 +26,7 @@ module NewRelic
26
26
  end
27
27
  end
28
28
 
29
- def accept_incoming_request request, transport_type=nil
29
+ def accept_incoming_request request, transport_type = nil
30
30
  accept_incoming_transport_type request, transport_type
31
31
  if trace_parent_header_present? request
32
32
  accept_trace_context_incoming_request request
@@ -73,6 +73,7 @@ module NewRelic
73
73
  end
74
74
 
75
75
  def insert_headers headers
76
+ return unless NewRelic::Agent.agent.connected?
76
77
  insert_trace_context_header headers
77
78
  insert_distributed_trace_header headers
78
79
  insert_cross_app_header headers
@@ -118,10 +119,10 @@ module NewRelic
118
119
  def consume_message_synthetics_headers headers
119
120
  synthetics_header = headers[CrossAppTracing::NR_MESSAGE_BROKER_SYNTHETICS_HEADER]
120
121
  if synthetics_header and
121
- incoming_payload = ::JSON.load(deobfuscate(synthetics_header)) and
122
- SyntheticsMonitor.is_valid_payload?(incoming_payload) and
123
- SyntheticsMonitor.is_supported_version?(incoming_payload) and
124
- SyntheticsMonitor.is_trusted?(incoming_payload)
122
+ incoming_payload = ::JSON.load(deobfuscate(synthetics_header)) and
123
+ SyntheticsMonitor.is_valid_payload?(incoming_payload) and
124
+ SyntheticsMonitor.is_supported_version?(incoming_payload) and
125
+ SyntheticsMonitor.is_trusted?(incoming_payload)
125
126
 
126
127
  transaction.raw_synthetics_header = synthetics_header
127
128
  transaction.synthetics_payload = incoming_payload
@@ -157,8 +158,8 @@ module NewRelic
157
158
 
158
159
  return unless CrossAppTracing.trusted_valid_cross_app_id?(decoded_id)
159
160
  txn_header = headers[CrossAppTracing::NR_MESSAGE_BROKER_TXN_HEADER]
160
- txn_info = ::JSON.load(deobfuscate(txn_header))
161
- payload = CrossAppPayload.new(decoded_id, transaction, txn_info)
161
+ txn_info = ::JSON.load(deobfuscate(txn_header))
162
+ payload = CrossAppPayload.new(decoded_id, transaction, txn_info)
162
163
 
163
164
  @cross_app_payload = payload
164
165
  rescue => e
@@ -169,9 +170,7 @@ module NewRelic
169
170
  def deobfuscate message
170
171
  CrossAppTracing.obfuscator.deobfuscate message
171
172
  end
172
-
173
173
  end
174
174
  end
175
175
  end
176
176
  end
177
-
@@ -14,21 +14,21 @@ module NewRelic
14
14
  attr_accessor :distributed_trace_payload
15
15
  attr_writer :distributed_trace_payload_created
16
16
 
17
- SUPPORTABILITY_DISTRIBUTED_TRACE = "Supportability/DistributedTrace"
18
- CREATE_PREFIX = "#{SUPPORTABILITY_DISTRIBUTED_TRACE}/CreatePayload"
19
- ACCEPT_PREFIX = "#{SUPPORTABILITY_DISTRIBUTED_TRACE}/AcceptPayload"
20
- IGNORE_PREFIX = "#{ACCEPT_PREFIX}/Ignored"
21
-
22
- CREATE_SUCCESS_METRIC = "#{CREATE_PREFIX}/Success"
23
- CREATE_EXCEPTION_METRIC = "#{CREATE_PREFIX}/Exception"
24
- ACCEPT_SUCCESS_METRIC = "#{ACCEPT_PREFIX}/Success"
25
- ACCEPT_EXCEPTION_METRIC = "#{ACCEPT_PREFIX}/Exception"
26
- ACCEPT_PARSE_EXCEPTION_METRIC = "#{ACCEPT_PREFIX}/ParseException"
27
-
28
- IGNORE_ACCEPT_AFTER_CREATE_METRIC = "#{IGNORE_PREFIX}/CreateBeforeAccept"
29
- IGNORE_MULTIPLE_ACCEPT_METRIC = "#{IGNORE_PREFIX}/Multiple"
30
- IGNORE_ACCEPT_NULL_METRIC = "#{IGNORE_PREFIX}/Null"
31
- IGNORE_ACCEPT_MAJOR_VERSION_METRIC = "#{IGNORE_PREFIX}/MajorVersion"
17
+ SUPPORTABILITY_DISTRIBUTED_TRACE = "Supportability/DistributedTrace"
18
+ CREATE_PREFIX = "#{SUPPORTABILITY_DISTRIBUTED_TRACE}/CreatePayload"
19
+ ACCEPT_PREFIX = "#{SUPPORTABILITY_DISTRIBUTED_TRACE}/AcceptPayload"
20
+ IGNORE_PREFIX = "#{ACCEPT_PREFIX}/Ignored"
21
+
22
+ CREATE_SUCCESS_METRIC = "#{CREATE_PREFIX}/Success"
23
+ CREATE_EXCEPTION_METRIC = "#{CREATE_PREFIX}/Exception"
24
+ ACCEPT_SUCCESS_METRIC = "#{ACCEPT_PREFIX}/Success"
25
+ ACCEPT_EXCEPTION_METRIC = "#{ACCEPT_PREFIX}/Exception"
26
+ ACCEPT_PARSE_EXCEPTION_METRIC = "#{ACCEPT_PREFIX}/ParseException"
27
+
28
+ IGNORE_ACCEPT_AFTER_CREATE_METRIC = "#{IGNORE_PREFIX}/CreateBeforeAccept"
29
+ IGNORE_MULTIPLE_ACCEPT_METRIC = "#{IGNORE_PREFIX}/Multiple"
30
+ IGNORE_ACCEPT_NULL_METRIC = "#{IGNORE_PREFIX}/Null"
31
+ IGNORE_ACCEPT_MAJOR_VERSION_METRIC = "#{IGNORE_PREFIX}/MajorVersion"
32
32
  IGNORE_ACCEPT_UNTRUSTED_ACCOUNT_METRIC = "#{IGNORE_PREFIX}/UntrustedAccount"
33
33
 
34
34
  LBRACE = "{"
@@ -122,12 +122,12 @@ module NewRelic
122
122
  def check_required_fields_present(payload)
123
123
  if \
124
124
  !payload.version.nil? &&
125
- !payload.parent_account_id.nil? &&
126
- !payload.parent_app_id.nil? &&
127
- !payload.parent_type.nil? &&
128
- (!payload.transaction_id.nil? || !payload.id.nil?) &&
129
- !payload.trace_id.nil? &&
130
- !payload.timestamp.nil?
125
+ !payload.parent_account_id.nil? &&
126
+ !payload.parent_app_id.nil? &&
127
+ !payload.parent_type.nil? &&
128
+ (!payload.transaction_id.nil? || !payload.id.nil?) &&
129
+ !payload.trace_id.nil? &&
130
+ !payload.timestamp.nil?
131
131
 
132
132
  true
133
133
  else
@@ -170,4 +170,3 @@ module NewRelic
170
170
  end
171
171
  end
172
172
  end
173
-
@@ -9,7 +9,6 @@ require 'new_relic/agent/http_clients/uri_util'
9
9
  module NewRelic
10
10
  module Agent
11
11
  class Transaction
12
-
13
12
  #
14
13
  # This class represents an external segment in a transaction trace.
15
14
  #
@@ -219,10 +218,9 @@ module NewRelic
219
218
  end
220
219
 
221
220
  def add_unscoped_metrics
222
- @unscoped_metrics = [ EXTERNAL_ALL,
221
+ @unscoped_metrics = [EXTERNAL_ALL,
223
222
  "External/#{host}/all",
224
- suffixed_rollup_metric
225
- ]
223
+ suffixed_rollup_metric]
226
224
 
227
225
  if cross_app_request?
228
226
  @unscoped_metrics << "ExternalApp/#{host}/#{cross_process_id}/all"
@@ -250,8 +248,11 @@ module NewRelic
250
248
  end
251
249
 
252
250
  def record_span_event
251
+ # don't record a span event if the transaction is ignored
252
+ return if transaction.ignore?
253
+
253
254
  aggregator = ::NewRelic::Agent.agent.span_event_aggregator
254
- priority = transaction.priority
255
+ priority = transaction.priority
255
256
  aggregator.record(priority: priority) do
256
257
  SpanEventPrimitive.for_external_request_segment(self)
257
258
  end