newrelic_rpm 8.2.0 → 8.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (277) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.rubocop.yml +1938 -0
  4. data/Brewfile +10 -0
  5. data/CHANGELOG.md +80 -2
  6. data/CONTRIBUTING.md +19 -3
  7. data/DOCKER.md +167 -0
  8. data/Dockerfile +10 -0
  9. data/Guardfile +8 -8
  10. data/Rakefile +14 -9
  11. data/bin/mongrel_rpm +8 -9
  12. data/bin/newrelic +1 -1
  13. data/bin/nrdebug +14 -14
  14. data/docker-compose.yml +85 -0
  15. data/init.rb +0 -2
  16. data/lefthook.yml +9 -0
  17. data/lib/new_relic/agent/adaptive_sampler.rb +7 -3
  18. data/lib/new_relic/agent/agent.rb +38 -40
  19. data/lib/new_relic/agent/agent_logger.rb +8 -9
  20. data/lib/new_relic/agent/attribute_filter.rb +31 -31
  21. data/lib/new_relic/agent/attributes.rb +2 -2
  22. data/lib/new_relic/agent/autostart.rb +6 -7
  23. data/lib/new_relic/agent/commands/agent_command.rb +2 -2
  24. data/lib/new_relic/agent/commands/agent_command_router.rb +6 -5
  25. data/lib/new_relic/agent/commands/thread_profiler_session.rb +0 -3
  26. data/lib/new_relic/agent/configuration/default_source.rb +347 -330
  27. data/lib/new_relic/agent/configuration/dotted_hash.rb +3 -3
  28. data/lib/new_relic/agent/configuration/environment_source.rb +3 -4
  29. data/lib/new_relic/agent/configuration/event_harvest_config.rb +11 -6
  30. data/lib/new_relic/agent/configuration/high_security_source.rb +7 -7
  31. data/lib/new_relic/agent/configuration/manager.rb +74 -63
  32. data/lib/new_relic/agent/configuration/mask_defaults.rb +1 -1
  33. data/lib/new_relic/agent/configuration/security_policy_source.rb +73 -73
  34. data/lib/new_relic/agent/configuration/server_source.rb +11 -11
  35. data/lib/new_relic/agent/configuration/yaml_source.rb +9 -9
  36. data/lib/new_relic/agent/connect/request_builder.rb +13 -16
  37. data/lib/new_relic/agent/connect/response_handler.rb +0 -3
  38. data/lib/new_relic/agent/custom_event_aggregator.rb +9 -10
  39. data/lib/new_relic/agent/database/explain_plan_helpers.rb +3 -4
  40. data/lib/new_relic/agent/database/obfuscation_helpers.rb +12 -12
  41. data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +2 -2
  42. data/lib/new_relic/agent/database.rb +20 -24
  43. data/lib/new_relic/agent/datastores/metric_helper.rb +10 -10
  44. data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +2 -3
  45. data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +3 -5
  46. data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +1 -2
  47. data/lib/new_relic/agent/datastores/redis.rb +2 -4
  48. data/lib/new_relic/agent/datastores.rb +1 -3
  49. data/lib/new_relic/agent/distributed_tracing/cross_app_payload.rb +5 -5
  50. data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +11 -10
  51. data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +10 -11
  52. data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +41 -42
  53. data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +3 -3
  54. data/lib/new_relic/agent/distributed_tracing/trace_context.rb +41 -43
  55. data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +23 -23
  56. data/lib/new_relic/agent/distributed_tracing.rb +17 -18
  57. data/lib/new_relic/agent/encoding_normalizer.rb +1 -1
  58. data/lib/new_relic/agent/error_collector.rb +17 -17
  59. data/lib/new_relic/agent/error_event_aggregator.rb +1 -1
  60. data/lib/new_relic/agent/error_filter.rb +6 -8
  61. data/lib/new_relic/agent/error_trace_aggregator.rb +1 -1
  62. data/lib/new_relic/agent/event_aggregator.rb +1 -1
  63. data/lib/new_relic/agent/event_buffer.rb +6 -7
  64. data/lib/new_relic/agent/event_listener.rb +0 -1
  65. data/lib/new_relic/agent/event_loop.rb +10 -10
  66. data/lib/new_relic/agent/external.rb +1 -2
  67. data/lib/new_relic/agent/guid_generator.rb +2 -9
  68. data/lib/new_relic/agent/harvester.rb +3 -4
  69. data/lib/new_relic/agent/heap.rb +1 -3
  70. data/lib/new_relic/agent/hostname.rb +3 -3
  71. data/lib/new_relic/agent/http_clients/abstract.rb +5 -7
  72. data/lib/new_relic/agent/http_clients/curb_wrappers.rb +1 -5
  73. data/lib/new_relic/agent/http_clients/excon_wrappers.rb +4 -4
  74. data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +3 -3
  75. data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +1 -2
  76. data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +2 -3
  77. data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +2 -3
  78. data/lib/new_relic/agent/http_clients/uri_util.rb +0 -1
  79. data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +2 -3
  80. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +9 -10
  81. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +5 -7
  82. data/lib/new_relic/agent/instrumentation/active_job.rb +4 -4
  83. data/lib/new_relic/agent/instrumentation/active_merchant.rb +2 -2
  84. data/lib/new_relic/agent/instrumentation/active_record.rb +20 -18
  85. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +36 -42
  86. data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +28 -25
  87. data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +3 -3
  88. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +5 -6
  89. data/lib/new_relic/agent/instrumentation/active_storage.rb +1 -1
  90. data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +8 -9
  91. data/lib/new_relic/agent/instrumentation/bunny/chain.rb +1 -1
  92. data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +7 -8
  93. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +41 -41
  94. data/lib/new_relic/agent/instrumentation/curb/chain.rb +19 -20
  95. data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +34 -38
  96. data/lib/new_relic/agent/instrumentation/curb/prepend.rb +9 -10
  97. data/lib/new_relic/agent/instrumentation/data_mapper.rb +10 -10
  98. data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +5 -7
  99. data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +2 -6
  100. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +4 -4
  101. data/lib/new_relic/agent/instrumentation/excon/middleware.rb +2 -2
  102. data/lib/new_relic/agent/instrumentation/excon.rb +0 -1
  103. data/lib/new_relic/agent/instrumentation/grape/chain.rb +1 -2
  104. data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +6 -7
  105. data/lib/new_relic/agent/instrumentation/grape.rb +2 -3
  106. data/lib/new_relic/agent/instrumentation/httpclient/chain.rb +2 -3
  107. data/lib/new_relic/agent/instrumentation/httpclient/instrumentation.rb +0 -1
  108. data/lib/new_relic/agent/instrumentation/httpclient/prepend.rb +0 -2
  109. data/lib/new_relic/agent/instrumentation/httprb/chain.rb +2 -2
  110. data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +6 -6
  111. data/lib/new_relic/agent/instrumentation/httprb/prepend.rb +1 -1
  112. data/lib/new_relic/agent/instrumentation/ignore_actions.rb +2 -3
  113. data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +0 -1
  114. data/lib/new_relic/agent/instrumentation/logger.rb +1 -1
  115. data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +2 -1
  116. data/lib/new_relic/agent/instrumentation/memcache/helper.rb +0 -1
  117. data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +1 -0
  118. data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +9 -10
  119. data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +5 -6
  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/instrumentation.rb +3 -2
  127. data/lib/new_relic/agent/instrumentation/padrino/prepend.rb +1 -1
  128. data/lib/new_relic/agent/instrumentation/padrino.rb +0 -5
  129. data/lib/new_relic/agent/instrumentation/queue_time.rb +5 -5
  130. data/lib/new_relic/agent/instrumentation/rack/chain.rb +5 -5
  131. data/lib/new_relic/agent/instrumentation/rack/helpers.rb +0 -1
  132. data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +4 -5
  133. data/lib/new_relic/agent/instrumentation/rack/prepend.rb +0 -1
  134. data/lib/new_relic/agent/instrumentation/rack.rb +1 -1
  135. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +6 -6
  136. data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +2 -2
  137. data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +0 -1
  138. data/lib/new_relic/agent/instrumentation/rake/chain.rb +0 -5
  139. data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +6 -6
  140. data/lib/new_relic/agent/instrumentation/rake.rb +1 -1
  141. data/lib/new_relic/agent/instrumentation/redis/chain.rb +6 -6
  142. data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +2 -2
  143. data/lib/new_relic/agent/instrumentation/redis/prepend.rb +1 -1
  144. data/lib/new_relic/agent/instrumentation/redis.rb +1 -1
  145. data/lib/new_relic/agent/instrumentation/resque/chain.rb +2 -3
  146. data/lib/new_relic/agent/instrumentation/resque/helper.rb +1 -1
  147. data/lib/new_relic/agent/instrumentation/resque/instrumentation.rb +4 -4
  148. data/lib/new_relic/agent/instrumentation/resque/prepend.rb +1 -2
  149. data/lib/new_relic/agent/instrumentation/resque.rb +7 -7
  150. data/lib/new_relic/agent/instrumentation/sequel.rb +7 -9
  151. data/lib/new_relic/agent/instrumentation/sequel_helper.rb +1 -1
  152. data/lib/new_relic/agent/instrumentation/sidekiq.rb +5 -4
  153. data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +0 -1
  154. data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +4 -3
  155. data/lib/new_relic/agent/instrumentation/sunspot.rb +1 -1
  156. data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +0 -1
  157. data/lib/new_relic/agent/instrumentation/typhoeus/chain.rb +4 -4
  158. data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +3 -5
  159. data/lib/new_relic/agent/instrumentation/typhoeus/prepend.rb +1 -1
  160. data/lib/new_relic/agent/internal_agent_error.rb +1 -1
  161. data/lib/new_relic/agent/javascript_instrumentor.rb +28 -28
  162. data/lib/new_relic/agent/logging.rb +8 -4
  163. data/lib/new_relic/agent/memory_logger.rb +1 -1
  164. data/lib/new_relic/agent/messaging.rb +42 -44
  165. data/lib/new_relic/agent/method_tracer.rb +11 -14
  166. data/lib/new_relic/agent/method_tracer_helpers.rb +2 -2
  167. data/lib/new_relic/agent/monitors/cross_app_monitor.rb +13 -12
  168. data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +2 -2
  169. data/lib/new_relic/agent/monitors/inbound_request_monitor.rb +0 -1
  170. data/lib/new_relic/agent/monitors/synthetics_monitor.rb +4 -7
  171. data/lib/new_relic/agent/monitors.rb +1 -2
  172. data/lib/new_relic/agent/new_relic_service/encoders.rb +4 -4
  173. data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +1 -1
  174. data/lib/new_relic/agent/new_relic_service/marshaller.rb +1 -1
  175. data/lib/new_relic/agent/new_relic_service/security_policy_settings.rb +4 -3
  176. data/lib/new_relic/agent/new_relic_service.rb +20 -20
  177. data/lib/new_relic/agent/noticible_error.rb +0 -2
  178. data/lib/new_relic/agent/null_logger.rb +6 -2
  179. data/lib/new_relic/agent/obfuscator.rb +6 -8
  180. data/lib/new_relic/agent/parameter_filtering.rb +16 -8
  181. data/lib/new_relic/agent/payload_metric_mapping.rb +8 -9
  182. data/lib/new_relic/agent/pipe_channel_manager.rb +5 -6
  183. data/lib/new_relic/agent/pipe_service.rb +1 -1
  184. data/lib/new_relic/agent/priority_sampled_buffer.rb +4 -7
  185. data/lib/new_relic/agent/rules_engine/replacement_rule.rb +9 -9
  186. data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +12 -12
  187. data/lib/new_relic/agent/rules_engine.rb +2 -2
  188. data/lib/new_relic/agent/sampler.rb +2 -3
  189. data/lib/new_relic/agent/sampler_collection.rb +2 -3
  190. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +3 -3
  191. data/lib/new_relic/agent/samplers/memory_sampler.rb +4 -3
  192. data/lib/new_relic/agent/samplers/vm_sampler.rb +18 -18
  193. data/lib/new_relic/agent/span_event_aggregator.rb +8 -8
  194. data/lib/new_relic/agent/span_event_primitive.rb +39 -39
  195. data/lib/new_relic/agent/sql_sampler.rb +9 -9
  196. data/lib/new_relic/agent/stats.rb +16 -16
  197. data/lib/new_relic/agent/stats_engine/gc_profiler.rb +7 -9
  198. data/lib/new_relic/agent/stats_engine/stats_hash.rb +8 -9
  199. data/lib/new_relic/agent/stats_engine.rb +6 -6
  200. data/lib/new_relic/agent/synthetics_event_aggregator.rb +1 -2
  201. data/lib/new_relic/agent/system_info.rb +22 -20
  202. data/lib/new_relic/agent/threading/agent_thread.rb +4 -5
  203. data/lib/new_relic/agent/threading/backtrace_node.rb +6 -9
  204. data/lib/new_relic/agent/threading/backtrace_service.rb +8 -8
  205. data/lib/new_relic/agent/threading/thread_profile.rb +15 -18
  206. data/lib/new_relic/agent/tracer.rb +37 -43
  207. data/lib/new_relic/agent/transaction/abstract_segment.rb +6 -6
  208. data/lib/new_relic/agent/transaction/datastore_segment.rb +5 -7
  209. data/lib/new_relic/agent/transaction/distributed_tracer.rb +7 -9
  210. data/lib/new_relic/agent/transaction/distributed_tracing.rb +21 -22
  211. data/lib/new_relic/agent/transaction/external_request_segment.rb +3 -5
  212. data/lib/new_relic/agent/transaction/message_broker_segment.rb +23 -23
  213. data/lib/new_relic/agent/transaction/request_attributes.rb +7 -7
  214. data/lib/new_relic/agent/transaction/segment.rb +3 -3
  215. data/lib/new_relic/agent/transaction/slowest_sample_buffer.rb +0 -2
  216. data/lib/new_relic/agent/transaction/trace.rb +8 -8
  217. data/lib/new_relic/agent/transaction/trace_context.rb +14 -16
  218. data/lib/new_relic/agent/transaction/trace_node.rb +16 -16
  219. data/lib/new_relic/agent/transaction/tracing.rb +1 -3
  220. data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -2
  221. data/lib/new_relic/agent/transaction.rb +79 -81
  222. data/lib/new_relic/agent/transaction_error_primitive.rb +16 -16
  223. data/lib/new_relic/agent/transaction_event_aggregator.rb +7 -8
  224. data/lib/new_relic/agent/transaction_event_primitive.rb +29 -29
  225. data/lib/new_relic/agent/transaction_event_recorder.rb +1 -1
  226. data/lib/new_relic/agent/transaction_metrics.rb +3 -3
  227. data/lib/new_relic/agent/transaction_sampler.rb +0 -1
  228. data/lib/new_relic/agent/transaction_time_aggregator.rb +6 -6
  229. data/lib/new_relic/agent/utilization/aws.rb +32 -2
  230. data/lib/new_relic/agent/utilization/azure.rb +1 -1
  231. data/lib/new_relic/agent/utilization/vendor.rb +15 -2
  232. data/lib/new_relic/agent/utilization_data.rb +3 -4
  233. data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +1 -1
  234. data/lib/new_relic/agent/vm/snapshot.rb +3 -3
  235. data/lib/new_relic/agent/worker_loop.rb +3 -5
  236. data/lib/new_relic/agent.rb +22 -22
  237. data/lib/new_relic/cli/command.rb +15 -17
  238. data/lib/new_relic/cli/commands/deployments.rb +20 -22
  239. data/lib/new_relic/cli/commands/install.rb +6 -10
  240. data/lib/new_relic/coerce.rb +5 -8
  241. data/lib/new_relic/collection_helper.rb +48 -47
  242. data/lib/new_relic/control/class_methods.rb +2 -2
  243. data/lib/new_relic/control/frameworks/external.rb +1 -1
  244. data/lib/new_relic/control/frameworks/rails.rb +5 -6
  245. data/lib/new_relic/control/frameworks/rails3.rb +2 -3
  246. data/lib/new_relic/control/frameworks/ruby.rb +2 -2
  247. data/lib/new_relic/control/frameworks/sinatra.rb +6 -0
  248. data/lib/new_relic/control/instance_methods.rb +4 -5
  249. data/lib/new_relic/control/instrumentation.rb +4 -5
  250. data/lib/new_relic/control/server_methods.rb +2 -3
  251. data/lib/new_relic/control.rb +0 -1
  252. data/lib/new_relic/dependency_detection.rb +6 -8
  253. data/lib/new_relic/environment_report.rb +16 -18
  254. data/lib/new_relic/helper.rb +5 -5
  255. data/lib/new_relic/language_support.rb +3 -2
  256. data/lib/new_relic/latest_changes.rb +2 -2
  257. data/lib/new_relic/local_environment.rb +7 -7
  258. data/lib/new_relic/metric_data.rb +6 -7
  259. data/lib/new_relic/metric_spec.rb +3 -3
  260. data/lib/new_relic/noticed_error.rb +14 -15
  261. data/lib/new_relic/rack/agent_middleware.rb +2 -2
  262. data/lib/new_relic/rack/browser_monitoring.rb +9 -9
  263. data/lib/new_relic/recipes/capistrano3.rb +11 -13
  264. data/lib/new_relic/recipes/capistrano_legacy.rb +11 -14
  265. data/lib/new_relic/supportability_helper.rb +1 -2
  266. data/lib/new_relic/version.rb +4 -15
  267. data/lib/sequel/extensions/newrelic_instrumentation.rb +4 -7
  268. data/lib/sequel/plugins/newrelic_instrumentation.rb +3 -9
  269. data/lib/tasks/all.rb +1 -1
  270. data/lib/tasks/config.rake +21 -21
  271. data/lib/tasks/multiverse.rb +4 -6
  272. data/lib/tasks/tests.rake +3 -7
  273. data/newrelic.yml +3 -3
  274. data/newrelic_rpm.gemspec +13 -12
  275. data/recipes/newrelic.rb +1 -1
  276. data/test/agent_helper.rb +55 -55
  277. metadata +38 -4
@@ -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
@@ -22,7 +22,7 @@ module NewRelic
22
22
  end
23
23
 
24
24
  def self.reset
25
- @profiler = nil
25
+ @profiler = nil
26
26
  @initialized = nil
27
27
  end
28
28
 
@@ -30,15 +30,13 @@ module NewRelic
30
30
  init
31
31
  if @profiler
32
32
  GCSnapshot.new(@profiler.call_time_s, @profiler.call_count)
33
- else
34
- nil
35
33
  end
36
34
  end
37
35
 
38
36
  def self.record_delta(start_snapshot, end_snapshot)
39
37
  if @profiler && start_snapshot && end_snapshot
40
38
  elapsed_gc_time_s = end_snapshot.gc_time_s - start_snapshot.gc_time_s
41
- num_calls = end_snapshot.gc_call_count - start_snapshot.gc_call_count
39
+ num_calls = end_snapshot.gc_call_count - start_snapshot.gc_call_count
42
40
  record_gc_metric(num_calls, elapsed_gc_time_s)
43
41
 
44
42
  @profiler.reset
@@ -46,17 +44,17 @@ module NewRelic
46
44
  end
47
45
  end
48
46
 
49
- def self.record_gc_metric(call_count, elapsed) #THREAD_LOCAL_ACCESS
47
+ def self.record_gc_metric(call_count, elapsed) # THREAD_LOCAL_ACCESS
50
48
  NewRelic::Agent.agent.stats_engine.tl_record_scoped_and_unscoped_metrics(gc_metric_name, GC_ROLLUP) do |stats|
51
- stats.call_count += call_count
52
- stats.total_call_time += elapsed
49
+ stats.call_count += call_count
50
+ stats.total_call_time += elapsed
53
51
  stats.total_exclusive_time += elapsed
54
52
  end
55
53
  end
56
54
 
57
55
  GC_ROLLUP = 'GC/Transaction/all'.freeze
58
- GC_OTHER = 'GC/Transaction/allOther'.freeze
59
- GC_WEB = 'GC/Transaction/allWeb'.freeze
56
+ GC_OTHER = 'GC/Transaction/allOther'.freeze
57
+ GC_WEB = 'GC/Transaction/allWeb'.freeze
60
58
 
61
59
  def self.gc_metric_name
62
60
  if NewRelic::Agent::Transaction.recording_web_transaction?
@@ -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)
@@ -13,7 +13,7 @@ module NewRelic
13
13
 
14
14
  named :SyntheticsEventAggregator
15
15
  capacity_key :'synthetics.events_limit'
16
- enabled_key :'analytics_events.enabled'
16
+ enabled_key :'transaction_events.enabled'
17
17
  buffer_class TimestampSampledBuffer
18
18
 
19
19
  def record event
@@ -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)