newrelic_rpm 8.2.0 → 8.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (266) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1936 -0
  3. data/CHANGELOG.md +17 -2
  4. data/CONTRIBUTING.md +14 -2
  5. data/Guardfile +8 -8
  6. data/Rakefile +5 -7
  7. data/bin/mongrel_rpm +8 -9
  8. data/bin/newrelic +1 -1
  9. data/bin/nrdebug +14 -14
  10. data/init.rb +0 -2
  11. data/lefthook.yml +9 -0
  12. data/lib/new_relic/agent/adaptive_sampler.rb +7 -3
  13. data/lib/new_relic/agent/agent.rb +38 -40
  14. data/lib/new_relic/agent/agent_logger.rb +8 -9
  15. data/lib/new_relic/agent/attribute_filter.rb +31 -31
  16. data/lib/new_relic/agent/attributes.rb +2 -2
  17. data/lib/new_relic/agent/autostart.rb +6 -7
  18. data/lib/new_relic/agent/commands/agent_command.rb +2 -2
  19. data/lib/new_relic/agent/commands/agent_command_router.rb +6 -5
  20. data/lib/new_relic/agent/commands/thread_profiler_session.rb +0 -3
  21. data/lib/new_relic/agent/configuration/default_source.rb +318 -324
  22. data/lib/new_relic/agent/configuration/dotted_hash.rb +3 -3
  23. data/lib/new_relic/agent/configuration/environment_source.rb +3 -4
  24. data/lib/new_relic/agent/configuration/event_harvest_config.rb +2 -4
  25. data/lib/new_relic/agent/configuration/high_security_source.rb +7 -7
  26. data/lib/new_relic/agent/configuration/manager.rb +57 -57
  27. data/lib/new_relic/agent/configuration/mask_defaults.rb +1 -1
  28. data/lib/new_relic/agent/configuration/security_policy_source.rb +73 -73
  29. data/lib/new_relic/agent/configuration/server_source.rb +10 -10
  30. data/lib/new_relic/agent/configuration/yaml_source.rb +9 -9
  31. data/lib/new_relic/agent/connect/request_builder.rb +13 -16
  32. data/lib/new_relic/agent/connect/response_handler.rb +0 -3
  33. data/lib/new_relic/agent/custom_event_aggregator.rb +9 -10
  34. data/lib/new_relic/agent/database/explain_plan_helpers.rb +3 -4
  35. data/lib/new_relic/agent/database/obfuscation_helpers.rb +12 -12
  36. data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +2 -2
  37. data/lib/new_relic/agent/database.rb +20 -24
  38. data/lib/new_relic/agent/datastores/metric_helper.rb +10 -10
  39. data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +2 -3
  40. data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +3 -5
  41. data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +1 -2
  42. data/lib/new_relic/agent/datastores/redis.rb +2 -4
  43. data/lib/new_relic/agent/datastores.rb +1 -3
  44. data/lib/new_relic/agent/distributed_tracing/cross_app_payload.rb +5 -5
  45. data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +11 -10
  46. data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +10 -11
  47. data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +41 -42
  48. data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +3 -3
  49. data/lib/new_relic/agent/distributed_tracing/trace_context.rb +41 -43
  50. data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +23 -23
  51. data/lib/new_relic/agent/distributed_tracing.rb +17 -18
  52. data/lib/new_relic/agent/encoding_normalizer.rb +1 -1
  53. data/lib/new_relic/agent/error_collector.rb +17 -17
  54. data/lib/new_relic/agent/error_event_aggregator.rb +1 -1
  55. data/lib/new_relic/agent/error_filter.rb +6 -8
  56. data/lib/new_relic/agent/error_trace_aggregator.rb +1 -1
  57. data/lib/new_relic/agent/event_aggregator.rb +1 -1
  58. data/lib/new_relic/agent/event_buffer.rb +6 -7
  59. data/lib/new_relic/agent/event_listener.rb +0 -1
  60. data/lib/new_relic/agent/event_loop.rb +10 -10
  61. data/lib/new_relic/agent/external.rb +1 -2
  62. data/lib/new_relic/agent/guid_generator.rb +1 -3
  63. data/lib/new_relic/agent/harvester.rb +3 -4
  64. data/lib/new_relic/agent/heap.rb +1 -3
  65. data/lib/new_relic/agent/hostname.rb +3 -3
  66. data/lib/new_relic/agent/http_clients/abstract.rb +5 -7
  67. data/lib/new_relic/agent/http_clients/curb_wrappers.rb +1 -5
  68. data/lib/new_relic/agent/http_clients/excon_wrappers.rb +4 -4
  69. data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +3 -3
  70. data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +1 -2
  71. data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +2 -3
  72. data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +2 -3
  73. data/lib/new_relic/agent/http_clients/uri_util.rb +0 -1
  74. data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +2 -3
  75. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +9 -10
  76. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +5 -7
  77. data/lib/new_relic/agent/instrumentation/active_job.rb +4 -3
  78. data/lib/new_relic/agent/instrumentation/active_merchant.rb +2 -2
  79. data/lib/new_relic/agent/instrumentation/active_record.rb +20 -18
  80. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +36 -42
  81. data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +28 -25
  82. data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +3 -3
  83. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +5 -6
  84. data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +8 -9
  85. data/lib/new_relic/agent/instrumentation/bunny/chain.rb +1 -1
  86. data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +7 -8
  87. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +41 -41
  88. data/lib/new_relic/agent/instrumentation/curb/chain.rb +19 -20
  89. data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +34 -38
  90. data/lib/new_relic/agent/instrumentation/curb/prepend.rb +9 -10
  91. data/lib/new_relic/agent/instrumentation/data_mapper.rb +10 -10
  92. data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +5 -7
  93. data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +2 -6
  94. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +4 -4
  95. data/lib/new_relic/agent/instrumentation/excon/middleware.rb +2 -2
  96. data/lib/new_relic/agent/instrumentation/excon.rb +0 -1
  97. data/lib/new_relic/agent/instrumentation/grape/chain.rb +1 -2
  98. data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +6 -7
  99. data/lib/new_relic/agent/instrumentation/grape.rb +2 -3
  100. data/lib/new_relic/agent/instrumentation/httpclient/chain.rb +2 -3
  101. data/lib/new_relic/agent/instrumentation/httpclient/instrumentation.rb +0 -1
  102. data/lib/new_relic/agent/instrumentation/httpclient/prepend.rb +0 -2
  103. data/lib/new_relic/agent/instrumentation/httprb/chain.rb +2 -2
  104. data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +6 -6
  105. data/lib/new_relic/agent/instrumentation/httprb/prepend.rb +1 -1
  106. data/lib/new_relic/agent/instrumentation/ignore_actions.rb +2 -3
  107. data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +0 -1
  108. data/lib/new_relic/agent/instrumentation/logger.rb +1 -1
  109. data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +2 -1
  110. data/lib/new_relic/agent/instrumentation/memcache/helper.rb +0 -1
  111. data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +1 -0
  112. data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +9 -10
  113. data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +4 -5
  114. data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +4 -4
  115. data/lib/new_relic/agent/instrumentation/net_http/chain.rb +3 -4
  116. data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +5 -5
  117. data/lib/new_relic/agent/instrumentation/net_http/prepend.rb +4 -4
  118. data/lib/new_relic/agent/instrumentation/net_http.rb +1 -1
  119. data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +2 -3
  120. data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +3 -2
  121. data/lib/new_relic/agent/instrumentation/padrino/prepend.rb +1 -1
  122. data/lib/new_relic/agent/instrumentation/padrino.rb +0 -5
  123. data/lib/new_relic/agent/instrumentation/queue_time.rb +5 -5
  124. data/lib/new_relic/agent/instrumentation/rack/chain.rb +5 -5
  125. data/lib/new_relic/agent/instrumentation/rack/helpers.rb +0 -1
  126. data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +4 -5
  127. data/lib/new_relic/agent/instrumentation/rack/prepend.rb +0 -1
  128. data/lib/new_relic/agent/instrumentation/rack.rb +1 -1
  129. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +6 -6
  130. data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +2 -2
  131. data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +0 -1
  132. data/lib/new_relic/agent/instrumentation/rake/chain.rb +0 -5
  133. data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +6 -6
  134. data/lib/new_relic/agent/instrumentation/rake.rb +1 -1
  135. data/lib/new_relic/agent/instrumentation/redis/chain.rb +6 -6
  136. data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +2 -2
  137. data/lib/new_relic/agent/instrumentation/redis/prepend.rb +1 -1
  138. data/lib/new_relic/agent/instrumentation/redis.rb +1 -1
  139. data/lib/new_relic/agent/instrumentation/resque/chain.rb +2 -3
  140. data/lib/new_relic/agent/instrumentation/resque/helper.rb +1 -1
  141. data/lib/new_relic/agent/instrumentation/resque/instrumentation.rb +4 -4
  142. data/lib/new_relic/agent/instrumentation/resque/prepend.rb +1 -2
  143. data/lib/new_relic/agent/instrumentation/resque.rb +7 -7
  144. data/lib/new_relic/agent/instrumentation/sequel.rb +7 -9
  145. data/lib/new_relic/agent/instrumentation/sequel_helper.rb +1 -1
  146. data/lib/new_relic/agent/instrumentation/sidekiq.rb +5 -4
  147. data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +0 -1
  148. data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +4 -3
  149. data/lib/new_relic/agent/instrumentation/sunspot.rb +1 -1
  150. data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +0 -1
  151. data/lib/new_relic/agent/instrumentation/typhoeus/chain.rb +4 -4
  152. data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +3 -5
  153. data/lib/new_relic/agent/instrumentation/typhoeus/prepend.rb +1 -1
  154. data/lib/new_relic/agent/internal_agent_error.rb +1 -1
  155. data/lib/new_relic/agent/javascript_instrumentor.rb +28 -28
  156. data/lib/new_relic/agent/logging.rb +8 -4
  157. data/lib/new_relic/agent/memory_logger.rb +1 -1
  158. data/lib/new_relic/agent/messaging.rb +42 -43
  159. data/lib/new_relic/agent/method_tracer.rb +9 -12
  160. data/lib/new_relic/agent/method_tracer_helpers.rb +2 -2
  161. data/lib/new_relic/agent/monitors/cross_app_monitor.rb +13 -12
  162. data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +2 -2
  163. data/lib/new_relic/agent/monitors/inbound_request_monitor.rb +0 -1
  164. data/lib/new_relic/agent/monitors/synthetics_monitor.rb +4 -7
  165. data/lib/new_relic/agent/monitors.rb +1 -2
  166. data/lib/new_relic/agent/new_relic_service/encoders.rb +4 -4
  167. data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +1 -1
  168. data/lib/new_relic/agent/new_relic_service/marshaller.rb +1 -1
  169. data/lib/new_relic/agent/new_relic_service/security_policy_settings.rb +4 -3
  170. data/lib/new_relic/agent/new_relic_service.rb +20 -20
  171. data/lib/new_relic/agent/noticible_error.rb +0 -2
  172. data/lib/new_relic/agent/null_logger.rb +6 -2
  173. data/lib/new_relic/agent/obfuscator.rb +6 -8
  174. data/lib/new_relic/agent/parameter_filtering.rb +3 -5
  175. data/lib/new_relic/agent/payload_metric_mapping.rb +8 -9
  176. data/lib/new_relic/agent/pipe_channel_manager.rb +5 -6
  177. data/lib/new_relic/agent/pipe_service.rb +1 -1
  178. data/lib/new_relic/agent/priority_sampled_buffer.rb +4 -7
  179. data/lib/new_relic/agent/rules_engine/replacement_rule.rb +9 -9
  180. data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +12 -12
  181. data/lib/new_relic/agent/rules_engine.rb +2 -2
  182. data/lib/new_relic/agent/sampler.rb +2 -3
  183. data/lib/new_relic/agent/sampler_collection.rb +2 -3
  184. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +3 -3
  185. data/lib/new_relic/agent/samplers/memory_sampler.rb +4 -3
  186. data/lib/new_relic/agent/samplers/vm_sampler.rb +18 -18
  187. data/lib/new_relic/agent/span_event_aggregator.rb +8 -8
  188. data/lib/new_relic/agent/span_event_primitive.rb +39 -39
  189. data/lib/new_relic/agent/sql_sampler.rb +9 -9
  190. data/lib/new_relic/agent/stats.rb +16 -16
  191. data/lib/new_relic/agent/stats_engine/gc_profiler.rb +7 -9
  192. data/lib/new_relic/agent/stats_engine/stats_hash.rb +8 -9
  193. data/lib/new_relic/agent/stats_engine.rb +6 -6
  194. data/lib/new_relic/agent/synthetics_event_aggregator.rb +0 -1
  195. data/lib/new_relic/agent/system_info.rb +22 -20
  196. data/lib/new_relic/agent/threading/agent_thread.rb +4 -5
  197. data/lib/new_relic/agent/threading/backtrace_node.rb +6 -9
  198. data/lib/new_relic/agent/threading/backtrace_service.rb +8 -8
  199. data/lib/new_relic/agent/threading/thread_profile.rb +15 -18
  200. data/lib/new_relic/agent/tracer.rb +37 -43
  201. data/lib/new_relic/agent/transaction/abstract_segment.rb +6 -6
  202. data/lib/new_relic/agent/transaction/datastore_segment.rb +5 -7
  203. data/lib/new_relic/agent/transaction/distributed_tracer.rb +7 -9
  204. data/lib/new_relic/agent/transaction/distributed_tracing.rb +21 -22
  205. data/lib/new_relic/agent/transaction/external_request_segment.rb +3 -5
  206. data/lib/new_relic/agent/transaction/message_broker_segment.rb +23 -23
  207. data/lib/new_relic/agent/transaction/request_attributes.rb +7 -7
  208. data/lib/new_relic/agent/transaction/segment.rb +3 -3
  209. data/lib/new_relic/agent/transaction/slowest_sample_buffer.rb +0 -2
  210. data/lib/new_relic/agent/transaction/trace.rb +8 -8
  211. data/lib/new_relic/agent/transaction/trace_context.rb +13 -15
  212. data/lib/new_relic/agent/transaction/trace_node.rb +16 -16
  213. data/lib/new_relic/agent/transaction/tracing.rb +1 -3
  214. data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -2
  215. data/lib/new_relic/agent/transaction.rb +79 -81
  216. data/lib/new_relic/agent/transaction_error_primitive.rb +16 -16
  217. data/lib/new_relic/agent/transaction_event_aggregator.rb +5 -6
  218. data/lib/new_relic/agent/transaction_event_primitive.rb +29 -29
  219. data/lib/new_relic/agent/transaction_metrics.rb +3 -3
  220. data/lib/new_relic/agent/transaction_sampler.rb +0 -1
  221. data/lib/new_relic/agent/transaction_time_aggregator.rb +6 -6
  222. data/lib/new_relic/agent/utilization/azure.rb +1 -1
  223. data/lib/new_relic/agent/utilization_data.rb +3 -4
  224. data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +1 -1
  225. data/lib/new_relic/agent/vm/snapshot.rb +3 -3
  226. data/lib/new_relic/agent/worker_loop.rb +3 -5
  227. data/lib/new_relic/agent.rb +22 -22
  228. data/lib/new_relic/cli/command.rb +15 -17
  229. data/lib/new_relic/cli/commands/deployments.rb +20 -22
  230. data/lib/new_relic/cli/commands/install.rb +6 -10
  231. data/lib/new_relic/coerce.rb +5 -8
  232. data/lib/new_relic/collection_helper.rb +48 -47
  233. data/lib/new_relic/control/class_methods.rb +2 -2
  234. data/lib/new_relic/control/frameworks/external.rb +1 -1
  235. data/lib/new_relic/control/frameworks/rails.rb +5 -6
  236. data/lib/new_relic/control/frameworks/rails3.rb +2 -3
  237. data/lib/new_relic/control/frameworks/ruby.rb +2 -2
  238. data/lib/new_relic/control/instance_methods.rb +4 -5
  239. data/lib/new_relic/control/instrumentation.rb +4 -5
  240. data/lib/new_relic/control/server_methods.rb +2 -3
  241. data/lib/new_relic/control.rb +0 -1
  242. data/lib/new_relic/dependency_detection.rb +6 -8
  243. data/lib/new_relic/environment_report.rb +16 -18
  244. data/lib/new_relic/helper.rb +5 -5
  245. data/lib/new_relic/language_support.rb +1 -1
  246. data/lib/new_relic/latest_changes.rb +2 -2
  247. data/lib/new_relic/local_environment.rb +7 -7
  248. data/lib/new_relic/metric_data.rb +6 -7
  249. data/lib/new_relic/metric_spec.rb +3 -3
  250. data/lib/new_relic/noticed_error.rb +14 -15
  251. data/lib/new_relic/rack/agent_middleware.rb +2 -2
  252. data/lib/new_relic/rack/browser_monitoring.rb +9 -9
  253. data/lib/new_relic/recipes/capistrano3.rb +11 -13
  254. data/lib/new_relic/recipes/capistrano_legacy.rb +11 -14
  255. data/lib/new_relic/supportability_helper.rb +1 -2
  256. data/lib/new_relic/version.rb +3 -4
  257. data/lib/sequel/extensions/newrelic_instrumentation.rb +4 -7
  258. data/lib/sequel/plugins/newrelic_instrumentation.rb +3 -9
  259. data/lib/tasks/all.rb +1 -1
  260. data/lib/tasks/config.rake +21 -21
  261. data/lib/tasks/multiverse.rb +4 -6
  262. data/lib/tasks/tests.rake +3 -7
  263. data/newrelic_rpm.gemspec +13 -12
  264. data/recipes/newrelic.rb +1 -1
  265. data/test/agent_helper.rb +55 -55
  266. metadata +33 -4
@@ -15,12 +15,12 @@ module NewRelic
15
15
  def initialize(capacity)
16
16
  super
17
17
  @captured_lifetime = 0
18
- @seen_lifetime = 0
18
+ @seen_lifetime = 0
19
19
  end
20
20
 
21
21
  def heapify_items_array
22
22
  if @items.is_a?(Array)
23
- @items = Heap.new(@items) { |x| priority_for(x) }
23
+ @items = Heap.new(@items) { |x| priority_for(x) }
24
24
  end
25
25
  end
26
26
 
@@ -38,8 +38,6 @@ module NewRelic
38
38
  @items[0] = incoming
39
39
  @items.fix(0)
40
40
  incoming
41
- else
42
- nil
43
41
  end
44
42
  else
45
43
  @items << (event || blk.call)
@@ -53,10 +51,10 @@ module NewRelic
53
51
  def capacity=(new_capacity)
54
52
  @capacity = new_capacity
55
53
  old_items = @items.to_a
56
- old_seen = @seen
54
+ old_seen = @seen
57
55
  reset!
58
56
  old_items.each { |i| append(event: i) }
59
- @seen = old_seen
57
+ @seen = old_seen
60
58
  end
61
59
 
62
60
  def to_a
@@ -92,4 +90,3 @@ module NewRelic
92
90
  end
93
91
  end
94
92
  end
95
-
@@ -7,7 +7,7 @@ module NewRelic
7
7
  class RulesEngine
8
8
  class ReplacementRule
9
9
  attr_reader(:terminate_chain, :each_segment, :ignore, :replace_all, :eval_order,
10
- :match_expression, :replacement)
10
+ :match_expression, :replacement)
11
11
 
12
12
  def initialize(options)
13
13
  if !options['match_expression']
@@ -18,12 +18,12 @@ module NewRelic
18
18
  end
19
19
 
20
20
  @match_expression = Regexp.new(options['match_expression'], Regexp::IGNORECASE)
21
- @replacement = options['replacement']
22
- @ignore = options['ignore'] || false
23
- @eval_order = options['eval_order'] || 0
24
- @replace_all = options['replace_all'] || false
25
- @each_segment = options['each_segment'] || false
26
- @terminate_chain = options['terminate_chain'] || false
21
+ @replacement = options['replacement']
22
+ @ignore = options['ignore'] || false
23
+ @eval_order = options['eval_order'] || 0
24
+ @replace_all = options['replace_all'] || false
25
+ @each_segment = options['each_segment'] || false
26
+ @terminate_chain = options['terminate_chain'] || false
27
27
  end
28
28
 
29
29
  def terminal?
@@ -56,9 +56,9 @@ module NewRelic
56
56
  end
57
57
 
58
58
  def apply_to_each_segment(string)
59
- string = string.dup
59
+ string = string.dup
60
60
  leading_slash = string.slice!(LEADING_SLASH_REGEX)
61
- segments = string.split(SEGMENT_SEPARATOR)
61
+ segments = string.split(SEGMENT_SEPARATOR)
62
62
 
63
63
  segments.map! do |segment|
64
64
  apply_replacement(segment)
@@ -6,19 +6,19 @@ module NewRelic
6
6
  module Agent
7
7
  class RulesEngine
8
8
  class SegmentTermsRule
9
- PREFIX_KEY = 'prefix'.freeze
10
- TERMS_KEY = 'terms'.freeze
11
- SEGMENT_PLACEHOLDER = '*'.freeze
12
- ADJACENT_PLACEHOLDERS_REGEX = %r{((?:^|/)\*)(?:/\*)*}.freeze
9
+ PREFIX_KEY = 'prefix'.freeze
10
+ TERMS_KEY = 'terms'.freeze
11
+ SEGMENT_PLACEHOLDER = '*'.freeze
12
+ ADJACENT_PLACEHOLDERS_REGEX = %r{((?:^|/)\*)(?:/\*)*}.freeze
13
13
  ADJACENT_PLACEHOLDERS_REPLACEMENT = '\1'.freeze
14
- VALID_PREFIX_SEGMENT_COUNT = 2
14
+ VALID_PREFIX_SEGMENT_COUNT = 2
15
15
 
16
16
  attr_reader :prefix, :terms
17
17
 
18
18
  def self.valid?(rule_spec)
19
19
  rule_spec[PREFIX_KEY].kind_of?(String) &&
20
- rule_spec[TERMS_KEY].kind_of?(Array) &&
21
- valid_prefix_segment_count?(rule_spec[PREFIX_KEY])
20
+ rule_spec[TERMS_KEY].kind_of?(Array) &&
21
+ valid_prefix_segment_count?(rule_spec[PREFIX_KEY])
22
22
  end
23
23
 
24
24
  def self.valid_prefix_segment_count?(prefix)
@@ -26,13 +26,13 @@ module NewRelic
26
26
  rindex = prefix.rindex(SEGMENT_SEPARATOR)
27
27
 
28
28
  (count == 2 && prefix[rindex + 1].nil?) ||
29
- (count == 1 && !prefix[rindex + 1].nil?)
29
+ (count == 1 && !prefix[rindex + 1].nil?)
30
30
  end
31
31
 
32
32
  def initialize(options)
33
- @prefix = options[PREFIX_KEY]
34
- @terms = options[TERMS_KEY]
35
- @trim_range = (@prefix.size..-1)
33
+ @prefix = options[PREFIX_KEY]
34
+ @terms = options[TERMS_KEY]
35
+ @trim_range = (@prefix.size..-1)
36
36
  end
37
37
 
38
38
  def terminal?
@@ -50,7 +50,7 @@ module NewRelic
50
50
  end
51
51
 
52
52
  def apply(string)
53
- rest = string[@trim_range]
53
+ rest = string[@trim_range]
54
54
  leading_slash = rest.slice!(LEADING_SLASH_REGEX)
55
55
  segments = rest.split(SEGMENT_SEPARATOR, -1)
56
56
  segments.map! { |s| @terms.include?(s) ? s : SEGMENT_PLACEHOLDER }
@@ -24,7 +24,7 @@ module NewRelic
24
24
  end
25
25
 
26
26
  def self.create_transaction_rules(connect_response)
27
- txn_name_specs = connect_response['transaction_name_rules'] || []
27
+ txn_name_specs = connect_response['transaction_name_rules'] || []
28
28
  segment_rule_specs = connect_response['transaction_segment_terms'] || []
29
29
 
30
30
  txn_name_rules = txn_name_specs.map { |s| ReplacementRule.new(s) }
@@ -54,7 +54,7 @@ module NewRelic
54
54
  rules.uniq! { |rule| rule.prefix }
55
55
  end
56
56
 
57
- def initialize(rules=[], segment_term_rules=[])
57
+ def initialize(rules = [], segment_term_rules = [])
58
58
  @rules = rules.sort
59
59
  @segment_term_rules = segment_term_rules
60
60
  end
@@ -12,9 +12,8 @@
12
12
  module NewRelic
13
13
  module Agent
14
14
  class Sampler
15
-
16
15
  # Exception denotes a sampler is not available and it will not be registered.
17
- class Unsupported < StandardError; end
16
+ class Unsupported < StandardError; end
18
17
 
19
18
  attr_reader :id
20
19
  @sampler_classes = []
@@ -52,7 +51,7 @@ module NewRelic
52
51
  # The ID passed in here is unused by our code, but is preserved in case
53
52
  # we have clients who are defining their own subclasses of this class, and
54
53
  # expecting to be able to call super with an ID.
55
- def initialize(id=nil)
54
+ def initialize(id = nil)
56
55
  @id = id || self.class.shorthand_name
57
56
  end
58
57
 
@@ -17,7 +17,7 @@ module NewRelic
17
17
  @samplers.each(&blk)
18
18
  end
19
19
 
20
- def clear()
20
+ def clear
21
21
  @samplers.clear
22
22
  end
23
23
 
@@ -34,7 +34,6 @@ module NewRelic
34
34
  end
35
35
  end
36
36
 
37
-
38
37
  def poll_samplers
39
38
  @samplers.delete_if do |sampler|
40
39
  begin
@@ -49,7 +48,7 @@ module NewRelic
49
48
 
50
49
  def add_sampler(sampler_class)
51
50
  supported = sampler_class.supported_on_this_platform?
52
- enabled = sampler_class.enabled?
51
+ enabled = sampler_class.enabled?
53
52
  if supported && enabled
54
53
  if !sampler_class_registered?(sampler_class)
55
54
  sampler = sampler_class.new
@@ -102,9 +102,9 @@ module NewRelic
102
102
  ::Delayed::Job.count(:group => column_name,
103
103
  :conditions => [QUEUE_QUERY_CONDITION, now])
104
104
  else
105
- ::Delayed::Job.where(QUEUE_QUERY_CONDITION, now).
106
- group(column_name).
107
- count
105
+ ::Delayed::Job.where(QUEUE_QUERY_CONDITION, now)
106
+ .group(column_name)
107
+ .count
108
108
  end
109
109
  result.to_a
110
110
  end
@@ -7,7 +7,6 @@ require 'new_relic/agent/sampler'
7
7
  module NewRelic
8
8
  module Agent
9
9
  module Samplers
10
-
11
10
  class MemorySampler < NewRelic::Agent::Sampler
12
11
  named :memory
13
12
 
@@ -47,11 +46,12 @@ module NewRelic
47
46
 
48
47
  def self.platform
49
48
  if RUBY_PLATFORM =~ /java/
50
- %x[uname -s].downcase
49
+ %x(uname -s).downcase
51
50
  else
52
51
  RUBY_PLATFORM.downcase
53
52
  end
54
53
  end
54
+
55
55
  def platform
56
56
  NewRelic::Agent::Samplers::MemorySampler.platform
57
57
  end
@@ -118,6 +118,7 @@ module NewRelic
118
118
  raise "Faulty command: `#{@command} #{process}`" if memory.nil? || memory <= 0
119
119
  memory
120
120
  end
121
+
121
122
  def to_s
122
123
  "shell command sampler: #{@command}"
123
124
  end
@@ -130,7 +131,7 @@ module NewRelic
130
131
  class ProcStatus < Base
131
132
  # Returns the amount of resident memory this process is using in MB
132
133
  def get_memory
133
- proc_status = File.open(proc_status_file, "r") {|f| f.read_nonblock(4096).strip }
134
+ proc_status = File.open(proc_status_file, "r") { |f| f.read_nonblock(4096).strip }
134
135
  if proc_status =~ /RSS:\s*(\d+) kB/i
135
136
  return $1.to_f / 1024.0
136
137
  end
@@ -9,14 +9,14 @@ module NewRelic
9
9
  module Agent
10
10
  module Samplers
11
11
  class VMSampler < Sampler
12
- GC_RUNS_METRIC = 'RubyVM/GC/runs'.freeze
13
- HEAP_LIVE_METRIC = 'RubyVM/GC/heap_live'.freeze
14
- HEAP_FREE_METRIC = 'RubyVM/GC/heap_free'.freeze
15
- THREAD_COUNT_METRIC = 'RubyVM/Threads/all'.freeze
16
- OBJECT_ALLOCATIONS_METRIC = 'RubyVM/GC/total_allocated_object'.freeze
17
- MAJOR_GC_METRIC = 'RubyVM/GC/major_gc_count'.freeze
18
- MINOR_GC_METRIC = 'RubyVM/GC/minor_gc_count'.freeze
19
- METHOD_INVALIDATIONS_METRIC = 'RubyVM/CacheInvalidations/method'.freeze
12
+ GC_RUNS_METRIC = 'RubyVM/GC/runs'.freeze
13
+ HEAP_LIVE_METRIC = 'RubyVM/GC/heap_live'.freeze
14
+ HEAP_FREE_METRIC = 'RubyVM/GC/heap_free'.freeze
15
+ THREAD_COUNT_METRIC = 'RubyVM/Threads/all'.freeze
16
+ OBJECT_ALLOCATIONS_METRIC = 'RubyVM/GC/total_allocated_object'.freeze
17
+ MAJOR_GC_METRIC = 'RubyVM/GC/major_gc_count'.freeze
18
+ MINOR_GC_METRIC = 'RubyVM/GC/minor_gc_count'.freeze
19
+ METHOD_INVALIDATIONS_METRIC = 'RubyVM/CacheInvalidations/method'.freeze
20
20
  CONSTANT_INVALIDATIONS_METRIC = 'RubyVM/CacheInvalidations/constant'.freeze
21
21
 
22
22
  attr_reader :transaction_count
@@ -49,7 +49,7 @@ module NewRelic
49
49
  end
50
50
  end
51
51
 
52
- def record_gc_runs_metric(snapshot, txn_count) #THREAD_LOCAL_ACCESS
52
+ def record_gc_runs_metric(snapshot, txn_count) # THREAD_LOCAL_ACCESS
53
53
  if snapshot.gc_total_time || snapshot.gc_runs
54
54
  if snapshot.gc_total_time
55
55
  gc_time = snapshot.gc_total_time - @last_snapshot.gc_total_time.to_f
@@ -59,30 +59,30 @@ module NewRelic
59
59
  end
60
60
  wall_clock_time = snapshot.taken_at - @last_snapshot.taken_at
61
61
  NewRelic::Agent.agent.stats_engine.tl_record_unscoped_metrics(GC_RUNS_METRIC) do |stats|
62
- stats.call_count += txn_count
63
- stats.total_call_time += gc_runs if gc_runs
62
+ stats.call_count += txn_count
63
+ stats.total_call_time += gc_runs if gc_runs
64
64
  stats.total_exclusive_time += gc_time if gc_time
65
- stats.max_call_time = (gc_time.nil? ? 0 : 1)
66
- stats.sum_of_squares += wall_clock_time
65
+ stats.max_call_time = (gc_time.nil? ? 0 : 1)
66
+ stats.sum_of_squares += wall_clock_time
67
67
  end
68
68
  end
69
69
  end
70
70
 
71
- def record_delta(snapshot, key, metric, txn_count) #THREAD_LOCAL_ACCESS
71
+ def record_delta(snapshot, key, metric, txn_count) # THREAD_LOCAL_ACCESS
72
72
  value = snapshot.send(key)
73
73
  if value
74
74
  delta = value - @last_snapshot.send(key)
75
75
  NewRelic::Agent.agent.stats_engine.tl_record_unscoped_metrics(metric) do |stats|
76
- stats.call_count += txn_count
76
+ stats.call_count += txn_count
77
77
  stats.total_call_time += delta
78
78
  end
79
79
  end
80
80
  end
81
81
 
82
- def record_gauge_metric(metric_name, value) #THREAD_LOCAL_ACCESS
82
+ def record_gauge_metric(metric_name, value) # THREAD_LOCAL_ACCESS
83
83
  NewRelic::Agent.agent.stats_engine.tl_record_unscoped_metrics(metric_name) do |stats|
84
- stats.call_count = value
85
- stats.sum_of_squares = 1
84
+ stats.call_count = value
85
+ stats.sum_of_squares = 1
86
86
  end
87
87
  end
88
88
 
@@ -2,8 +2,8 @@
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
- require 'newrelic_rpm' unless defined?( NewRelic )
6
- require 'new_relic/agent' unless defined?( NewRelic::Agent )
5
+ require 'newrelic_rpm' unless defined?(NewRelic)
6
+ require 'new_relic/agent' unless defined?(NewRelic::Agent)
7
7
  require 'new_relic/agent/event_aggregator'
8
8
  require 'new_relic/agent/priority_sampled_buffer'
9
9
 
@@ -14,10 +14,10 @@ module NewRelic
14
14
  capacity_key :'span_events.max_samples_stored'
15
15
 
16
16
  enabled_keys :'span_events.enabled',
17
- :'distributed_tracing.enabled'
17
+ :'distributed_tracing.enabled'
18
18
 
19
19
  def record(priority: nil, event: nil, &blk)
20
- unless(event || priority && blk)
20
+ unless event || priority && blk
21
21
  raise ArgumentError, "Expected priority and block, or event"
22
22
  end
23
23
 
@@ -31,16 +31,16 @@ module NewRelic
31
31
 
32
32
  SUPPORTABILITY_TOTAL_SEEN = "Supportability/SpanEvent/TotalEventsSeen".freeze
33
33
  SUPPORTABILITY_TOTAL_SENT = "Supportability/SpanEvent/TotalEventsSent".freeze
34
- SUPPORTABILITY_DISCARDED = "Supportability/SpanEvent/Discarded".freeze
34
+ SUPPORTABILITY_DISCARDED = "Supportability/SpanEvent/Discarded".freeze
35
35
 
36
36
  def after_harvest(metadata)
37
- seen = metadata[:seen]
38
- sent = metadata[:captured]
37
+ seen = metadata[:seen]
38
+ sent = metadata[:captured]
39
39
  discarded = seen - sent
40
40
 
41
41
  ::NewRelic::Agent.record_metric(SUPPORTABILITY_TOTAL_SEEN, count: seen)
42
42
  ::NewRelic::Agent.record_metric(SUPPORTABILITY_TOTAL_SENT, count: sent)
43
- ::NewRelic::Agent.record_metric(SUPPORTABILITY_DISCARDED, count: discarded)
43
+ ::NewRelic::Agent.record_metric(SUPPORTABILITY_DISCARDED, count: discarded)
44
44
 
45
45
  super
46
46
  end
@@ -16,39 +16,39 @@ module NewRelic
16
16
  extend self
17
17
 
18
18
  # Strings for static keys of the event structure
19
- ELLIPSIS = '...'
20
- TYPE_KEY = 'type'
21
- TRACE_ID_KEY = 'traceId'
22
- GUID_KEY = 'guid'
23
- PARENT_ID_KEY = 'parentId'
24
- GRANDPARENT_ID_KEY = 'grandparentId'
25
- TRANSACTION_ID_KEY = 'transactionId'
26
- SAMPLED_KEY = 'sampled'
27
- PRIORITY_KEY = 'priority'
28
- TIMESTAMP_KEY = 'timestamp'
29
- DURATION_KEY = 'duration'
30
- NAME_KEY = 'name'
31
- CATEGORY_KEY = 'category'
32
- HTTP_URL_KEY = 'http.url'
33
- HTTP_METHOD_KEY = 'http.method'
19
+ ELLIPSIS = '...'
20
+ TYPE_KEY = 'type'
21
+ TRACE_ID_KEY = 'traceId'
22
+ GUID_KEY = 'guid'
23
+ PARENT_ID_KEY = 'parentId'
24
+ GRANDPARENT_ID_KEY = 'grandparentId'
25
+ TRANSACTION_ID_KEY = 'transactionId'
26
+ SAMPLED_KEY = 'sampled'
27
+ PRIORITY_KEY = 'priority'
28
+ TIMESTAMP_KEY = 'timestamp'
29
+ DURATION_KEY = 'duration'
30
+ NAME_KEY = 'name'
31
+ CATEGORY_KEY = 'category'
32
+ HTTP_URL_KEY = 'http.url'
33
+ HTTP_METHOD_KEY = 'http.method'
34
34
  HTTP_STATUS_CODE_KEY = 'http.statusCode'
35
- COMPONENT_KEY = 'component'
36
- DB_INSTANCE_KEY = 'db.instance'
37
- DB_STATEMENT_KEY = 'db.statement'
38
- PEER_ADDRESS_KEY = 'peer.address'
39
- PEER_HOSTNAME_KEY = 'peer.hostname'
40
- SPAN_KIND_KEY = 'span.kind'
41
- ENTRY_POINT_KEY = 'nr.entryPoint'
42
- TRUSTED_PARENT_KEY = "trustedParentId"
43
- TRACING_VENDORS_KEY = "tracingVendors"
35
+ COMPONENT_KEY = 'component'
36
+ DB_INSTANCE_KEY = 'db.instance'
37
+ DB_STATEMENT_KEY = 'db.statement'
38
+ PEER_ADDRESS_KEY = 'peer.address'
39
+ PEER_HOSTNAME_KEY = 'peer.hostname'
40
+ SPAN_KIND_KEY = 'span.kind'
41
+ ENTRY_POINT_KEY = 'nr.entryPoint'
42
+ TRUSTED_PARENT_KEY = "trustedParentId"
43
+ TRACING_VENDORS_KEY = "tracingVendors"
44
44
  TRANSACTION_NAME_KEY = 'transaction.name'
45
45
 
46
46
  # Strings for static values of the event structure
47
- EVENT_TYPE = 'Span'
48
- GENERIC_CATEGORY = 'generic'
49
- HTTP_CATEGORY = 'http'
47
+ EVENT_TYPE = 'Span'
48
+ GENERIC_CATEGORY = 'generic'
49
+ HTTP_CATEGORY = 'http'
50
50
  DATASTORE_CATEGORY = 'datastore'
51
- CLIENT = 'client'
51
+ CLIENT = 'client'
52
52
 
53
53
  # Builds a Hash of error attributes as well as the Span ID when
54
54
  # an error is present. Otherwise, returns nil when no error present.
@@ -68,11 +68,11 @@ module NewRelic
68
68
  def for_external_request_segment segment
69
69
  intrinsics = intrinsics_for(segment)
70
70
 
71
- intrinsics[COMPONENT_KEY] = segment.library
71
+ intrinsics[COMPONENT_KEY] = segment.library
72
72
  intrinsics[HTTP_METHOD_KEY] = segment.procedure
73
73
  intrinsics[HTTP_STATUS_CODE_KEY] = segment.http_status_code if segment.http_status_code
74
- intrinsics[CATEGORY_KEY] = HTTP_CATEGORY
75
- intrinsics[SPAN_KIND_KEY] = CLIENT
74
+ intrinsics[CATEGORY_KEY] = HTTP_CATEGORY
75
+ intrinsics[SPAN_KIND_KEY] = CLIENT
76
76
 
77
77
  agent_attributes = error_attributes(segment) || {}
78
78
 
@@ -115,14 +115,14 @@ module NewRelic
115
115
 
116
116
  def intrinsics_for segment
117
117
  intrinsics = {
118
- TYPE_KEY => EVENT_TYPE,
119
- TRACE_ID_KEY => segment.transaction.trace_id,
120
- GUID_KEY => segment.guid,
118
+ TYPE_KEY => EVENT_TYPE,
119
+ TRACE_ID_KEY => segment.transaction.trace_id,
120
+ GUID_KEY => segment.guid,
121
121
  TRANSACTION_ID_KEY => segment.transaction.guid,
122
- PRIORITY_KEY => segment.transaction.priority,
123
- TIMESTAMP_KEY => milliseconds_since_epoch(segment),
124
- DURATION_KEY => segment.duration,
125
- NAME_KEY => segment.name
122
+ PRIORITY_KEY => segment.transaction.priority,
123
+ TIMESTAMP_KEY => milliseconds_since_epoch(segment),
124
+ DURATION_KEY => segment.duration,
125
+ NAME_KEY => segment.name
126
126
  }
127
127
 
128
128
  # with infinite-tracing, transactions may or may not be sampled!
@@ -191,7 +191,7 @@ module NewRelic
191
191
  Integer(segment.start_time.to_f * 1000.0)
192
192
  end
193
193
 
194
- def truncate value, max_size=255
194
+ def truncate value, max_size = 255
195
195
  value = value.to_s
196
196
  if value.bytesize > max_size
197
197
  value.byteslice(0, max_size - 2).chop! << ELLIPSIS
@@ -46,7 +46,7 @@ module NewRelic
46
46
  NewRelic::Agent::Database.should_record_sql?(:slow_sql)
47
47
  end
48
48
 
49
- def on_start_transaction(state, uri=nil)
49
+ def on_start_transaction(state, uri = nil)
50
50
  return unless enabled?
51
51
 
52
52
  state.sql_sampler_transaction_data = TransactionSqlData.new
@@ -83,7 +83,7 @@ module NewRelic
83
83
  # this should always be called under the @samples_lock
84
84
  def save_slow_sql(transaction_sql_data)
85
85
  path = transaction_sql_data.path
86
- uri = transaction_sql_data.uri
86
+ uri = transaction_sql_data.uri
87
87
 
88
88
  transaction_sql_data.sql_data.each do |sql_item|
89
89
  normalized_sql = sql_item.normalize
@@ -140,7 +140,7 @@ module NewRelic
140
140
  # @api public
141
141
  # @deprecated Use {Datastores.notice_sql} instead.
142
142
  #
143
- def notice_sql(sql, metric_name, config, duration, state=nil, explainer=nil, binds=nil, name=nil) #THREAD_LOCAL_ACCESS sometimes
143
+ def notice_sql(sql, metric_name, config, duration, state = nil, explainer = nil, binds = nil, name = nil) # THREAD_LOCAL_ACCESS sometimes
144
144
  state ||= Tracer.state
145
145
  data = state.sql_sampler_transaction_data
146
146
  return unless data
@@ -203,7 +203,7 @@ module NewRelic
203
203
  slowest = @sql_traces.values
204
204
  @sql_traces = {}
205
205
  end
206
- slowest.each {|trace| trace.prepare_to_send }
206
+ slowest.each { |trace| trace.prepare_to_send }
207
207
  slowest
208
208
  end
209
209
 
@@ -240,7 +240,7 @@ module NewRelic
240
240
  attr_reader :duration
241
241
  attr_reader :backtrace
242
242
 
243
- def initialize(statement, metric_name, duration, backtrace=nil, params=nil)
243
+ def initialize(statement, metric_name, duration, backtrace = nil, params = nil)
244
244
  @statement = statement
245
245
  @metric_name = metric_name
246
246
  @duration = duration
@@ -342,7 +342,7 @@ module NewRelic
342
342
  include NewRelic::Coerce
343
343
 
344
344
  def to_collector_array(encoder)
345
- [ string(@path),
345
+ [string(@path),
346
346
  string(@url),
347
347
  int(@sql_id),
348
348
  string(@sql),
@@ -351,7 +351,7 @@ module NewRelic
351
351
  Helper.time_to_millis(@total_call_time),
352
352
  Helper.time_to_millis(@min_call_time),
353
353
  Helper.time_to_millis(@max_call_time),
354
- encoder.encode(@params) ]
354
+ encoder.encode(@params)]
355
355
  end
356
356
 
357
357
  private
@@ -359,10 +359,10 @@ module NewRelic
359
359
  # need to hash the same way in every process, to be able to aggregate slow SQL traces
360
360
  def consistent_hash(string)
361
361
  if NewRelic::Agent.config[:'slow_sql.use_longer_sql_id']
362
- Digest::SHA1.hexdigest(string).hex.modulo(2**63-1)
362
+ Digest::SHA1.hexdigest(string).hex.modulo(2**63 - 1)
363
363
  else
364
364
  # from when sql_id needed to fit in an INT(11)
365
- Digest::SHA1.hexdigest(string).hex.modulo(2**31-1)
365
+ Digest::SHA1.hexdigest(string).hex.modulo(2**31 - 1)
366
366
  end
367
367
  end
368
368
  end
@@ -36,9 +36,9 @@ module NewRelic
36
36
  def merge!(other)
37
37
  @min_call_time = other.min_call_time if min_time_less?(other)
38
38
  @max_call_time = other.max_call_time if other.max_call_time > max_call_time
39
- @total_call_time += other.total_call_time
39
+ @total_call_time += other.total_call_time
40
40
  @total_exclusive_time += other.total_exclusive_time
41
- @sum_of_squares += other.sum_of_squares
41
+ @sum_of_squares += other.sum_of_squares
42
42
  @call_count += other.call_count
43
43
  self
44
44
  end
@@ -49,16 +49,16 @@ module NewRelic
49
49
 
50
50
  def to_json(*_)
51
51
  {
52
- 'call_count' => call_count.to_i,
53
- 'min_call_time' => min_call_time.to_f,
54
- 'max_call_time' => max_call_time.to_f,
55
- 'total_call_time' => total_call_time.to_f,
52
+ 'call_count' => call_count.to_i,
53
+ 'min_call_time' => min_call_time.to_f,
54
+ 'max_call_time' => max_call_time.to_f,
55
+ 'total_call_time' => total_call_time.to_f,
56
56
  'total_exclusive_time' => total_exclusive_time.to_f,
57
- 'sum_of_squares' => sum_of_squares.to_f
57
+ 'sum_of_squares' => sum_of_squares.to_f
58
58
  }.to_json(*_)
59
59
  end
60
60
 
61
- def record(value=nil, aux=nil, &blk)
61
+ def record(value = nil, aux = nil, &blk)
62
62
  if blk
63
63
  yield self
64
64
  else
@@ -106,14 +106,14 @@ module NewRelic
106
106
 
107
107
  def ==(other)
108
108
  other.class == self.class &&
109
- (
110
- @min_call_time == other.min_call_time &&
111
- @max_call_time == other.max_call_time &&
112
- @total_call_time == other.total_call_time &&
113
- @total_exclusive_time == other.total_exclusive_time &&
114
- @sum_of_squares == other.sum_of_squares &&
115
- @call_count == other.call_count
116
- )
109
+ (
110
+ @min_call_time == other.min_call_time &&
111
+ @max_call_time == other.max_call_time &&
112
+ @total_call_time == other.total_call_time &&
113
+ @total_exclusive_time == other.total_exclusive_time &&
114
+ @sum_of_squares == other.sum_of_squares &&
115
+ @call_count == other.call_count
116
+ )
117
117
  end
118
118
 
119
119
  # Apdex-related accessors