newrelic_rpm 8.0.0 → 8.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (281) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.rubocop.yml +1936 -0
  4. data/Brewfile +10 -0
  5. data/CHANGELOG.md +96 -0
  6. data/CONTRIBUTING.md +15 -3
  7. data/Guardfile +8 -8
  8. data/README.md +3 -1
  9. data/Rakefile +7 -9
  10. data/bin/mongrel_rpm +8 -9
  11. data/bin/newrelic +1 -1
  12. data/bin/nrdebug +14 -14
  13. data/init.rb +0 -2
  14. data/lefthook.yml +9 -0
  15. data/lib/new_relic/agent/adaptive_sampler.rb +7 -3
  16. data/lib/new_relic/agent/agent.rb +38 -40
  17. data/lib/new_relic/agent/agent_logger.rb +8 -9
  18. data/lib/new_relic/agent/attribute_filter.rb +31 -31
  19. data/lib/new_relic/agent/attributes.rb +2 -2
  20. data/lib/new_relic/agent/autostart.rb +6 -7
  21. data/lib/new_relic/agent/commands/agent_command.rb +2 -2
  22. data/lib/new_relic/agent/commands/agent_command_router.rb +6 -5
  23. data/lib/new_relic/agent/commands/thread_profiler_session.rb +0 -3
  24. data/lib/new_relic/agent/configuration/default_source.rb +343 -337
  25. data/lib/new_relic/agent/configuration/dotted_hash.rb +3 -3
  26. data/lib/new_relic/agent/configuration/environment_source.rb +3 -4
  27. data/lib/new_relic/agent/configuration/event_harvest_config.rb +2 -4
  28. data/lib/new_relic/agent/configuration/high_security_source.rb +7 -7
  29. data/lib/new_relic/agent/configuration/manager.rb +57 -57
  30. data/lib/new_relic/agent/configuration/mask_defaults.rb +1 -1
  31. data/lib/new_relic/agent/configuration/security_policy_source.rb +73 -73
  32. data/lib/new_relic/agent/configuration/server_source.rb +10 -10
  33. data/lib/new_relic/agent/configuration/yaml_source.rb +9 -9
  34. data/lib/new_relic/agent/connect/request_builder.rb +13 -16
  35. data/lib/new_relic/agent/connect/response_handler.rb +0 -3
  36. data/lib/new_relic/agent/custom_event_aggregator.rb +9 -10
  37. data/lib/new_relic/agent/database/explain_plan_helpers.rb +3 -4
  38. data/lib/new_relic/agent/database/obfuscation_helpers.rb +12 -12
  39. data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +2 -2
  40. data/lib/new_relic/agent/database.rb +20 -24
  41. data/lib/new_relic/agent/datastores/metric_helper.rb +10 -10
  42. data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +2 -3
  43. data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +3 -5
  44. data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +1 -2
  45. data/lib/new_relic/agent/datastores/redis.rb +2 -4
  46. data/lib/new_relic/agent/datastores.rb +1 -3
  47. data/lib/new_relic/agent/distributed_tracing/cross_app_payload.rb +5 -5
  48. data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +11 -10
  49. data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +10 -11
  50. data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +41 -42
  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 +24 -24
  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 +10 -10
  64. data/lib/new_relic/agent/external.rb +1 -2
  65. data/lib/new_relic/agent/guid_generator.rb +2 -9
  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 +5 -7
  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 +9 -10
  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 +2 -2
  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/active_storage.rb +1 -1
  88. data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +8 -9
  89. data/lib/new_relic/agent/instrumentation/bunny/chain.rb +1 -1
  90. data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +7 -8
  91. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +41 -41
  92. data/lib/new_relic/agent/instrumentation/curb/chain.rb +19 -20
  93. data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +34 -38
  94. data/lib/new_relic/agent/instrumentation/curb/prepend.rb +9 -10
  95. data/lib/new_relic/agent/instrumentation/data_mapper.rb +10 -10
  96. data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +5 -7
  97. data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +5 -9
  98. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +4 -4
  99. data/lib/new_relic/agent/instrumentation/excon/middleware.rb +2 -2
  100. data/lib/new_relic/agent/instrumentation/excon.rb +0 -1
  101. data/lib/new_relic/agent/instrumentation/grape/chain.rb +1 -2
  102. data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +6 -7
  103. data/lib/new_relic/agent/instrumentation/grape.rb +2 -3
  104. data/lib/new_relic/agent/instrumentation/httpclient/chain.rb +2 -3
  105. data/lib/new_relic/agent/instrumentation/httpclient/instrumentation.rb +0 -1
  106. data/lib/new_relic/agent/instrumentation/httpclient/prepend.rb +0 -2
  107. data/lib/new_relic/agent/instrumentation/httprb/chain.rb +2 -2
  108. data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +6 -6
  109. data/lib/new_relic/agent/instrumentation/httprb/prepend.rb +1 -1
  110. data/lib/new_relic/agent/instrumentation/ignore_actions.rb +2 -3
  111. data/lib/new_relic/agent/instrumentation/logger/chain.rb +21 -0
  112. data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +58 -0
  113. data/lib/new_relic/agent/instrumentation/logger/prepend.rb +13 -0
  114. data/lib/new_relic/agent/instrumentation/logger.rb +25 -0
  115. data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +7 -2
  116. data/lib/new_relic/agent/instrumentation/memcache/helper.rb +5 -1
  117. data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +9 -2
  118. data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +9 -10
  119. data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +4 -5
  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 +5 -5
  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 +6 -6
  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 +5 -4
  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 +28 -28
  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 +42 -43
  169. data/lib/new_relic/agent/method_tracer.rb +17 -15
  170. data/lib/new_relic/agent/method_tracer_helpers.rb +2 -2
  171. data/lib/new_relic/agent/monitors/cross_app_monitor.rb +19 -16
  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 +26 -33
  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 +15 -7
  185. data/lib/new_relic/agent/payload_metric_mapping.rb +8 -9
  186. data/lib/new_relic/agent/pipe_channel_manager.rb +5 -6
  187. data/lib/new_relic/agent/pipe_service.rb +1 -1
  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/delayed_job_sampler.rb +10 -7
  195. data/lib/new_relic/agent/samplers/memory_sampler.rb +4 -3
  196. data/lib/new_relic/agent/samplers/vm_sampler.rb +18 -18
  197. data/lib/new_relic/agent/span_event_aggregator.rb +8 -8
  198. data/lib/new_relic/agent/span_event_primitive.rb +39 -39
  199. data/lib/new_relic/agent/sql_sampler.rb +9 -9
  200. data/lib/new_relic/agent/stats.rb +16 -16
  201. data/lib/new_relic/agent/stats_engine/gc_profiler.rb +7 -9
  202. data/lib/new_relic/agent/stats_engine/stats_hash.rb +8 -9
  203. data/lib/new_relic/agent/stats_engine.rb +6 -6
  204. data/lib/new_relic/agent/synthetics_event_aggregator.rb +0 -1
  205. data/lib/new_relic/agent/system_info.rb +22 -20
  206. data/lib/new_relic/agent/threading/agent_thread.rb +4 -5
  207. data/lib/new_relic/agent/threading/backtrace_node.rb +6 -9
  208. data/lib/new_relic/agent/threading/backtrace_service.rb +8 -8
  209. data/lib/new_relic/agent/threading/thread_profile.rb +15 -18
  210. data/lib/new_relic/agent/tracer.rb +37 -43
  211. data/lib/new_relic/agent/transaction/abstract_segment.rb +6 -6
  212. data/lib/new_relic/agent/transaction/datastore_segment.rb +7 -6
  213. data/lib/new_relic/agent/transaction/distributed_tracer.rb +8 -9
  214. data/lib/new_relic/agent/transaction/distributed_tracing.rb +21 -22
  215. data/lib/new_relic/agent/transaction/external_request_segment.rb +6 -5
  216. data/lib/new_relic/agent/transaction/message_broker_segment.rb +23 -23
  217. data/lib/new_relic/agent/transaction/request_attributes.rb +7 -7
  218. data/lib/new_relic/agent/transaction/segment.rb +6 -3
  219. data/lib/new_relic/agent/transaction/slowest_sample_buffer.rb +0 -2
  220. data/lib/new_relic/agent/transaction/trace.rb +8 -8
  221. data/lib/new_relic/agent/transaction/trace_context.rb +13 -15
  222. data/lib/new_relic/agent/transaction/trace_node.rb +16 -16
  223. data/lib/new_relic/agent/transaction/tracing.rb +1 -3
  224. data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -2
  225. data/lib/new_relic/agent/transaction.rb +79 -81
  226. data/lib/new_relic/agent/transaction_error_primitive.rb +16 -16
  227. data/lib/new_relic/agent/transaction_event_aggregator.rb +5 -6
  228. data/lib/new_relic/agent/transaction_event_primitive.rb +29 -29
  229. data/lib/new_relic/agent/transaction_metrics.rb +3 -3
  230. data/lib/new_relic/agent/transaction_sampler.rb +0 -1
  231. data/lib/new_relic/agent/transaction_time_aggregator.rb +6 -6
  232. data/lib/new_relic/agent/utilization/azure.rb +1 -1
  233. data/lib/new_relic/agent/utilization_data.rb +3 -4
  234. data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +1 -1
  235. data/lib/new_relic/agent/vm/snapshot.rb +3 -3
  236. data/lib/new_relic/agent/worker_loop.rb +3 -5
  237. data/lib/new_relic/agent.rb +22 -22
  238. data/lib/new_relic/cli/command.rb +15 -17
  239. data/lib/new_relic/cli/commands/deployments.rb +20 -22
  240. data/lib/new_relic/cli/commands/install.rb +6 -10
  241. data/lib/new_relic/coerce.rb +5 -8
  242. data/lib/new_relic/collection_helper.rb +48 -47
  243. data/lib/new_relic/control/class_methods.rb +2 -2
  244. data/lib/new_relic/control/frameworks/external.rb +1 -1
  245. data/lib/new_relic/control/frameworks/rails.rb +5 -6
  246. data/lib/new_relic/control/frameworks/rails3.rb +2 -3
  247. data/lib/new_relic/control/frameworks/ruby.rb +2 -2
  248. data/lib/new_relic/control/frameworks/sinatra.rb +6 -0
  249. data/lib/new_relic/control/instance_methods.rb +4 -5
  250. data/lib/new_relic/control/instrumentation.rb +4 -5
  251. data/lib/new_relic/control/server_methods.rb +2 -3
  252. data/lib/new_relic/control.rb +0 -1
  253. data/lib/new_relic/dependency_detection.rb +6 -8
  254. data/lib/new_relic/environment_report.rb +16 -18
  255. data/lib/new_relic/helper.rb +5 -5
  256. data/lib/new_relic/language_support.rb +1 -1
  257. data/lib/new_relic/latest_changes.rb +2 -2
  258. data/lib/new_relic/local_environment.rb +7 -7
  259. data/lib/new_relic/metric_data.rb +6 -7
  260. data/lib/new_relic/metric_spec.rb +3 -3
  261. data/lib/new_relic/noticed_error.rb +14 -15
  262. data/lib/new_relic/rack/agent_middleware.rb +2 -2
  263. data/lib/new_relic/rack/browser_monitoring.rb +9 -9
  264. data/lib/new_relic/recipes/capistrano3.rb +11 -13
  265. data/lib/new_relic/recipes/capistrano_legacy.rb +11 -14
  266. data/lib/new_relic/supportability_helper.rb +1 -2
  267. data/lib/new_relic/version.rb +3 -4
  268. data/lib/sequel/extensions/newrelic_instrumentation.rb +4 -7
  269. data/lib/sequel/plugins/newrelic_instrumentation.rb +3 -9
  270. data/lib/tasks/all.rb +1 -1
  271. data/lib/tasks/config.rake +21 -21
  272. data/lib/tasks/multiverse.rb +4 -6
  273. data/lib/tasks/tests.rake +3 -7
  274. data/newrelic.yml +8 -21
  275. data/newrelic_rpm.gemspec +13 -12
  276. data/recipes/newrelic.rb +1 -1
  277. data/test/agent_helper.rb +55 -55
  278. metadata +43 -7
  279. data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +0 -125
  280. data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +0 -46
  281. data/lib/new_relic/agent/supported_versions.rb +0 -275
@@ -30,13 +30,12 @@ require 'new_relic/agent/internal_agent_error'
30
30
  module NewRelic
31
31
  module Agent
32
32
  class StatsHash
33
-
34
33
  attr_accessor :started_at, :harvested_at
35
34
 
36
- def initialize(started_at=Process.clock_gettime(Process::CLOCK_REALTIME))
35
+ def initialize(started_at = Process.clock_gettime(Process::CLOCK_REALTIME))
37
36
  @started_at = started_at.to_f
38
- @scoped = Hash.new { |h, k| h[k] = NewRelic::Agent::Stats.new }
39
- @unscoped = Hash.new { |h, k| h[k] = NewRelic::Agent::Stats.new }
37
+ @scoped = Hash.new { |h, k| h[k] = NewRelic::Agent::Stats.new }
38
+ @unscoped = Hash.new { |h, k| h[k] = NewRelic::Agent::Stats.new }
40
39
  end
41
40
 
42
41
  def marshal_dump
@@ -45,7 +44,7 @@ module NewRelic
45
44
 
46
45
  def marshal_load(data)
47
46
  @started_at = data.shift
48
- @scoped = Hash.new { |h, k| h[k] = NewRelic::Agent::Stats.new }
47
+ @scoped = Hash.new { |h, k| h[k] = NewRelic::Agent::Stats.new }
49
48
  @unscoped = Hash.new { |h, k| h[k] = NewRelic::Agent::Stats.new }
50
49
  @scoped.merge!(data.shift)
51
50
  @unscoped.merge!(data.shift)
@@ -57,7 +56,7 @@ module NewRelic
57
56
 
58
57
  def to_h
59
58
  hash = {}
60
- @scoped.each { |k, v| hash[k] = v }
59
+ @scoped.each { |k, v| hash[k] = v }
61
60
  @unscoped.each { |k, v| hash[NewRelic::MetricSpec.new(k)] = v }
62
61
  hash
63
62
  end
@@ -99,7 +98,7 @@ module NewRelic
99
98
  end
100
99
  end
101
100
 
102
- def record(metric_specs, value=nil, aux=nil, &blk)
101
+ def record(metric_specs, value = nil, aux = nil, &blk)
103
102
  Array(metric_specs).each do |metric_spec|
104
103
  if metric_spec.scope.empty?
105
104
  key = metric_spec.name
@@ -122,8 +121,8 @@ module NewRelic
122
121
  def handle_stats_lookup_error(key, hash, error)
123
122
  # This only happen in the case of a corrupted default_proc
124
123
  # Side-step it manually, notice the issue, and carry on....
125
- NewRelic::Agent.instance.error_collector. \
126
- notice_agent_error(StatsHashLookupError.new(error, hash, key))
124
+ NewRelic::Agent.instance.error_collector \
125
+ .notice_agent_error(StatsHashLookupError.new(error, hash, key))
127
126
  stats = NewRelic::Agent::Stats.new
128
127
  hash[key] = stats
129
128
  # Try to restore the default_proc so we won't continually trip the error
@@ -13,8 +13,8 @@ module NewRelic
13
13
  attr_accessor :metric_rules
14
14
 
15
15
  def initialize
16
- @stats_lock = Mutex.new
17
- @stats_hash = StatsHash.new
16
+ @stats_lock = Mutex.new
17
+ @stats_hash = StatsHash.new
18
18
  @metric_rules = RulesEngine.new
19
19
  end
20
20
 
@@ -60,12 +60,12 @@ module NewRelic
60
60
  #
61
61
  # @api private
62
62
  #
63
- def tl_record_unscoped_metrics(metric_names, value=nil, aux=nil, &blk)
63
+ def tl_record_unscoped_metrics(metric_names, value = nil, aux = nil, &blk)
64
64
  state = NewRelic::Agent::Tracer.state
65
65
  record_unscoped_metrics(state, metric_names, value, aux, &blk)
66
66
  end
67
67
 
68
- def record_unscoped_metrics(state, metric_names, value=nil, aux=nil, &blk)
68
+ def record_unscoped_metrics(state, metric_names, value = nil, aux = nil, &blk)
69
69
  txn = state.current_transaction
70
70
  if txn
71
71
  txn.metrics.record_unscoped(metric_names, value, aux, &blk)
@@ -96,12 +96,12 @@ module NewRelic
96
96
  #
97
97
  # @api private
98
98
  #
99
- def tl_record_scoped_and_unscoped_metrics(scoped_metric, summary_metrics=nil, value=nil, aux=nil, &blk)
99
+ def tl_record_scoped_and_unscoped_metrics(scoped_metric, summary_metrics = nil, value = nil, aux = nil, &blk)
100
100
  state = NewRelic::Agent::Tracer.state
101
101
  record_scoped_and_unscoped_metrics(state, scoped_metric, summary_metrics, value, aux, &blk)
102
102
  end
103
103
 
104
- def record_scoped_and_unscoped_metrics(state, scoped_metric, summary_metrics=nil, value=nil, aux=nil, &blk)
104
+ def record_scoped_and_unscoped_metrics(state, scoped_metric, summary_metrics = nil, value = nil, aux = nil, &blk)
105
105
  txn = state.current_transaction
106
106
  if txn
107
107
  txn.metrics.record_scoped_and_unscoped(scoped_metric, value, aux, &blk)
@@ -42,4 +42,3 @@ module NewRelic
42
42
  end
43
43
  end
44
44
  end
45
-
@@ -43,8 +43,8 @@ module NewRelic
43
43
  if @processor_info.nil?
44
44
  if darwin?
45
45
  @processor_info = {
46
- :num_physical_packages => sysctl_value('hw.packages').to_i,
47
- :num_physical_cores => sysctl_value('hw.physicalcpu_max').to_i,
46
+ :num_physical_packages => sysctl_value('hw.packages').to_i,
47
+ :num_physical_cores => sysctl_value('hw.physicalcpu_max').to_i,
48
48
  :num_logical_processors => sysctl_value('hw.logicalcpu_max').to_i
49
49
  }
50
50
  # in case those don't work, try backup values
@@ -64,8 +64,8 @@ module NewRelic
64
64
 
65
65
  elsif bsd?
66
66
  @processor_info = {
67
- :num_physical_packages => nil,
68
- :num_physical_cores => nil,
67
+ :num_physical_packages => nil,
68
+ :num_physical_cores => nil,
69
69
  :num_logical_processors => sysctl_value('hw.ncpu').to_i
70
70
  }
71
71
  end
@@ -111,9 +111,9 @@ module NewRelic
111
111
  end
112
112
  cores[[phys_id, core_id]] += 1 if phys_id && core_id
113
113
 
114
- num_physical_packages = cores.keys.map(&:first).uniq.size
115
- num_physical_cores = cores.size
116
- num_logical_processors = cores.values.reduce(0,:+)
114
+ num_physical_packages = cores.keys.map(&:first).uniq.size
115
+ num_physical_cores = cores.size
116
+ num_logical_processors = cores.values.reduce(0, :+)
117
117
 
118
118
  if num_physical_cores == 0
119
119
  num_logical_processors = total_processors
@@ -127,24 +127,26 @@ module NewRelic
127
127
  # Some older, single-core processors might not list ids,
128
128
  # so we'll just mark them all 1.
129
129
  num_physical_packages = 1
130
- num_physical_cores = 1
130
+ num_physical_cores = 1
131
131
  else
132
132
  # We have no way of knowing how many packages or cores
133
133
  # we have, even though we know how many processors there are.
134
134
  num_physical_packages = nil
135
- num_physical_cores = nil
135
+ num_physical_cores = nil
136
136
  end
137
137
  end
138
138
 
139
139
  {
140
- :num_physical_packages => num_physical_packages,
141
- :num_physical_cores => num_physical_cores,
140
+ :num_physical_packages => num_physical_packages,
141
+ :num_physical_cores => num_physical_cores,
142
142
  :num_logical_processors => num_logical_processors
143
143
  }
144
144
  end
145
145
 
146
- def self.num_physical_packages ; get_processor_info[:num_physical_packages ] end
147
- def self.num_physical_cores ; get_processor_info[:num_physical_cores ] end
146
+ def self.num_physical_packages; get_processor_info[:num_physical_packages] end
147
+
148
+ def self.num_physical_cores; get_processor_info[:num_physical_cores] end
149
+
148
150
  def self.num_logical_processors; get_processor_info[:num_logical_processors] end
149
151
 
150
152
  def self.processor_arch
@@ -178,12 +180,12 @@ module NewRelic
178
180
  return
179
181
  end
180
182
  # docker native driver with systemd
181
- when '/' then nil
183
+ when '/' then nil
182
184
  # in a cgroup, but we don't recognize its format
183
- when /docker\/.*[^0-9a-f]/ then
185
+ when /docker\/.*[^0-9a-f]/
184
186
  ::NewRelic::Agent.logger.debug("Cgroup indicates docker but container_id has invalid characters: '#{cpu_cgroup}'")
185
187
  return
186
- when /docker/ then
188
+ when /docker/
187
189
  ::NewRelic::Agent.logger.debug("Cgroup indicates docker but container_id unrecognized: '#{cpu_cgroup}'")
188
190
  ::NewRelic::Agent.increment_metric "Supportability/utilization/docker/error"
189
191
  return
@@ -241,12 +243,12 @@ module NewRelic
241
243
 
242
244
  def self.ram_in_mib
243
245
  if darwin?
244
- (sysctl_value('hw.memsize').to_i / (1024 ** 2)).to_i
246
+ (sysctl_value('hw.memsize').to_i / (1024**2)).to_i
245
247
  elsif linux?
246
248
  meminfo = proc_try_read('/proc/meminfo')
247
249
  parse_linux_meminfo_in_mib(meminfo)
248
250
  elsif bsd?
249
- (sysctl_value('hw.realmem').to_i / (1024 ** 2)).to_i
251
+ (sysctl_value('hw.realmem').to_i / (1024**2)).to_i
250
252
  else
251
253
  ::NewRelic::Agent.logger.debug("Unable to determine ram_in_mib for host os: #{ruby_os_identifier}")
252
254
  nil
@@ -254,7 +256,7 @@ module NewRelic
254
256
  end
255
257
 
256
258
  def self.parse_linux_meminfo_in_mib(meminfo)
257
- if meminfo && mem_total = meminfo[/MemTotal:\s*(\d*)\skB/,1]
259
+ if meminfo && mem_total = meminfo[/MemTotal:\s*(\d*)\skB/, 1]
258
260
  (mem_total.to_i / 1024).to_i
259
261
  else
260
262
  ::NewRelic::Agent.logger.debug("Failed to parse MemTotal from /proc/meminfo: #{meminfo}")
@@ -279,7 +281,7 @@ module NewRelic
279
281
  else
280
282
  ::NewRelic::Agent.logger.debug("Found boot_id with invalid length: #{bid}")
281
283
  ::NewRelic::Agent.increment_metric "Supportability/utilization/boot_id/error"
282
- bid[0,128]
284
+ bid[0, 128]
283
285
 
284
286
  end
285
287
  else
@@ -6,7 +6,6 @@ module NewRelic
6
6
  module Agent
7
7
  module Threading
8
8
  class AgentThread
9
-
10
9
  def self.create(label, &blk)
11
10
  ::NewRelic::Agent.logger.debug("Creating New Relic thread: #{label}")
12
11
  wrapped_blk = Proc.new do
@@ -33,16 +32,16 @@ module NewRelic
33
32
  backing_thread_class.list
34
33
  end
35
34
 
36
- def self.bucket_thread(thread, profile_agent_code) #THREAD_LOCAL_ACCESS
35
+ def self.bucket_thread(thread, profile_agent_code) # THREAD_LOCAL_ACCESS
37
36
  if thread.key?(:newrelic_label)
38
37
  profile_agent_code ? :agent : :ignore
39
38
  else
40
39
  state = Tracer.state_for(thread)
41
- txn = state.current_transaction
40
+ txn = state.current_transaction
42
41
 
43
- if txn && !txn.recording_web_transaction?
42
+ if txn && !txn.recording_web_transaction?
44
43
  :background
45
- elsif txn && txn.recording_web_transaction?
44
+ elsif txn && txn.recording_web_transaction?
46
45
  :request
47
46
  else
48
47
  :other
@@ -13,7 +13,7 @@ module NewRelic
13
13
 
14
14
  def initialize
15
15
  @children = []
16
- @depth = 0
16
+ @depth = 0
17
17
  end
18
18
 
19
19
  def add_child_unless_present(child)
@@ -31,7 +31,6 @@ module NewRelic
31
31
  end
32
32
  end
33
33
 
34
-
35
34
  class BacktraceRoot < BacktraceBase
36
35
  attr_reader :flattened
37
36
 
@@ -78,9 +77,8 @@ module NewRelic
78
77
  end
79
78
  end
80
79
 
81
-
82
80
  class BacktraceNode < BacktraceBase
83
- attr_reader :file, :method, :line_no, :raw_line, :as_array
81
+ attr_reader :file, :method, :line_no, :raw_line, :as_array
84
82
  attr_accessor :runnable_count, :depth
85
83
 
86
84
  def initialize(line)
@@ -92,8 +90,8 @@ module NewRelic
92
90
 
93
91
  def ==(other)
94
92
  (
95
- @raw_line == other.raw_line &&
96
- @depth == other.depth &&
93
+ @raw_line == other.raw_line &&
94
+ @depth == other.depth &&
97
95
  @runnable_count == other.runnable_count
98
96
  )
99
97
  end
@@ -115,10 +113,10 @@ module NewRelic
115
113
  @as_array << child_arrays
116
114
  end
117
115
 
118
- def dump_string(indent=0)
116
+ def dump_string(indent = 0)
119
117
  @file, @method, @line_no = parse_backtrace_frame(@raw_line)
120
118
  result = "#{" " * indent}#<BacktraceNode:#{object_id} [#{@runnable_count}] #{@file}:#{@line_no} in #{@method}>"
121
- child_results = @children.map { |c| c.dump_string(indent+2) }.join("\n")
119
+ child_results = @children.map { |c| c.dump_string(indent + 2) }.join("\n")
122
120
  result << "\n" unless child_results.empty?
123
121
  result << child_results
124
122
  end
@@ -129,7 +127,6 @@ module NewRelic
129
127
  [$1, $4, $3] # sic
130
128
  end
131
129
  end
132
-
133
130
  end
134
131
  end
135
132
  end
@@ -20,10 +20,10 @@ module NewRelic
20
20
  end
21
21
 
22
22
  attr_reader :worker_loop, :buffer, :effective_polling_period,
23
- :overhead_percent_threshold
23
+ :overhead_percent_threshold
24
24
  attr_accessor :worker_thread, :profile_agent_code
25
25
 
26
- def initialize(event_listener=nil)
26
+ def initialize(event_listener = nil)
27
27
  @profiles = {}
28
28
  @buffer = {}
29
29
  @last_poll = nil
@@ -52,7 +52,7 @@ module NewRelic
52
52
  @running
53
53
  end
54
54
 
55
- def subscribe(transaction_name, command_arguments={})
55
+ def subscribe(transaction_name, command_arguments = {})
56
56
  if self.class.is_resque?
57
57
  NewRelic::Agent.logger.info("Backtracing threads on Resque is not supported, so not subscribing transaction '#{transaction_name}'")
58
58
  return
@@ -113,11 +113,11 @@ module NewRelic
113
113
  end
114
114
 
115
115
  def on_transaction_finished(payload)
116
- name = payload[:name]
117
- start = payload[:start_timestamp]
116
+ name = payload[:name]
117
+ start = payload[:start_timestamp]
118
118
  duration = payload[:duration]
119
- thread = payload[:thread] || Thread.current
120
- bucket = payload[:bucket]
119
+ thread = payload[:thread] || Thread.current
120
+ bucket = payload[:bucket]
121
121
  @lock.synchronize do
122
122
  backtraces = @buffer.delete(thread)
123
123
  if backtraces && @profiles.has_key?(name)
@@ -197,7 +197,7 @@ module NewRelic
197
197
  # This method is expected to be called with @lock held
198
198
  def watching_for_transaction?
199
199
  @profiles.size > 1 ||
200
- (@profiles.size == 1 && @profiles[ALL_TRANSACTIONS].nil?)
200
+ (@profiles.size == 1 && @profiles[ALL_TRANSACTIONS].nil?)
201
201
  end
202
202
 
203
203
  def allowed_bucket?(bucket)
@@ -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
@@ -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,10 +130,10 @@ module NewRelic
130
130
  #
131
131
  # @api public
132
132
  def start_transaction_or_segment(name: nil,
133
- partial_name: nil,
134
- category:,
135
- options: {})
136
-
133
+ partial_name: nil,
134
+ category:,
135
+ options: {})
136
+
137
137
  raise ArgumentError, 'missing required argument: name or partial_name' if name.nil? && partial_name.nil?
138
138
 
139
139
  if name
@@ -150,7 +150,6 @@ module NewRelic
150
150
  else
151
151
  Transaction.start_new_transaction(state, category, options)
152
152
  end
153
-
154
153
  rescue ArgumentError
155
154
  raise
156
155
  rescue => exception
@@ -160,10 +159,10 @@ module NewRelic
160
159
  # Takes name or partial_name and a category.
161
160
  # Returns a transaction instance or nil
162
161
  def start_transaction(category:,
163
- name: nil,
164
- partial_name: nil,
165
- **options)
166
-
162
+ name: nil,
163
+ partial_name: nil,
164
+ **options)
165
+
167
166
  raise ArgumentError, 'missing required argument: name or partial_name' if name.nil? && partial_name.nil?
168
167
 
169
168
  return current_transaction if current_transaction
@@ -178,8 +177,8 @@ module NewRelic
178
177
  end
179
178
 
180
179
  Transaction.start_new_transaction(state,
181
- category,
182
- options)
180
+ category,
181
+ options)
183
182
  rescue ArgumentError
184
183
  raise
185
184
  rescue => exception
@@ -231,13 +230,12 @@ module NewRelic
231
230
  #
232
231
  # @api public
233
232
  def start_segment(name:,
234
- unscoped_metrics:nil,
235
- start_time: nil,
236
- parent: nil)
233
+ unscoped_metrics: nil,
234
+ start_time: nil,
235
+ parent: nil)
237
236
 
238
237
  segment = Transaction::Segment.new name, unscoped_metrics, start_time
239
238
  start_and_add_segment segment, parent
240
-
241
239
  rescue ArgumentError
242
240
  raise
243
241
  rescue => exception
@@ -283,20 +281,19 @@ module NewRelic
283
281
  #
284
282
  # @api public
285
283
  def start_datastore_segment(product: nil,
286
- operation: nil,
287
- collection: nil,
288
- host: nil,
289
- port_path_or_id: nil,
290
- database_name: nil,
291
- start_time: nil,
292
- 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)
293
291
 
294
292
  product ||= UNKNOWN
295
293
  operation ||= OTHER
296
294
 
297
295
  segment = Transaction::DatastoreSegment.new product, operation, collection, host, port_path_or_id, database_name
298
296
  start_and_add_segment segment, parent
299
-
300
297
  rescue ArgumentError
301
298
  raise
302
299
  rescue => exception
@@ -331,14 +328,13 @@ module NewRelic
331
328
  #
332
329
  # @api public
333
330
  def start_external_request_segment(library:,
334
- uri:,
335
- procedure:,
336
- start_time: nil,
337
- parent: nil)
331
+ uri:,
332
+ procedure:,
333
+ start_time: nil,
334
+ parent: nil)
338
335
 
339
336
  segment = Transaction::ExternalRequestSegment.new library, uri, procedure, start_time
340
337
  start_and_add_segment segment, parent
341
-
342
338
  rescue ArgumentError
343
339
  raise
344
340
  rescue => exception
@@ -347,7 +343,7 @@ module NewRelic
347
343
 
348
344
  # Will potentially capture and notice an error at the
349
345
  # segment that was executing when error occurred.
350
- # if passed +segment+ is something that doesn't
346
+ # if passed +segment+ is something that doesn't
351
347
  # respond to +notice_segment_error+ then this method
352
348
  # is effectively just a yield to the given &block
353
349
  def capture_segment_error segment
@@ -362,13 +358,13 @@ module NewRelic
362
358
 
363
359
  # For New Relic internal use only.
364
360
  def start_message_broker_segment(action:,
365
- library:,
366
- destination_type:,
367
- destination_name:,
368
- headers: nil,
369
- parameters: nil,
370
- start_time: nil,
371
- parent: nil)
361
+ library:,
362
+ destination_type:,
363
+ destination_name:,
364
+ headers: nil,
365
+ parameters: nil,
366
+ start_time: nil,
367
+ parent: nil)
372
368
 
373
369
  segment = Transaction::MessageBrokerSegment.new(
374
370
  action: action,
@@ -380,7 +376,6 @@ module NewRelic
380
376
  start_time: start_time
381
377
  )
382
378
  start_and_add_segment segment, parent
383
-
384
379
  rescue ArgumentError
385
380
  raise
386
381
  rescue => exception
@@ -415,7 +410,7 @@ module NewRelic
415
410
  def start_and_add_segment segment, parent = nil
416
411
  tracer_state = state
417
412
  if (txn = tracer_state.current_transaction) &&
418
- tracer_state.tracing_enabled?
413
+ tracer_state.tracing_enabled?
419
414
  txn.add_segment segment, parent
420
415
  else
421
416
  segment.record_metrics = false
@@ -433,7 +428,6 @@ module NewRelic
433
428
  # This is THE location to store thread local information during a transaction
434
429
  # Need a new piece of data? Add a method here, NOT a new thread local variable.
435
430
  class State
436
-
437
431
  def initialize
438
432
  @untraced = []
439
433
  @current_transaction = nil
@@ -441,7 +435,7 @@ module NewRelic
441
435
  end
442
436
 
443
437
  # This starts the timer for the transaction.
444
- def reset(transaction=nil)
438
+ def reset(transaction = nil)
445
439
  # We purposefully don't reset @untraced or @record_sql
446
440
  # since those are managed by NewRelic::Agent.disable_* calls explicitly
447
441
  # and (more importantly) outside the scope of a transaction
@@ -25,7 +25,7 @@ module NewRelic
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
30
  @transaction_name = nil
31
31
  @transaction = nil
@@ -94,7 +94,7 @@ module NewRelic
94
94
  end
95
95
 
96
96
  def time_range
97
- @start_time.to_f .. @end_time.to_f
97
+ @start_time.to_f..@end_time.to_f
98
98
  end
99
99
 
100
100
  def children_time_ranges
@@ -131,7 +131,7 @@ module NewRelic
131
131
  @noticed_error = noticed_error
132
132
  end
133
133
 
134
- def notice_error exception, options={}
134
+ def notice_error exception, options = {}
135
135
  if Agent.config[:high_security]
136
136
  NewRelic::Agent.logger.debug \
137
137
  "Segment: #{name} ignores notice_error for " \
@@ -156,7 +156,7 @@ module NewRelic
156
156
 
157
157
  def child_start segment
158
158
  @active_children += 1
159
- @concurrent_children = @concurrent_children || @active_children > 1
159
+ @concurrent_children ||= @active_children > 1
160
160
 
161
161
  transaction.async = true if @concurrent_children
162
162
  end
@@ -180,7 +180,7 @@ module NewRelic
180
180
 
181
181
  def descendant_complete child, descendant
182
182
  RangeExtensions.merge_or_append descendant.time_range,
183
- children_time_ranges
183
+ children_time_ranges
184
184
  # If this child's time was previously added to this segment's
185
185
  # aggregate children time, we need to re-record it using a time range
186
186
  # for proper exclusive time calculation
@@ -227,7 +227,7 @@ module NewRelic
227
227
 
228
228
  def record_child_time_as_range child
229
229
  RangeExtensions.merge_or_append child.time_range,
230
- children_time_ranges
230
+ children_time_ranges
231
231
  child.range_recorded = true
232
232
  end
233
233