newrelic_rpm 7.2.0 → 8.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (288) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.rubocop.yml +1936 -0
  4. data/CHANGELOG.md +182 -9
  5. data/CONTRIBUTING.md +14 -2
  6. data/Guardfile +8 -8
  7. data/README.md +5 -1
  8. data/Rakefile +5 -7
  9. data/bin/mongrel_rpm +8 -9
  10. data/bin/newrelic +1 -1
  11. data/bin/nrdebug +14 -14
  12. data/init.rb +0 -2
  13. data/lefthook.yml +9 -0
  14. data/lib/new_relic/agent/adaptive_sampler.rb +9 -5
  15. data/lib/new_relic/agent/agent.rb +44 -46
  16. data/lib/new_relic/agent/agent_logger.rb +8 -9
  17. data/lib/new_relic/agent/attribute_filter.rb +31 -31
  18. data/lib/new_relic/agent/attributes.rb +2 -2
  19. data/lib/new_relic/agent/autostart.rb +6 -7
  20. data/lib/new_relic/agent/commands/agent_command.rb +2 -2
  21. data/lib/new_relic/agent/commands/agent_command_router.rb +6 -5
  22. data/lib/new_relic/agent/commands/thread_profiler_session.rb +7 -6
  23. data/lib/new_relic/agent/configuration/default_source.rb +352 -336
  24. data/lib/new_relic/agent/configuration/dotted_hash.rb +3 -3
  25. data/lib/new_relic/agent/configuration/environment_source.rb +3 -4
  26. data/lib/new_relic/agent/configuration/event_harvest_config.rb +30 -16
  27. data/lib/new_relic/agent/configuration/high_security_source.rb +7 -7
  28. data/lib/new_relic/agent/configuration/manager.rb +57 -58
  29. data/lib/new_relic/agent/configuration/mask_defaults.rb +1 -1
  30. data/lib/new_relic/agent/configuration/security_policy_source.rb +73 -73
  31. data/lib/new_relic/agent/configuration/server_source.rb +12 -11
  32. data/lib/new_relic/agent/configuration/yaml_source.rb +26 -5
  33. data/lib/new_relic/agent/connect/request_builder.rb +13 -16
  34. data/lib/new_relic/agent/connect/response_handler.rb +0 -3
  35. data/lib/new_relic/agent/custom_event_aggregator.rb +9 -9
  36. data/lib/new_relic/agent/database/explain_plan_helpers.rb +3 -4
  37. data/lib/new_relic/agent/database/obfuscation_helpers.rb +12 -12
  38. data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +2 -2
  39. data/lib/new_relic/agent/database.rb +25 -26
  40. data/lib/new_relic/agent/datastores/metric_helper.rb +10 -10
  41. data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +2 -3
  42. data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +3 -5
  43. data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +1 -2
  44. data/lib/new_relic/agent/datastores/mongo.rb +5 -10
  45. data/lib/new_relic/agent/datastores/redis.rb +2 -4
  46. data/lib/new_relic/agent/datastores.rb +7 -9
  47. data/lib/new_relic/agent/distributed_tracing/cross_app_payload.rb +9 -9
  48. data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +21 -16
  49. data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +10 -12
  50. data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +42 -43
  51. data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +3 -3
  52. data/lib/new_relic/agent/distributed_tracing/trace_context.rb +41 -43
  53. data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +25 -25
  54. data/lib/new_relic/agent/distributed_tracing.rb +17 -18
  55. data/lib/new_relic/agent/encoding_normalizer.rb +1 -1
  56. data/lib/new_relic/agent/error_collector.rb +17 -17
  57. data/lib/new_relic/agent/error_event_aggregator.rb +1 -1
  58. data/lib/new_relic/agent/error_filter.rb +16 -10
  59. data/lib/new_relic/agent/error_trace_aggregator.rb +1 -1
  60. data/lib/new_relic/agent/event_aggregator.rb +1 -1
  61. data/lib/new_relic/agent/event_buffer.rb +6 -7
  62. data/lib/new_relic/agent/event_listener.rb +0 -1
  63. data/lib/new_relic/agent/event_loop.rb +14 -14
  64. data/lib/new_relic/agent/external.rb +1 -34
  65. data/lib/new_relic/agent/guid_generator.rb +1 -3
  66. data/lib/new_relic/agent/harvester.rb +3 -4
  67. data/lib/new_relic/agent/heap.rb +1 -3
  68. data/lib/new_relic/agent/hostname.rb +3 -3
  69. data/lib/new_relic/agent/http_clients/abstract.rb +7 -9
  70. data/lib/new_relic/agent/http_clients/curb_wrappers.rb +1 -5
  71. data/lib/new_relic/agent/http_clients/excon_wrappers.rb +4 -4
  72. data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +3 -3
  73. data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +1 -2
  74. data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +8 -3
  75. data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +2 -3
  76. data/lib/new_relic/agent/http_clients/uri_util.rb +0 -1
  77. data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +2 -3
  78. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +10 -11
  79. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +5 -7
  80. data/lib/new_relic/agent/instrumentation/active_job.rb +4 -3
  81. data/lib/new_relic/agent/instrumentation/active_merchant.rb +3 -3
  82. data/lib/new_relic/agent/instrumentation/active_record.rb +20 -18
  83. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +36 -42
  84. data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +28 -25
  85. data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +3 -3
  86. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +5 -6
  87. data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +8 -9
  88. data/lib/new_relic/agent/instrumentation/bunny/chain.rb +1 -1
  89. data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +8 -9
  90. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +42 -42
  91. data/lib/new_relic/agent/instrumentation/curb/chain.rb +19 -20
  92. data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +34 -38
  93. data/lib/new_relic/agent/instrumentation/curb/prepend.rb +9 -10
  94. data/lib/new_relic/agent/instrumentation/data_mapper.rb +10 -10
  95. data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +5 -7
  96. data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +5 -9
  97. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +4 -4
  98. data/lib/new_relic/agent/instrumentation/excon/middleware.rb +2 -2
  99. data/lib/new_relic/agent/instrumentation/excon.rb +3 -23
  100. data/lib/new_relic/agent/instrumentation/grape/chain.rb +1 -2
  101. data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +6 -7
  102. data/lib/new_relic/agent/instrumentation/grape.rb +2 -3
  103. data/lib/new_relic/agent/instrumentation/httpclient/chain.rb +2 -3
  104. data/lib/new_relic/agent/instrumentation/httpclient/instrumentation.rb +0 -1
  105. data/lib/new_relic/agent/instrumentation/httpclient/prepend.rb +0 -2
  106. data/lib/new_relic/agent/instrumentation/httprb/chain.rb +2 -2
  107. data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +6 -6
  108. data/lib/new_relic/agent/instrumentation/httprb/prepend.rb +1 -1
  109. data/lib/new_relic/agent/instrumentation/ignore_actions.rb +2 -3
  110. data/lib/new_relic/agent/instrumentation/logger/chain.rb +21 -0
  111. data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +58 -0
  112. data/lib/new_relic/agent/instrumentation/logger/prepend.rb +13 -0
  113. data/lib/new_relic/agent/instrumentation/logger.rb +25 -0
  114. data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +7 -2
  115. data/lib/new_relic/agent/instrumentation/memcache/helper.rb +5 -1
  116. data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +9 -2
  117. data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +9 -10
  118. data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +4 -5
  119. data/lib/new_relic/agent/instrumentation/mongo.rb +3 -141
  120. data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +4 -4
  121. data/lib/new_relic/agent/instrumentation/net_http/chain.rb +3 -4
  122. data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +5 -5
  123. data/lib/new_relic/agent/instrumentation/net_http/prepend.rb +4 -4
  124. data/lib/new_relic/agent/instrumentation/net_http.rb +1 -1
  125. data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +2 -3
  126. data/lib/new_relic/agent/instrumentation/padrino/chain.rb +23 -19
  127. data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +3 -2
  128. data/lib/new_relic/agent/instrumentation/padrino/prepend.rb +2 -2
  129. data/lib/new_relic/agent/instrumentation/padrino.rb +2 -5
  130. data/lib/new_relic/agent/instrumentation/queue_time.rb +8 -8
  131. data/lib/new_relic/agent/instrumentation/rack/chain.rb +5 -5
  132. data/lib/new_relic/agent/instrumentation/rack/helpers.rb +0 -1
  133. data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +4 -5
  134. data/lib/new_relic/agent/instrumentation/rack/prepend.rb +0 -1
  135. data/lib/new_relic/agent/instrumentation/rack.rb +1 -1
  136. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +11 -47
  137. data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +2 -2
  138. data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +0 -1
  139. data/lib/new_relic/agent/instrumentation/rake/chain.rb +0 -5
  140. data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +6 -6
  141. data/lib/new_relic/agent/instrumentation/rake.rb +1 -1
  142. data/lib/new_relic/agent/instrumentation/redis/chain.rb +6 -6
  143. data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +2 -2
  144. data/lib/new_relic/agent/instrumentation/redis/prepend.rb +1 -1
  145. data/lib/new_relic/agent/instrumentation/redis.rb +1 -1
  146. data/lib/new_relic/agent/instrumentation/resque/chain.rb +2 -3
  147. data/lib/new_relic/agent/instrumentation/resque/helper.rb +1 -1
  148. data/lib/new_relic/agent/instrumentation/resque/instrumentation.rb +4 -4
  149. data/lib/new_relic/agent/instrumentation/resque/prepend.rb +1 -2
  150. data/lib/new_relic/agent/instrumentation/resque.rb +7 -7
  151. data/lib/new_relic/agent/instrumentation/sequel.rb +7 -9
  152. data/lib/new_relic/agent/instrumentation/sequel_helper.rb +1 -1
  153. data/lib/new_relic/agent/instrumentation/sidekiq.rb +7 -1
  154. data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +0 -1
  155. data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +4 -3
  156. data/lib/new_relic/agent/instrumentation/sunspot.rb +1 -1
  157. data/lib/new_relic/agent/instrumentation/tilt/chain.rb +24 -0
  158. data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +40 -0
  159. data/lib/new_relic/agent/instrumentation/tilt/prepend.rb +13 -0
  160. data/lib/new_relic/agent/instrumentation/tilt.rb +25 -0
  161. data/lib/new_relic/agent/instrumentation/typhoeus/chain.rb +4 -4
  162. data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +3 -5
  163. data/lib/new_relic/agent/instrumentation/typhoeus/prepend.rb +1 -1
  164. data/lib/new_relic/agent/internal_agent_error.rb +1 -1
  165. data/lib/new_relic/agent/javascript_instrumentor.rb +30 -30
  166. data/lib/new_relic/agent/logging.rb +11 -8
  167. data/lib/new_relic/agent/memory_logger.rb +1 -1
  168. data/lib/new_relic/agent/messaging.rb +46 -61
  169. data/lib/new_relic/agent/method_tracer.rb +139 -143
  170. data/lib/new_relic/agent/method_tracer_helpers.rb +2 -2
  171. data/lib/new_relic/agent/monitors/cross_app_monitor.rb +21 -13
  172. data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +2 -2
  173. data/lib/new_relic/agent/monitors/inbound_request_monitor.rb +0 -1
  174. data/lib/new_relic/agent/monitors/synthetics_monitor.rb +4 -7
  175. data/lib/new_relic/agent/monitors.rb +1 -2
  176. data/lib/new_relic/agent/new_relic_service/encoders.rb +4 -4
  177. data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +1 -1
  178. data/lib/new_relic/agent/new_relic_service/marshaller.rb +1 -1
  179. data/lib/new_relic/agent/new_relic_service/security_policy_settings.rb +4 -3
  180. data/lib/new_relic/agent/new_relic_service.rb +34 -41
  181. data/lib/new_relic/agent/noticible_error.rb +0 -2
  182. data/lib/new_relic/agent/null_logger.rb +6 -2
  183. data/lib/new_relic/agent/obfuscator.rb +6 -8
  184. data/lib/new_relic/agent/parameter_filtering.rb +3 -5
  185. data/lib/new_relic/agent/payload_metric_mapping.rb +8 -9
  186. data/lib/new_relic/agent/pipe_channel_manager.rb +15 -12
  187. data/lib/new_relic/agent/pipe_service.rb +2 -2
  188. data/lib/new_relic/agent/priority_sampled_buffer.rb +4 -7
  189. data/lib/new_relic/agent/rules_engine/replacement_rule.rb +9 -9
  190. data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +12 -12
  191. data/lib/new_relic/agent/rules_engine.rb +2 -2
  192. data/lib/new_relic/agent/sampler.rb +2 -3
  193. data/lib/new_relic/agent/sampler_collection.rb +2 -3
  194. data/lib/new_relic/agent/samplers/cpu_sampler.rb +1 -1
  195. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +10 -7
  196. data/lib/new_relic/agent/samplers/memory_sampler.rb +4 -3
  197. data/lib/new_relic/agent/samplers/vm_sampler.rb +18 -18
  198. data/lib/new_relic/agent/span_event_aggregator.rb +10 -10
  199. data/lib/new_relic/agent/span_event_primitive.rb +39 -39
  200. data/lib/new_relic/agent/sql_sampler.rb +9 -9
  201. data/lib/new_relic/agent/stats.rb +16 -16
  202. data/lib/new_relic/agent/stats_engine/gc_profiler.rb +7 -9
  203. data/lib/new_relic/agent/stats_engine/stats_hash.rb +8 -9
  204. data/lib/new_relic/agent/stats_engine.rb +7 -7
  205. data/lib/new_relic/agent/synthetics_event_aggregator.rb +0 -1
  206. data/lib/new_relic/agent/system_info.rb +22 -20
  207. data/lib/new_relic/agent/threading/agent_thread.rb +4 -5
  208. data/lib/new_relic/agent/threading/backtrace_node.rb +6 -9
  209. data/lib/new_relic/agent/threading/backtrace_service.rb +12 -13
  210. data/lib/new_relic/agent/threading/thread_profile.rb +16 -19
  211. data/lib/new_relic/agent/tracer.rb +43 -71
  212. data/lib/new_relic/agent/transaction/abstract_segment.rb +9 -9
  213. data/lib/new_relic/agent/transaction/datastore_segment.rb +7 -6
  214. data/lib/new_relic/agent/transaction/distributed_tracer.rb +8 -9
  215. data/lib/new_relic/agent/transaction/distributed_tracing.rb +21 -22
  216. data/lib/new_relic/agent/transaction/external_request_segment.rb +6 -5
  217. data/lib/new_relic/agent/transaction/message_broker_segment.rb +24 -30
  218. data/lib/new_relic/agent/transaction/request_attributes.rb +7 -7
  219. data/lib/new_relic/agent/transaction/segment.rb +6 -3
  220. data/lib/new_relic/agent/transaction/slowest_sample_buffer.rb +0 -2
  221. data/lib/new_relic/agent/transaction/trace.rb +8 -8
  222. data/lib/new_relic/agent/transaction/trace_context.rb +13 -15
  223. data/lib/new_relic/agent/transaction/trace_node.rb +16 -16
  224. data/lib/new_relic/agent/transaction/tracing.rb +1 -3
  225. data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -2
  226. data/lib/new_relic/agent/transaction.rb +85 -108
  227. data/lib/new_relic/agent/transaction_error_primitive.rb +16 -16
  228. data/lib/new_relic/agent/transaction_event_aggregator.rb +5 -6
  229. data/lib/new_relic/agent/transaction_event_primitive.rb +29 -29
  230. data/lib/new_relic/agent/transaction_metrics.rb +3 -3
  231. data/lib/new_relic/agent/transaction_sampler.rb +0 -1
  232. data/lib/new_relic/agent/transaction_time_aggregator.rb +11 -11
  233. data/lib/new_relic/agent/utilization/azure.rb +1 -1
  234. data/lib/new_relic/agent/utilization_data.rb +3 -4
  235. data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +1 -1
  236. data/lib/new_relic/agent/vm/snapshot.rb +4 -4
  237. data/lib/new_relic/agent/worker_loop.rb +8 -10
  238. data/lib/new_relic/agent.rb +27 -27
  239. data/lib/new_relic/cli/command.rb +15 -17
  240. data/lib/new_relic/cli/commands/deployments.rb +21 -23
  241. data/lib/new_relic/cli/commands/install.rb +6 -10
  242. data/lib/new_relic/coerce.rb +5 -8
  243. data/lib/new_relic/collection_helper.rb +48 -47
  244. data/lib/new_relic/constants.rb +0 -4
  245. data/lib/new_relic/control/class_methods.rb +2 -2
  246. data/lib/new_relic/control/frameworks/external.rb +1 -1
  247. data/lib/new_relic/control/frameworks/rails.rb +5 -6
  248. data/lib/new_relic/control/frameworks/rails3.rb +2 -3
  249. data/lib/new_relic/control/frameworks/ruby.rb +2 -2
  250. data/lib/new_relic/control/instance_methods.rb +4 -5
  251. data/lib/new_relic/control/instrumentation.rb +4 -5
  252. data/lib/new_relic/control/server_methods.rb +2 -3
  253. data/lib/new_relic/control.rb +0 -1
  254. data/lib/new_relic/dependency_detection.rb +6 -8
  255. data/lib/new_relic/environment_report.rb +16 -18
  256. data/lib/new_relic/helper.rb +5 -5
  257. data/lib/new_relic/language_support.rb +1 -1
  258. data/lib/new_relic/latest_changes.rb +2 -2
  259. data/lib/new_relic/local_environment.rb +7 -7
  260. data/lib/new_relic/metric_data.rb +6 -7
  261. data/lib/new_relic/metric_spec.rb +3 -3
  262. data/lib/new_relic/noticed_error.rb +16 -17
  263. data/lib/new_relic/rack/agent_middleware.rb +2 -2
  264. data/lib/new_relic/rack/browser_monitoring.rb +9 -9
  265. data/lib/new_relic/recipes/capistrano3.rb +11 -13
  266. data/lib/new_relic/recipes/capistrano_legacy.rb +11 -14
  267. data/lib/new_relic/supportability_helper.rb +1 -2
  268. data/lib/new_relic/version.rb +4 -5
  269. data/lib/newrelic_rpm.rb +10 -34
  270. data/lib/sequel/extensions/newrelic_instrumentation.rb +4 -7
  271. data/lib/sequel/plugins/newrelic_instrumentation.rb +3 -9
  272. data/lib/tasks/all.rb +2 -2
  273. data/lib/tasks/config.rake +21 -21
  274. data/lib/tasks/multiverse.rb +4 -6
  275. data/lib/tasks/tests.rake +3 -7
  276. data/newrelic.yml +580 -3
  277. data/newrelic_rpm.gemspec +13 -12
  278. data/recipes/newrelic.rb +1 -1
  279. data/test/agent_helper.rb +80 -55
  280. metadata +42 -13
  281. data/lib/new_relic/agent/datastores/mongo/statement_formatter.rb +0 -53
  282. data/lib/new_relic/agent/instrumentation/excon/connection.rb +0 -49
  283. data/lib/new_relic/agent/instrumentation/merb/controller.rb +0 -44
  284. data/lib/new_relic/agent/instrumentation/merb/errors.rb +0 -33
  285. data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +0 -125
  286. data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +0 -46
  287. data/lib/new_relic/agent/supported_versions.rb +0 -275
  288. data/lib/new_relic/control/frameworks/merb.rb +0 -29
@@ -3,7 +3,7 @@
3
3
  # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
4
4
 
5
5
  module NewRelic::Agent::Instrumentation
6
- module Padrino
6
+ module PadrinoTracer
7
7
  module Prepend
8
8
  include NewRelic::Agent::Instrumentation::Sinatra
9
9
  include NewRelic::Agent::Instrumentation::Padrino
@@ -17,4 +17,4 @@ module NewRelic::Agent::Instrumentation
17
17
  end
18
18
  end
19
19
  end
20
- end
20
+ end
@@ -24,12 +24,9 @@ DependencyDetection.defer do
24
24
  executes do
25
25
  ::NewRelic::Agent.logger.info 'Installing Padrino instrumentation'
26
26
  if use_prepend?
27
- prepend_instrument ::Padrino::Routing::InstanceMethods, NewRelic::Agent::Instrumentation::Padrino::Prepend
27
+ prepend_instrument ::Padrino::Application, NewRelic::Agent::Instrumentation::PadrinoTracer::Prepend
28
28
  else
29
- chain_instrument NewRelic::Agent::Instrumentation::Padrino::Chain
29
+ chain_instrument NewRelic::Agent::Instrumentation::PadrinoTracer::Chain
30
30
  end
31
31
  end
32
32
  end
33
-
34
-
35
-
@@ -9,13 +9,13 @@ module NewRelic
9
9
  # Record queue time metrics based on any of three headers
10
10
  # which can be set on the request.
11
11
  module QueueTime
12
- REQUEST_START_HEADER = 'HTTP_X_REQUEST_START'.freeze
13
- QUEUE_START_HEADER = 'HTTP_X_QUEUE_START'.freeze
12
+ REQUEST_START_HEADER = 'HTTP_X_REQUEST_START'.freeze
13
+ QUEUE_START_HEADER = 'HTTP_X_QUEUE_START'.freeze
14
14
  MIDDLEWARE_START_HEADER = 'HTTP_X_MIDDLEWARE_START'.freeze
15
- ALL_QUEUE_METRIC = 'WebFrontend/QueueTime'.freeze
15
+ ALL_QUEUE_METRIC = 'WebFrontend/QueueTime'.freeze
16
16
  # any timestamps before this are thrown out and the parser
17
17
  # will try again with a larger unit (2000/1/1 UTC)
18
- EARLIEST_ACCEPTABLE_TIME = Time.at(946684800)
18
+ EARLIEST_ACCEPTABLE_TIME = Time.at(946684800).to_f
19
19
 
20
20
  CANDIDATE_HEADERS = [
21
21
  REQUEST_START_HEADER,
@@ -27,7 +27,7 @@ module NewRelic
27
27
 
28
28
  module_function
29
29
 
30
- def parse_frontend_timestamp(headers, now=Time.now)
30
+ def parse_frontend_timestamp(headers, now = Process.clock_gettime(Process::CLOCK_REALTIME))
31
31
  earliest = nil
32
32
 
33
33
  CANDIDATE_HEADERS.each do |header|
@@ -40,7 +40,7 @@ module NewRelic
40
40
  end
41
41
 
42
42
  if earliest && earliest > now
43
- NewRelic::Agent.logger.debug("Negative queue time detected, treating as zero: start=#{earliest.to_f} > now=#{now.to_f}")
43
+ NewRelic::Agent.logger.debug("Negative queue time detected, treating as zero: start=#{earliest.to_f} > now=#{now}")
44
44
  earliest = now
45
45
  end
46
46
 
@@ -52,14 +52,14 @@ module NewRelic
52
52
  when /^\s*([\d+\.]+)\s*$/ then $1
53
53
  # following regexp intentionally unanchored to handle
54
54
  # (ie ignore) leading server names
55
- when /t=([\d+\.]+)/ then $1
55
+ when /t=([\d+\.]+)/ then $1
56
56
  end
57
57
  end
58
58
 
59
59
  def parse_timestamp(string)
60
60
  DIVISORS.each do |divisor|
61
61
  begin
62
- t = Time.at(string.to_f / divisor)
62
+ t = (string.to_f / divisor)
63
63
  return t if t > EARLIEST_ACCEPTABLE_TIME
64
64
  rescue RangeError
65
65
  # On Ruby versions built with a 32-bit time_t, attempting to
@@ -10,24 +10,24 @@ module NewRelic::Agent::Instrumentation
10
10
 
11
11
  builder_class.class_eval do
12
12
  include ::NewRelic::Agent::Instrumentation::RackBuilder
13
-
13
+
14
14
  def to_app_with_newrelic_deferred_dependency_detection
15
15
  with_deferred_dependency_detection { to_app_without_newrelic }
16
16
  end
17
17
 
18
18
  alias_method :to_app_without_newrelic, :to_app
19
19
  alias_method :to_app, :to_app_with_newrelic_deferred_dependency_detection
20
-
20
+
21
21
  if ::NewRelic::Agent::Instrumentation::RackHelpers.middleware_instrumentation_enabled?
22
22
  ::NewRelic::Agent.logger.info "Installing #{builder_class} middleware instrumentation"
23
23
 
24
24
  def run_with_newrelic(app, *args)
25
25
  run_with_tracing(app) { |wrapped_app| run_without_newrelic(wrapped_app, *args) }
26
26
  end
27
-
27
+
28
28
  alias_method :run_without_newrelic, :run
29
29
  alias_method :run, :run_with_newrelic
30
-
30
+
31
31
  def use_with_newrelic(middleware_class, *args, &block)
32
32
  use_with_tracing(middleware_class) { |wrapped_class| use_without_newrelic(wrapped_class, *args, &block) }
33
33
  end
@@ -45,7 +45,7 @@ module NewRelic::Agent::Instrumentation
45
45
  def self.instrument! url_map_class
46
46
  url_map_class.class_eval do
47
47
  alias_method :initialize_without_newrelic, :initialize
48
-
48
+
49
49
  def initialize(map = {})
50
50
  traced_map = ::NewRelic::Agent::Instrumentation::RackURLMap.generate_traced_map(map)
51
51
  initialize_without_newrelic(traced_map)
@@ -29,4 +29,3 @@ module NewRelic::Agent::Instrumentation
29
29
  end
30
30
  end
31
31
  end
32
-
@@ -6,7 +6,6 @@ module NewRelic
6
6
  module Agent
7
7
  module Instrumentation
8
8
  module RackBuilder
9
-
10
9
  def self.track_deferred_detection builder_class
11
10
  class << builder_class
12
11
  attr_accessor :_nr_deferred_detection_ran
@@ -16,7 +15,7 @@ module NewRelic
16
15
 
17
16
  def deferred_dependency_check
18
17
  return if self.class._nr_deferred_detection_ran
19
-
18
+
20
19
  NewRelic::Agent.logger.info "Doing deferred dependency-detection before Rack startup"
21
20
  DependencyDetection.detect!
22
21
  self.class._nr_deferred_detection_ran = true
@@ -28,7 +27,7 @@ module NewRelic
28
27
  if middleware_instrumentation_enabled?
29
28
  if ::NewRelic::Agent::Instrumentation::MiddlewareProxy.needs_wrapping?(app)
30
29
  ::NewRelic::Agent.logger.info("We weren't able to instrument all of your Rack middlewares.",
31
- "To correct this, ensure you 'require \"newrelic_rpm\"' before setting up your middleware stack.")
30
+ "To correct this, ensure you 'require \"newrelic_rpm\"' before setting up your middleware stack.")
32
31
  end
33
32
  end
34
33
  end
@@ -41,7 +40,7 @@ module NewRelic
41
40
  # this point.
42
41
  def with_deferred_dependency_detection
43
42
  deferred_dependency_check
44
- yield.tap{ |result| check_for_late_instrumentation(result) }
43
+ yield.tap { |result| check_for_late_instrumentation(result) }
45
44
  end
46
45
 
47
46
  def middleware_instrumentation_enabled?
@@ -70,4 +69,4 @@ module NewRelic
70
69
  end
71
70
  end
72
71
  end
73
- end
72
+ end
@@ -4,7 +4,6 @@
4
4
 
5
5
  module NewRelic::Agent::Instrumentation
6
6
  module Rack
7
-
8
7
  module URLMap
9
8
  module Prepend
10
9
  def initialize(map = {})
@@ -57,7 +57,7 @@ DependencyDetection.defer do
57
57
  prepend_instrument ::Rack::URLMap, NewRelic::Agent::Instrumentation::Rack::URLMap::Prepend
58
58
  else
59
59
  chain_instrument_target ::Rack::URLMap, NewRelic::Agent::Instrumentation::Rack::URLMap::Chain
60
- ::NewRelic::Agent::Instrumentation::RackHelpers.instrument_url_map
60
+ ::NewRelic::Agent::Instrumentation::RackHelpers.instrument_url_map
61
61
  end
62
62
  end
63
63
  end
@@ -20,17 +20,16 @@ module NewRelic
20
20
  end
21
21
  end
22
22
 
23
- def process_action(*args) #THREAD_LOCAL_ACCESS
23
+ def process_action(*args) # THREAD_LOCAL_ACCESS
24
24
  munged_params = NewRelic::Agent::ParameterFiltering.filter_rails_request_parameters(request.filtered_parameters)
25
25
  perform_action_with_newrelic_trace(:category => :controller,
26
- :name => self.action_name,
27
- :path => newrelic_metric_path,
28
- :params => munged_params,
29
- :class_name => self.class.name) do
26
+ :name => self.action_name,
27
+ :path => newrelic_metric_path,
28
+ :params => munged_params,
29
+ :class_name => self.class.name) do
30
30
  super
31
31
  end
32
32
  end
33
-
34
33
  end
35
34
 
36
35
  module ActionView
@@ -47,6 +46,7 @@ module NewRelic
47
46
  identifier
48
47
  end
49
48
  end
49
+
50
50
  def render_type(file_path)
51
51
  file = File.basename(file_path)
52
52
  if file.starts_with?('_')
@@ -84,52 +84,16 @@ DependencyDetection.defer do
84
84
  end
85
85
  end
86
86
  end
87
- DependencyDetection.defer do
88
- @name = :rails30_view
89
-
90
- depends_on do
91
- defined?(::Rails::VERSION::MAJOR) && defined?(::Rails::VERSION::MINOR) &&
92
- ::Rails::VERSION::MAJOR.to_i == 3 && ::Rails::VERSION::MINOR.to_i == 0
93
- end
94
-
95
- depends_on do
96
- !NewRelic::Agent.config[:disable_view_instrumentation]
97
- end
98
-
99
- executes do
100
- ::NewRelic::Agent.logger.info 'Installing Rails 3.0 view instrumentation'
101
- end
102
-
103
- executes do
104
- ActionView::Template.class_eval do
105
- include NewRelic::Agent::MethodTracer
106
- def render_with_newrelic(*args, &block)
107
- options = if @virtual_path && @virtual_path.starts_with?('/') # file render
108
- {:file => true }
109
- else
110
- {}
111
- end
112
- str = "View/#{NewRelic::Agent::Instrumentation::Rails3::ActionView::NewRelic.template_metric(@identifier, options)}/#{NewRelic::Agent::Instrumentation::Rails3::ActionView::NewRelic.render_type(@identifier)}"
113
- trace_execution_scoped str do
114
- render_without_newrelic(*args, &block)
115
- end
116
- end
117
-
118
- alias_method :render_without_newrelic, :render
119
- alias_method :render, :render_with_newrelic
120
-
121
- end
122
- end
123
- end
124
87
 
88
+ # Though this uses the name :rails31_view, it is used only for rails 3.2 now
89
+ # Rails 3.1 is no longer supported by the agent.
125
90
  DependencyDetection.defer do
126
91
  @name = :rails31_view
127
92
 
128
- # We can't be sure that this will work with future versions of Rails 3.
129
- # Currently enabled for Rails 3.1 and 3.2
93
+ # Enabled for Rails 3.2
130
94
  depends_on do
131
95
  defined?(::Rails::VERSION::MAJOR) && defined?(::Rails::VERSION::MINOR) &&
132
- ::Rails::VERSION::MAJOR.to_i == 3 && ([1,2].member?(::Rails::VERSION::MINOR.to_i))
96
+ ::Rails::VERSION::MAJOR.to_i == 3 && ::Rails::VERSION::MINOR.to_i == 2
133
97
  end
134
98
 
135
99
  depends_on do
@@ -137,7 +101,7 @@ DependencyDetection.defer do
137
101
  end
138
102
 
139
103
  executes do
140
- ::NewRelic::Agent.logger.info 'Installing Rails 3.1/3.2 view instrumentation'
104
+ ::NewRelic::Agent.logger.info 'Installing Rails 3.2 view instrumentation'
141
105
  end
142
106
 
143
107
  executes do
@@ -9,8 +9,8 @@ DependencyDetection.defer do
9
9
 
10
10
  depends_on do
11
11
  defined?(::Rails::VERSION::MAJOR) &&
12
- ::Rails::VERSION::MAJOR.to_i >= 5 &&
13
- defined?(::ActionCable)
12
+ ::Rails::VERSION::MAJOR.to_i >= 5 &&
13
+ defined?(::ActionCable)
14
14
  end
15
15
 
16
16
  depends_on do
@@ -4,7 +4,6 @@
4
4
  require 'new_relic/agent/instrumentation/action_controller_subscriber'
5
5
  require 'new_relic/agent/prepend_supportability'
6
6
 
7
-
8
7
  DependencyDetection.defer do
9
8
  @name = :action_controller_notifications
10
9
 
@@ -18,8 +18,3 @@ module NewRelic::Agent::Instrumentation
18
18
  end
19
19
  end
20
20
  end
21
-
22
-
23
-
24
-
25
-
@@ -99,14 +99,14 @@ module NewRelic
99
99
 
100
100
  def record_attributes(args, task)
101
101
  command_line = task.application.top_level_tasks.join(" ")
102
- NewRelic::Agent::Transaction.merge_untrusted_agent_attributes({ :command => command_line },
103
- :'job.rake',
104
- NewRelic::Agent::AttributeFilter::DST_NONE)
102
+ NewRelic::Agent::Transaction.merge_untrusted_agent_attributes({:command => command_line},
103
+ :'job.rake',
104
+ NewRelic::Agent::AttributeFilter::DST_NONE)
105
105
  named_args = name_the_args(args, task.arg_names)
106
106
  unless named_args.empty?
107
107
  NewRelic::Agent::Transaction.merge_untrusted_agent_attributes(named_args,
108
- :'job.rake.args',
109
- NewRelic::Agent::AttributeFilter::DST_NONE)
108
+ :'job.rake.args',
109
+ NewRelic::Agent::AttributeFilter::DST_NONE)
110
110
  end
111
111
  rescue => e
112
112
  NewRelic::Agent.logger.error("Error during Rake task attribute recording.", e)
@@ -141,4 +141,4 @@ module NewRelic
141
141
  end
142
142
  end
143
143
  end
144
- end
144
+ end
@@ -17,7 +17,7 @@ DependencyDetection.defer do
17
17
  depends_on { ::NewRelic::Agent::Instrumentation::Rake.safe_from_third_party_gem? }
18
18
 
19
19
  executes do
20
- ::NewRelic::Agent.logger.info "Installing Rake instrumentation"
20
+ ::NewRelic::Agent.logger.info "Installing Rake instrumentation"
21
21
  ::NewRelic::Agent.logger.debug "Instrumenting Rake tasks: #{::NewRelic::Agent.config[:'rake.tasks']}"
22
22
  end
23
23
 
@@ -5,25 +5,25 @@
5
5
 
6
6
  module NewRelic::Agent::Instrumentation
7
7
  module Redis
8
- module Chain
8
+ module Chain
9
9
  def self.instrument!
10
10
  ::Redis::Client.class_eval do
11
11
  include NewRelic::Agent::Instrumentation::Redis
12
12
 
13
13
  alias_method :call_without_new_relic, :call
14
-
14
+
15
15
  def call(*args, &block)
16
16
  call_with_tracing(args[0]) { call_without_new_relic(*args, &block) }
17
17
  end
18
-
18
+
19
19
  alias_method :call_pipeline_without_new_relic, :call_pipeline
20
-
20
+
21
21
  def call_pipeline(*args, &block)
22
22
  call_pipeline_with_tracing(args[0]) { call_pipeline_without_new_relic(*args, &block) }
23
23
  end
24
24
 
25
25
  alias_method :connect_without_new_relic, :connect
26
-
26
+
27
27
  def connect(*args, &block)
28
28
  connect_with_tracing { connect_without_new_relic(*args, &block) }
29
29
  end
@@ -31,4 +31,4 @@ module NewRelic::Agent::Instrumentation
31
31
  end
32
32
  end
33
33
  end
34
- end
34
+ end
@@ -32,7 +32,7 @@ module NewRelic::Agent::Instrumentation
32
32
 
33
33
  private
34
34
 
35
- def with_tracing operation, statement=nil
35
+ def with_tracing operation, statement = nil
36
36
  segment = NewRelic::Agent::Tracer.start_datastore_segment(
37
37
  product: PRODUCT_NAME,
38
38
  operation: operation,
@@ -62,4 +62,4 @@ module NewRelic::Agent::Instrumentation
62
62
  UNKNOWN
63
63
  end
64
64
  end
65
- end
65
+ end
@@ -21,4 +21,4 @@ module NewRelic::Agent::Instrumentation
21
21
  end
22
22
  end
23
23
  end
24
- end
24
+ end
@@ -13,7 +13,7 @@ DependencyDetection.defer do
13
13
  # Why not :redis? newrelic-redis used that name, so avoid conflicting
14
14
  named :redis_instrumentation
15
15
  configure_with :redis
16
-
16
+
17
17
  depends_on do
18
18
  defined?(::Redis) && defined?(::Redis::VERSION)
19
19
  end
@@ -2,16 +2,15 @@
2
2
  # This file is distributed under New Relic's license terms.
3
3
  # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
4
4
 
5
-
6
5
  module NewRelic::Agent::Instrumentation
7
6
  module Resque
8
- module Chain
7
+ module Chain
9
8
  def self.instrument!
10
9
  ::Resque::Job.class_eval do
11
10
  include NewRelic::Agent::Instrumentation::Resque
12
11
 
13
12
  alias_method :perform_without_instrumentation, :perform
14
-
13
+
15
14
  def perform
16
15
  with_tracing { perform_without_instrumentation }
17
16
  end
@@ -16,4 +16,4 @@ module NewRelic
16
16
  end
17
17
  end
18
18
  end
19
- end
19
+ end
@@ -12,12 +12,13 @@ module NewRelic::Agent::Instrumentation
12
12
  perform_action_with_newrelic_trace(
13
13
  :name => 'perform',
14
14
  :class_name => self.payload_class,
15
- :category => 'OtherTransaction/ResqueJob') do
16
-
15
+ :category => 'OtherTransaction/ResqueJob'
16
+ ) do
17
17
  NewRelic::Agent::Transaction.merge_untrusted_agent_attributes(
18
18
  args,
19
19
  :'job.resque.args',
20
- NewRelic::Agent::AttributeFilter::DST_NONE)
20
+ NewRelic::Agent::AttributeFilter::DST_NONE
21
+ )
21
22
 
22
23
  yield
23
24
  end
@@ -30,6 +31,5 @@ module NewRelic::Agent::Instrumentation
30
31
  end
31
32
  end
32
33
  end
33
-
34
34
  end
35
35
  end
@@ -2,10 +2,9 @@
2
2
  # This file is distributed under New Relic's license terms.
3
3
  # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
4
4
 
5
-
6
5
  module NewRelic::Agent::Instrumentation
7
6
  module Resque
8
- module Prepend
7
+ module Prepend
9
8
  include NewRelic::Agent::Instrumentation::Resque
10
9
 
11
10
  def perform
@@ -39,9 +39,9 @@ DependencyDetection.defer do
39
39
 
40
40
  if NewRelic::Agent::Instrumentation::Resque::Helper.resque_fork_per_job?
41
41
  ::Resque.before_first_fork do
42
- NewRelic::Agent.manual_start(:dispatcher => :resque,
43
- :sync_startup => true,
44
- :start_channel_listener => true)
42
+ NewRelic::Agent.manual_start(:dispatcher => :resque,
43
+ :sync_startup => true,
44
+ :start_channel_listener => true)
45
45
  end
46
46
 
47
47
  ::Resque.before_fork do |job|
@@ -52,13 +52,13 @@ DependencyDetection.defer do
52
52
  # Only suppress reporting Instance/Busy for forked children
53
53
  # Traced errors UI relies on having the parent process report that metric
54
54
  NewRelic::Agent.after_fork(:report_to_channel => job.object_id,
55
- :report_instance_busy => false)
55
+ :report_instance_busy => false)
56
56
  end
57
57
  else
58
58
  ::Resque.before_first_fork do
59
- NewRelic::Agent.manual_start(:dispatcher => :resque,
60
- :sync_startup => true,
61
- :start_channel_listener => false)
59
+ NewRelic::Agent.manual_start(:dispatcher => :resque,
60
+ :sync_startup => true,
61
+ :start_channel_listener => false)
62
62
  end
63
63
  end
64
64
  end
@@ -12,13 +12,13 @@ DependencyDetection.defer do
12
12
 
13
13
  depends_on do
14
14
  !NewRelic::Agent.config[:disable_sequel_instrumentation] &&
15
- !NewRelic::Agent.config[:disable_database_instrumentation]
15
+ !NewRelic::Agent.config[:disable_database_instrumentation]
16
16
  end
17
17
 
18
18
  def supported_sequel_version?
19
- Sequel.const_defined?( :MAJOR ) &&
20
- ( Sequel::MAJOR > 3 ||
21
- Sequel::MAJOR == 3 && Sequel::MINOR >= 37 )
19
+ Sequel.const_defined?(:MAJOR) &&
20
+ (Sequel::MAJOR > 3 ||
21
+ Sequel::MAJOR == 3 && Sequel::MINOR >= 37)
22
22
  end
23
23
 
24
24
  executes do
@@ -26,15 +26,15 @@ DependencyDetection.defer do
26
26
 
27
27
  ::NewRelic::Agent.logger.info 'Installing Sequel instrumentation'
28
28
 
29
- if Sequel::Database.respond_to?( :extension )
29
+ if Sequel::Database.respond_to?(:extension)
30
30
  Sequel::Database.extension :newrelic_instrumentation
31
31
  else
32
- NewRelic::Agent.logger.info "Detected Sequel version %s." % [ Sequel::VERSION ]
32
+ NewRelic::Agent.logger.info "Detected Sequel version %s." % [Sequel::VERSION]
33
33
  NewRelic::Agent.logger.info "Please see additional documentation: " +
34
34
  "https://newrelic.com/docs/ruby/sequel-instrumentation"
35
35
  end
36
36
 
37
- Sequel.synchronize{Sequel::DATABASES.dup}.each do |db|
37
+ Sequel.synchronize { Sequel::DATABASES.dup }.each do |db|
38
38
  db.extension :newrelic_instrumentation
39
39
  end
40
40
 
@@ -44,7 +44,5 @@ DependencyDetection.defer do
44
44
  NewRelic::Agent.logger.info "Sequel instrumentation requires at least version 3.37.0."
45
45
 
46
46
  end
47
-
48
47
  end
49
-
50
48
  end
@@ -33,4 +33,4 @@ module NewRelic
33
33
  end
34
34
  end
35
35
  end
36
- end
36
+ end
@@ -44,6 +44,7 @@ DependencyDetection.defer do
44
44
  }
45
45
  end
46
46
  end
47
+
47
48
  class Client
48
49
  def call(_worker_class, job, *_)
49
50
  job[NewRelic::NEWRELIC_KEY] ||= distributed_tracing_headers if ::NewRelic::Agent.config[:'distributed_tracing.enabled']
@@ -60,7 +61,12 @@ DependencyDetection.defer do
60
61
 
61
62
  class Sidekiq::Extensions::DelayedClass
62
63
  def newrelic_trace_args(msg, queue)
63
- (target, method_name, _args) = YAML.load(msg['args'][0])
64
+ (target, method_name, _args) = if YAML.respond_to?(:unsafe_load)
65
+ YAML.unsafe_load(msg['args'][0])
66
+ else
67
+ YAML.load(msg['args'][0])
68
+ end
69
+
64
70
  {
65
71
  :name => method_name,
66
72
  :class_name => target.name,
@@ -5,7 +5,6 @@
5
5
  module NewRelic::Agent::Instrumentation
6
6
  module Sinatra
7
7
  module Ignorer
8
-
9
8
  def self.should_ignore?(app, type)
10
9
  return false if !app.settings.respond_to?(:newrelic_ignores)
11
10
 
@@ -70,7 +70,8 @@ module NewRelic::Agent::Instrumentation
70
70
  begin
71
71
  if txn_name = TransactionNamer.transaction_name_for_route(env, request)
72
72
  ::NewRelic::Agent::Transaction.set_default_transaction_name(
73
- "#{self.class.name}/#{txn_name}", :sinatra)
73
+ "#{self.class.name}/#{txn_name}", :sinatra
74
+ )
74
75
  end
75
76
  rescue => e
76
77
  ::NewRelic::Agent.logger.debug("Failed during route_eval to set transaction name", e)
@@ -93,8 +94,8 @@ module NewRelic::Agent::Instrumentation
93
94
 
94
95
  name = TransactionNamer.initial_transaction_name(request)
95
96
  perform_action_with_newrelic_trace(:category => :sinatra,
96
- :name => name,
97
- :params => filtered_params) do
97
+ :name => name,
98
+ :params => filtered_params) do
98
99
  begin
99
100
  yield
100
101
  ensure
@@ -16,7 +16,7 @@ DependencyDetection.defer do
16
16
  executes do
17
17
  ::Sunspot.module_eval do
18
18
  class << self
19
- %w(index index!).each do |method|
19
+ %w[index index!].each do |method|
20
20
  add_method_tracer method, 'SolrClient/Sunspot/index'
21
21
  end
22
22
  add_method_tracer :commit, 'SolrClient/Sunspot/commit'
@@ -0,0 +1,24 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under New Relic's license terms.
3
+ # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
4
+
5
+ module NewRelic::Agent::Instrumentation
6
+ module Tilt
7
+ module Chain
8
+ def self.instrument!
9
+ ::Tilt::Template.module_eval do
10
+ include NewRelic::Agent::Instrumentation::Tilt
11
+
12
+ def render_with_new_relic(*args, &block)
13
+ render_with_tracing(*args) {
14
+ render_without_newrelic(*args, &block)
15
+ }
16
+ end
17
+
18
+ alias render_without_newrelic render
19
+ alias render render_with_new_relic
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end