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
@@ -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
@@ -9,16 +9,16 @@ module NewRelic
9
9
  module Agent
10
10
  class Transaction
11
11
  class MessageBrokerSegment < Segment
12
- CONSUME = 'Consume'.freeze
12
+ CONSUME = 'Consume'.freeze
13
13
  EXCHANGE = 'Exchange'.freeze
14
- NAMED = 'Named/'.freeze
15
- PRODUCE = 'Produce'.freeze
16
- QUEUE = 'Queue'.freeze
17
- PURGE = 'Purge'.freeze
18
- SLASH = '/'.freeze
19
- TEMP = 'Temp'.freeze
20
- TOPIC = 'Topic'.freeze
21
- UNKNOWN = 'Unknown'.freeze
14
+ NAMED = 'Named/'.freeze
15
+ PRODUCE = 'Produce'.freeze
16
+ QUEUE = 'Queue'.freeze
17
+ PURGE = 'Purge'.freeze
18
+ SLASH = '/'.freeze
19
+ TEMP = 'Temp'.freeze
20
+ TOPIC = 'Topic'.freeze
21
+ UNKNOWN = 'Unknown'.freeze
22
22
 
23
23
  DESTINATION_TYPES = [
24
24
  :exchange,
@@ -36,35 +36,29 @@ module NewRelic
36
36
  }
37
37
 
38
38
  TYPES = {
39
- exchange: EXCHANGE,
39
+ exchange: EXCHANGE,
40
40
  temporary_queue: QUEUE,
41
- queue: QUEUE,
41
+ queue: QUEUE,
42
42
  temporary_topic: TOPIC,
43
- topic: TOPIC,
44
- unknown: EXCHANGE
43
+ topic: TOPIC,
44
+ unknown: EXCHANGE
45
45
  }
46
46
 
47
47
  METRIC_PREFIX = 'MessageBroker/'.freeze
48
48
 
49
49
  attr_reader :action,
50
- :destination_name,
51
- :destination_type,
52
- :library,
53
- :headers
50
+ :destination_name,
51
+ :destination_type,
52
+ :library,
53
+ :headers
54
54
 
55
- def initialize action: nil,
56
- library: nil,
57
- destination_type: nil,
58
- destination_name: nil,
59
- headers: nil,
60
- parameters: nil,
61
- start_time: nil
62
-
63
- # ruby 2.0.0 does not support required kwargs
64
- raise ArgumentError, 'missing required argument: action' if action.nil?
65
- raise ArgumentError, 'missing required argument: library' if library.nil?
66
- raise ArgumentError, 'missing required argument: destination_type' if destination_type.nil?
67
- raise ArgumentError, 'missing required argument: destination_name' if destination_name.nil?
55
+ def initialize(action:,
56
+ library:,
57
+ destination_type:,
58
+ destination_name:,
59
+ headers: nil,
60
+ parameters: nil,
61
+ start_time: nil)
68
62
 
69
63
  @action = action
70
64
  @library = library
@@ -9,7 +9,7 @@ module NewRelic
9
9
  class Transaction
10
10
  class RequestAttributes
11
11
  attr_reader :request_path, :referer, :accept, :content_length, :content_type,
12
- :host, :port, :user_agent, :request_method
12
+ :host, :port, :user_agent, :request_method
13
13
 
14
14
  HTTP_ACCEPT_HEADER_KEY = "HTTP_ACCEPT".freeze
15
15
 
@@ -26,9 +26,9 @@ module NewRelic
26
26
  end
27
27
 
28
28
  def assign_agent_attributes txn
29
- default_destinations = AttributeFilter::DST_TRANSACTION_TRACER|
30
- AttributeFilter::DST_TRANSACTION_EVENTS|
31
- AttributeFilter::DST_ERROR_COLLECTOR
29
+ default_destinations = AttributeFilter::DST_TRANSACTION_TRACER |
30
+ AttributeFilter::DST_TRANSACTION_EVENTS |
31
+ AttributeFilter::DST_ERROR_COLLECTOR
32
32
 
33
33
  if referer
34
34
  txn.add_agent_attribute :'request.headers.referer', referer, AttributeFilter::DST_ERROR_COLLECTOR
@@ -36,9 +36,9 @@ module NewRelic
36
36
 
37
37
  if request_path
38
38
  txn.add_agent_attribute :'request.uri',
39
- request_path,
40
- AttributeFilter::DST_TRANSACTION_TRACER |
41
- AttributeFilter::DST_ERROR_COLLECTOR
39
+ request_path,
40
+ AttributeFilter::DST_TRANSACTION_TRACER |
41
+ AttributeFilter::DST_ERROR_COLLECTOR
42
42
  end
43
43
 
44
44
  if accept
@@ -15,7 +15,7 @@ module NewRelic
15
15
  # initialize it as an array that would be empty, have one item, or many items.
16
16
  attr_reader :unscoped_metrics, :custom_transaction_attributes
17
17
 
18
- def initialize name=nil, unscoped_metrics=nil, start_time=nil
18
+ def initialize name = nil, unscoped_metrics = nil, start_time = nil
19
19
  @unscoped_metrics = unscoped_metrics
20
20
  super name, start_time
21
21
  end
@@ -24,7 +24,7 @@ module NewRelic
24
24
  @attributes ||= Attributes.new(NewRelic::Agent.instance.attribute_filter)
25
25
  end
26
26
 
27
- def add_agent_attribute(key, value, default_destinations=AttributeFilter::DST_SPAN_EVENTS)
27
+ def add_agent_attribute(key, value, default_destinations = AttributeFilter::DST_SPAN_EVENTS)
28
28
  attributes.add_agent_attribute(key, value, default_destinations)
29
29
  end
30
30
 
@@ -79,8 +79,11 @@ module NewRelic
79
79
  end
80
80
 
81
81
  def record_span_event
82
+ # don't record a span event if the transaction is ignored
83
+ return if transaction.ignore?
84
+
82
85
  aggregator = ::NewRelic::Agent.agent.span_event_aggregator
83
- priority = transaction.priority
86
+ priority = transaction.priority
84
87
 
85
88
  aggregator.record(priority: priority) do
86
89
  SpanEventPrimitive.for_segment(self)
@@ -8,7 +8,6 @@ module NewRelic
8
8
  module Agent
9
9
  class Transaction
10
10
  class SlowestSampleBuffer < TransactionSampleBuffer
11
-
12
11
  CAPACITY = 1
13
12
 
14
13
  def capacity
@@ -18,7 +17,6 @@ module NewRelic
18
17
  def allow_sample?(sample)
19
18
  sample.threshold && sample.duration >= sample.threshold
20
19
  end
21
-
22
20
  end
23
21
  end
24
22
  end
@@ -12,7 +12,7 @@ module NewRelic
12
12
 
13
13
  attr_reader :start_time, :root_node
14
14
  attr_accessor :transaction_name, :guid, :attributes,
15
- :node_count, :finished, :threshold, :profile
15
+ :node_count, :finished, :threshold, :profile
16
16
 
17
17
  ROOT = "ROOT".freeze
18
18
 
@@ -31,7 +31,7 @@ module NewRelic
31
31
  node_count = 0
32
32
  each_node do |node|
33
33
  next if node == root_node
34
- node_count +=1
34
+ node_count += 1
35
35
  end
36
36
  node_count
37
37
  end
@@ -103,20 +103,20 @@ module NewRelic
103
103
  @root_node.each_node_with_nest_tracking(&block)
104
104
  end
105
105
 
106
- AGENT_ATTRIBUTES_KEY = 'agentAttributes'.freeze
107
- USER_ATTRIBUTES_KEY = 'userAttributes'.freeze
106
+ AGENT_ATTRIBUTES_KEY = 'agentAttributes'.freeze
107
+ USER_ATTRIBUTES_KEY = 'userAttributes'.freeze
108
108
  INTRINSIC_ATTRIBUTES_KEY = 'intrinsics'.freeze
109
109
 
110
110
  def attributes_for_tracer_destination
111
111
  destination = NewRelic::Agent::AttributeFilter::DST_TRANSACTION_TRACER
112
112
 
113
- agent_attributes = self.attributes.agent_attributes_for(destination)
114
- custom_attributes = self.attributes.custom_attributes_for(destination)
113
+ agent_attributes = self.attributes.agent_attributes_for(destination)
114
+ custom_attributes = self.attributes.custom_attributes_for(destination)
115
115
  intrinsic_attributes = self.attributes.intrinsic_attributes_for(destination)
116
116
 
117
117
  {
118
- AGENT_ATTRIBUTES_KEY => agent_attributes,
119
- USER_ATTRIBUTES_KEY => custom_attributes,
118
+ AGENT_ATTRIBUTES_KEY => agent_attributes,
119
+ USER_ATTRIBUTES_KEY => custom_attributes,
120
120
  INTRINSIC_ATTRIBUTES_KEY => intrinsic_attributes
121
121
  }
122
122
  end
@@ -21,24 +21,24 @@ module NewRelic
21
21
  end
22
22
  end
23
23
 
24
- SUPPORTABILITY_PREFIX = "Supportability/TraceContext"
25
- CREATE_PREFIX = "#{SUPPORTABILITY_PREFIX}/Create"
26
- ACCEPT_PREFIX = "#{SUPPORTABILITY_PREFIX}/Accept"
27
- TRACESTATE_PREFIX = "#{SUPPORTABILITY_PREFIX}/TraceState"
24
+ SUPPORTABILITY_PREFIX = "Supportability/TraceContext"
25
+ CREATE_PREFIX = "#{SUPPORTABILITY_PREFIX}/Create"
26
+ ACCEPT_PREFIX = "#{SUPPORTABILITY_PREFIX}/Accept"
27
+ TRACESTATE_PREFIX = "#{SUPPORTABILITY_PREFIX}/TraceState"
28
28
 
29
- CREATE_SUCCESS_METRIC = "#{CREATE_PREFIX}/Success"
30
- CREATE_EXCEPTION_METRIC = "#{CREATE_PREFIX}/Exception"
29
+ CREATE_SUCCESS_METRIC = "#{CREATE_PREFIX}/Success"
30
+ CREATE_EXCEPTION_METRIC = "#{CREATE_PREFIX}/Exception"
31
31
 
32
- ACCEPT_SUCCESS_METRIC = "#{ACCEPT_PREFIX}/Success"
33
- ACCEPT_EXCEPTION_METRIC = "#{ACCEPT_PREFIX}/Exception"
34
- IGNORE_MULTIPLE_ACCEPT_METRIC = "#{ACCEPT_PREFIX}/Ignored/Multiple"
32
+ ACCEPT_SUCCESS_METRIC = "#{ACCEPT_PREFIX}/Success"
33
+ ACCEPT_EXCEPTION_METRIC = "#{ACCEPT_PREFIX}/Exception"
34
+ IGNORE_MULTIPLE_ACCEPT_METRIC = "#{ACCEPT_PREFIX}/Ignored/Multiple"
35
35
  IGNORE_ACCEPT_AFTER_CREATE_METRIC = "#{ACCEPT_PREFIX}/Ignored/CreateBeforeAccept"
36
36
 
37
- NO_NR_ENTRY_TRACESTATE_METRIC = "#{TRACESTATE_PREFIX}/NoNrEntry"
37
+ NO_NR_ENTRY_TRACESTATE_METRIC = "#{TRACESTATE_PREFIX}/NoNrEntry"
38
38
  INVALID_TRACESTATE_PAYLOAD_METRIC = "#{TRACESTATE_PREFIX}/InvalidNrEntry"
39
39
 
40
40
  attr_accessor :trace_context_header_data
41
- attr_reader :trace_state_payload
41
+ attr_reader :trace_state_payload
42
42
 
43
43
  def trace_parent_header_present? request
44
44
  request[NewRelic::HTTP_TRACEPARENT_KEY]
@@ -48,7 +48,7 @@ module NewRelic
48
48
  header_data = NewRelic::Agent::DistributedTracing::TraceContext.parse(
49
49
  format: NewRelic::FORMAT_RACK,
50
50
  carrier: request,
51
- trace_state_entry_key: AccountHelpers.trace_state_entry_key,
51
+ trace_state_entry_key: AccountHelpers.trace_state_entry_key
52
52
  )
53
53
  return if header_data.nil?
54
54
 
@@ -56,7 +56,7 @@ module NewRelic
56
56
  end
57
57
  private :accept_trace_context_incoming_request
58
58
 
59
- def insert_trace_context_header header, format=NewRelic::FORMAT_NON_RACK
59
+ def insert_trace_context_header header, format = NewRelic::FORMAT_NON_RACK
60
60
  return unless Agent.config[:'distributed_tracing.enabled']
61
61
 
62
62
  NewRelic::Agent::DistributedTracing::TraceContext.insert \
@@ -98,7 +98,6 @@ module NewRelic
98
98
  return
99
99
  end
100
100
 
101
-
102
101
  span_guid = Agent.config[:'span_events.enabled'] ? transaction.current_segment.guid : nil
103
102
  transaction_guid = Agent.config[:'analytics_events.enabled'] ? transaction.guid : nil
104
103
 
@@ -161,7 +160,6 @@ module NewRelic
161
160
  def trace_context_inserted?
162
161
  @trace_context_inserted ||= false
163
162
  end
164
-
165
163
  end
166
164
  end
167
165
  end
@@ -17,13 +17,13 @@ module NewRelic
17
17
 
18
18
  UNKNOWN_NODE_NAME = '<unknown>'.freeze
19
19
 
20
- def initialize(metric_name, relative_start, relative_end=nil, params=nil, parent=nil)
20
+ def initialize(metric_name, relative_start, relative_end = nil, params = nil, parent = nil)
21
21
  @entry_timestamp = relative_start
22
- @metric_name = metric_name || UNKNOWN_NODE_NAME
23
- @exit_timestamp = relative_end
24
- @children = nil
25
- @params = select_allowed_params(params)
26
- @parent_node = parent
22
+ @metric_name = metric_name || UNKNOWN_NODE_NAME
23
+ @exit_timestamp = relative_end
24
+ @children = nil
25
+ @params = select_allowed_params(params)
26
+ @parent_node = parent
27
27
  end
28
28
 
29
29
  def select_allowed_params params
@@ -44,23 +44,23 @@ module NewRelic
44
44
  end
45
45
 
46
46
  def to_array
47
- params = @params ? @params : NewRelic::EMPTY_HASH
48
- [ NewRelic::Helper.time_to_millis(@entry_timestamp),
47
+ params = @params || NewRelic::EMPTY_HASH
48
+ [NewRelic::Helper.time_to_millis(@entry_timestamp),
49
49
  NewRelic::Helper.time_to_millis(@exit_timestamp),
50
50
  NewRelic::Coerce.string(@metric_name),
51
- params ] +
52
- [ (@children ? @children.map{|s| s.to_array} : NewRelic::EMPTY_ARRAY) ]
51
+ params] +
52
+ [(@children ? @children.map { |s| s.to_array } : NewRelic::EMPTY_ARRAY)]
53
53
  end
54
54
 
55
55
  def path_string
56
- "#{metric_name}[#{children.collect {|node| node.path_string }.join('')}]"
56
+ "#{metric_name}[#{children.collect { |node| node.path_string }.join('')}]"
57
57
  end
58
58
 
59
59
  def to_s_compact
60
60
  str = ""
61
61
  str << metric_name
62
62
  if children.any?
63
- str << "{#{children.map { | cs | cs.to_s_compact }.join(",")}}"
63
+ str << "{#{children.map { |cs| cs.to_s_compact }.join(",")}}"
64
64
  end
65
65
  str
66
66
  end
@@ -68,9 +68,9 @@ module NewRelic
68
68
  def to_debug_str(depth)
69
69
  tab = " " * depth
70
70
  s = tab.clone
71
- s << ">> #{'%3i ms' % (@entry_timestamp*1000)} [#{self.class.name.split("::").last}] #{metric_name} \n"
71
+ s << ">> #{'%3i ms' % (@entry_timestamp * 1000)} [#{self.class.name.split("::").last}] #{metric_name} \n"
72
72
  unless params.empty?
73
- params.each do |k,v|
73
+ params.each do |k, v|
74
74
  s << "#{tab} -#{'%-16s' % k}: #{v.to_s[0..80]}\n"
75
75
  end
76
76
  end
@@ -80,7 +80,7 @@ module NewRelic
80
80
  s << tab + "<< "
81
81
  s << case @exit_timestamp
82
82
  when nil then ' n/a'
83
- when Numeric then '%3i ms' % (@exit_timestamp*1000)
83
+ when Numeric then '%3i ms' % (@exit_timestamp * 1000)
84
84
  else @exit_timestamp.to_s
85
85
  end
86
86
  s << " #{metric_name}\n"
@@ -110,7 +110,7 @@ module NewRelic
110
110
 
111
111
  def count_nodes
112
112
  count = 1
113
- children.each { | node | count += node.count_nodes }
113
+ children.each { |node| count += node.count_nodes }
114
114
  count
115
115
  end
116
116
 
@@ -6,7 +6,6 @@ module NewRelic
6
6
  module Agent
7
7
  class Transaction
8
8
  module Tracing
9
-
10
9
  attr_reader :current_segment
11
10
 
12
11
  def async?
@@ -48,8 +47,7 @@ module NewRelic
48
47
  segments.each { |s| s.finalize }
49
48
  end
50
49
 
51
-
52
- WEB_TRANSACTION_TOTAL_TIME = "WebTransactionTotalTime".freeze
50
+ WEB_TRANSACTION_TOTAL_TIME = "WebTransactionTotalTime".freeze
53
51
  OTHER_TRANSACTION_TOTAL_TIME = "OtherTransactionTotalTime".freeze
54
52
 
55
53
  def record_total_time_metrics
@@ -81,7 +81,7 @@ module NewRelic
81
81
  # This doesn't use the more convenient #last and #sort_by to avoid
82
82
  # additional array allocations (and abundant alliteration)
83
83
  def truncate_samples
84
- @samples.sort!{|a,b| a.duration <=> b.duration}
84
+ @samples.sort! { |a, b| a.duration <=> b.duration }
85
85
  @samples.slice!(0..-(max_capacity + 1))
86
86
  end
87
87
 
@@ -98,7 +98,6 @@ module NewRelic
98
98
  def add_sample(sample)
99
99
  @samples << sample
100
100
  end
101
-
102
101
  end
103
102
  end
104
103
  end