mmtrix_rpm 1.0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1036) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +27 -0
  3. data/.project +23 -0
  4. data/.travis.yml +12 -0
  5. data/.yardopts +21 -0
  6. data/CHANGELOG +2342 -0
  7. data/GUIDELINES_FOR_CONTRIBUTING.md +80 -0
  8. data/Gemfile +3 -0
  9. data/Guardfile +8 -0
  10. data/LICENSE +151 -0
  11. data/README.md +202 -0
  12. data/Rakefile +154 -0
  13. data/bin/mmtrix +13 -0
  14. data/bin/mmtrix_cmd +5 -0
  15. data/bin/mongrel_rpm +33 -0
  16. data/bin/nrdebug +279 -0
  17. data/cert/cacert.pem +1177 -0
  18. data/config/database.yml +5 -0
  19. data/config.dot +287 -0
  20. data/init.rb +32 -0
  21. data/install.rb +13 -0
  22. data/lib/conditional_vendored_dependency_detection.rb +7 -0
  23. data/lib/conditional_vendored_metric_parser.rb +9 -0
  24. data/lib/mmtrix/agent/agent.rb +1152 -0
  25. data/lib/mmtrix/agent/agent_logger.rb +184 -0
  26. data/lib/mmtrix/agent/attribute_filter.rb +242 -0
  27. data/lib/mmtrix/agent/attribute_processing.rb +62 -0
  28. data/lib/mmtrix/agent/audit_logger.rb +94 -0
  29. data/lib/mmtrix/agent/autostart.rb +65 -0
  30. data/lib/mmtrix/agent/aws_info.rb +90 -0
  31. data/lib/mmtrix/agent/busy_calculator.rb +117 -0
  32. data/lib/mmtrix/agent/chained_call.rb +17 -0
  33. data/lib/mmtrix/agent/commands/agent_command.rb +19 -0
  34. data/lib/mmtrix/agent/commands/agent_command_router.rb +160 -0
  35. data/lib/mmtrix/agent/commands/thread_profiler_session.rb +110 -0
  36. data/lib/mmtrix/agent/commands/xray_session.rb +55 -0
  37. data/lib/mmtrix/agent/commands/xray_session_collection.rb +161 -0
  38. data/lib/mmtrix/agent/configuration/default_source.rb +1471 -0
  39. data/lib/mmtrix/agent/configuration/dotted_hash.rb +50 -0
  40. data/lib/mmtrix/agent/configuration/environment_source.rb +116 -0
  41. data/lib/mmtrix/agent/configuration/high_security_source.rb +51 -0
  42. data/lib/mmtrix/agent/configuration/manager.rb +395 -0
  43. data/lib/mmtrix/agent/configuration/manual_source.rb +17 -0
  44. data/lib/mmtrix/agent/configuration/mask_defaults.rb +14 -0
  45. data/lib/mmtrix/agent/configuration/server_source.rb +117 -0
  46. data/lib/mmtrix/agent/configuration/yaml_source.rb +155 -0
  47. data/lib/mmtrix/agent/configuration.rb +35 -0
  48. data/lib/mmtrix/agent/cross_app_monitor.rb +178 -0
  49. data/lib/mmtrix/agent/cross_app_tracing.rb +339 -0
  50. data/lib/mmtrix/agent/custom_event_aggregator.rb +100 -0
  51. data/lib/mmtrix/agent/database/obfuscation_helpers.rb +78 -0
  52. data/lib/mmtrix/agent/database/obfuscator.rb +80 -0
  53. data/lib/mmtrix/agent/database/postgres_explain_obfuscator.rb +46 -0
  54. data/lib/mmtrix/agent/database.rb +325 -0
  55. data/lib/mmtrix/agent/datastores/metric_helper.rb +98 -0
  56. data/lib/mmtrix/agent/datastores/mongo/metric_translator.rb +191 -0
  57. data/lib/mmtrix/agent/datastores/mongo/obfuscator.rb +39 -0
  58. data/lib/mmtrix/agent/datastores/mongo/statement_formatter.rb +53 -0
  59. data/lib/mmtrix/agent/datastores/mongo.rb +29 -0
  60. data/lib/mmtrix/agent/datastores.rb +191 -0
  61. data/lib/mmtrix/agent/deprecator.rb +18 -0
  62. data/lib/mmtrix/agent/encoding_normalizer.rb +82 -0
  63. data/lib/mmtrix/agent/error_collector.rb +316 -0
  64. data/lib/mmtrix/agent/event_buffer.rb +84 -0
  65. data/lib/mmtrix/agent/event_listener.rb +47 -0
  66. data/lib/mmtrix/agent/event_loop.rb +193 -0
  67. data/lib/mmtrix/agent/harvester.rb +52 -0
  68. data/lib/mmtrix/agent/hash_extensions.rb +26 -0
  69. data/lib/mmtrix/agent/hostname.rb +30 -0
  70. data/lib/mmtrix/agent/http_clients/curb_wrappers.rb +67 -0
  71. data/lib/mmtrix/agent/http_clients/excon_wrappers.rb +67 -0
  72. data/lib/mmtrix/agent/http_clients/httpclient_wrappers.rb +63 -0
  73. data/lib/mmtrix/agent/http_clients/net_http_wrappers.rb +50 -0
  74. data/lib/mmtrix/agent/http_clients/typhoeus_wrappers.rb +75 -0
  75. data/lib/mmtrix/agent/http_clients/uri_util.rb +51 -0
  76. data/lib/mmtrix/agent/inbound_request_monitor.rb +41 -0
  77. data/lib/mmtrix/agent/instrumentation/action_controller_subscriber.rb +121 -0
  78. data/lib/mmtrix/agent/instrumentation/action_view_subscriber.rb +95 -0
  79. data/lib/mmtrix/agent/instrumentation/active_job.rb +90 -0
  80. data/lib/mmtrix/agent/instrumentation/active_merchant.rb +37 -0
  81. data/lib/mmtrix/agent/instrumentation/active_record.rb +105 -0
  82. data/lib/mmtrix/agent/instrumentation/active_record_4.rb +29 -0
  83. data/lib/mmtrix/agent/instrumentation/active_record_helper.rb +189 -0
  84. data/lib/mmtrix/agent/instrumentation/active_record_subscriber.rb +104 -0
  85. data/lib/mmtrix/agent/instrumentation/acts_as_solr.rb +72 -0
  86. data/lib/mmtrix/agent/instrumentation/authlogic.rb +25 -0
  87. data/lib/mmtrix/agent/instrumentation/controller_instrumentation.rb +458 -0
  88. data/lib/mmtrix/agent/instrumentation/curb.rb +191 -0
  89. data/lib/mmtrix/agent/instrumentation/data_mapper.rb +167 -0
  90. data/lib/mmtrix/agent/instrumentation/delayed_job_instrumentation.rb +56 -0
  91. data/lib/mmtrix/agent/instrumentation/evented_subscriber.rb +100 -0
  92. data/lib/mmtrix/agent/instrumentation/excon/connection.rb +33 -0
  93. data/lib/mmtrix/agent/instrumentation/excon/middleware.rb +57 -0
  94. data/lib/mmtrix/agent/instrumentation/excon.rb +72 -0
  95. data/lib/mmtrix/agent/instrumentation/grape.rb +111 -0
  96. data/lib/mmtrix/agent/instrumentation/httpclient.rb +46 -0
  97. data/lib/mmtrix/agent/instrumentation/ignore_actions.rb +41 -0
  98. data/lib/mmtrix/agent/instrumentation/memcache.rb +143 -0
  99. data/lib/mmtrix/agent/instrumentation/merb/controller.rb +44 -0
  100. data/lib/mmtrix/agent/instrumentation/merb/errors.rb +33 -0
  101. data/lib/mmtrix/agent/instrumentation/metric_frame.rb +39 -0
  102. data/lib/mmtrix/agent/instrumentation/middleware_proxy.rb +109 -0
  103. data/lib/mmtrix/agent/instrumentation/middleware_tracing.rb +87 -0
  104. data/lib/mmtrix/agent/instrumentation/mongo.rb +128 -0
  105. data/lib/mmtrix/agent/instrumentation/net.rb +36 -0
  106. data/lib/mmtrix/agent/instrumentation/padrino.rb +32 -0
  107. data/lib/mmtrix/agent/instrumentation/passenger_instrumentation.rb +27 -0
  108. data/lib/mmtrix/agent/instrumentation/queue_time.rb +78 -0
  109. data/lib/mmtrix/agent/instrumentation/rack.rb +186 -0
  110. data/lib/mmtrix/agent/instrumentation/rails/action_controller.rb +123 -0
  111. data/lib/mmtrix/agent/instrumentation/rails/action_web_service.rb +46 -0
  112. data/lib/mmtrix/agent/instrumentation/rails/errors.rb +51 -0
  113. data/lib/mmtrix/agent/instrumentation/rails3/action_controller.rb +173 -0
  114. data/lib/mmtrix/agent/instrumentation/rails3/errors.rb +47 -0
  115. data/lib/mmtrix/agent/instrumentation/rails4/action_controller.rb +29 -0
  116. data/lib/mmtrix/agent/instrumentation/rails4/action_view.rb +25 -0
  117. data/lib/mmtrix/agent/instrumentation/rails4/errors.rb +46 -0
  118. data/lib/mmtrix/agent/instrumentation/rails_middleware.rb +39 -0
  119. data/lib/mmtrix/agent/instrumentation/rainbows_instrumentation.rb +26 -0
  120. data/lib/mmtrix/agent/instrumentation/resque.rb +96 -0
  121. data/lib/mmtrix/agent/instrumentation/rubyprof.rb +26 -0
  122. data/lib/mmtrix/agent/instrumentation/sequel.rb +51 -0
  123. data/lib/mmtrix/agent/instrumentation/sequel_helper.rb +36 -0
  124. data/lib/mmtrix/agent/instrumentation/sidekiq.rb +72 -0
  125. data/lib/mmtrix/agent/instrumentation/sinatra/ignorer.rb +52 -0
  126. data/lib/mmtrix/agent/instrumentation/sinatra/transaction_namer.rb +56 -0
  127. data/lib/mmtrix/agent/instrumentation/sinatra.rb +188 -0
  128. data/lib/mmtrix/agent/instrumentation/sunspot.rb +33 -0
  129. data/lib/mmtrix/agent/instrumentation/typhoeus.rb +78 -0
  130. data/lib/mmtrix/agent/instrumentation.rb +13 -0
  131. data/lib/mmtrix/agent/internal_agent_error.rb +18 -0
  132. data/lib/mmtrix/agent/javascript_instrumentor.rb +196 -0
  133. data/lib/mmtrix/agent/log_once.rb +39 -0
  134. data/lib/mmtrix/agent/memory_logger.rb +59 -0
  135. data/lib/mmtrix/agent/method_tracer.rb +391 -0
  136. data/lib/mmtrix/agent/method_tracer_helpers.rb +92 -0
  137. data/lib/mmtrix/agent/mmtrix_service/encoders.rb +38 -0
  138. data/lib/mmtrix/agent/mmtrix_service/json_marshaller.rb +75 -0
  139. data/lib/mmtrix/agent/mmtrix_service/marshaller.rb +62 -0
  140. data/lib/mmtrix/agent/mmtrix_service/pruby_marshaller.rb +56 -0
  141. data/lib/mmtrix/agent/mmtrix_service.rb +580 -0
  142. data/lib/mmtrix/agent/null_logger.rb +21 -0
  143. data/lib/mmtrix/agent/obfuscator.rb +49 -0
  144. data/lib/mmtrix/agent/parameter_filtering.rb +44 -0
  145. data/lib/mmtrix/agent/pipe_channel_manager.rb +277 -0
  146. data/lib/mmtrix/agent/pipe_service.rb +84 -0
  147. data/lib/mmtrix/agent/rules_engine/replacement_rule.rb +76 -0
  148. data/lib/mmtrix/agent/rules_engine/segment_terms_rule.rb +48 -0
  149. data/lib/mmtrix/agent/rules_engine.rb +58 -0
  150. data/lib/mmtrix/agent/sampled_buffer.rb +51 -0
  151. data/lib/mmtrix/agent/sampler.rb +64 -0
  152. data/lib/mmtrix/agent/sampler_collection.rb +72 -0
  153. data/lib/mmtrix/agent/samplers/cpu_sampler.rb +76 -0
  154. data/lib/mmtrix/agent/samplers/delayed_job_sampler.rb +111 -0
  155. data/lib/mmtrix/agent/samplers/memory_sampler.rb +149 -0
  156. data/lib/mmtrix/agent/samplers/object_sampler.rb +24 -0
  157. data/lib/mmtrix/agent/samplers/vm_sampler.rb +126 -0
  158. data/lib/mmtrix/agent/sized_buffer.rb +23 -0
  159. data/lib/mmtrix/agent/sql_sampler.rb +322 -0
  160. data/lib/mmtrix/agent/stats.rb +159 -0
  161. data/lib/mmtrix/agent/stats_engine/gc_profiler.rb +109 -0
  162. data/lib/mmtrix/agent/stats_engine/metric_stats.rb +237 -0
  163. data/lib/mmtrix/agent/stats_engine/samplers.rb +22 -0
  164. data/lib/mmtrix/agent/stats_engine/stats_hash.rb +168 -0
  165. data/lib/mmtrix/agent/stats_engine.rb +32 -0
  166. data/lib/mmtrix/agent/supported_versions.rb +259 -0
  167. data/lib/mmtrix/agent/synthetics_event_buffer.rb +42 -0
  168. data/lib/mmtrix/agent/synthetics_monitor.rb +50 -0
  169. data/lib/mmtrix/agent/system_info.rb +251 -0
  170. data/lib/mmtrix/agent/threading/agent_thread.rb +76 -0
  171. data/lib/mmtrix/agent/threading/backtrace_node.rb +135 -0
  172. data/lib/mmtrix/agent/threading/backtrace_service.rb +283 -0
  173. data/lib/mmtrix/agent/threading/thread_profile.rb +149 -0
  174. data/lib/mmtrix/agent/traced_method_stack.rb +99 -0
  175. data/lib/mmtrix/agent/transaction/attributes.rb +163 -0
  176. data/lib/mmtrix/agent/transaction/developer_mode_sample_buffer.rb +62 -0
  177. data/lib/mmtrix/agent/transaction/slowest_sample_buffer.rb +25 -0
  178. data/lib/mmtrix/agent/transaction/synthetics_sample_buffer.rb +25 -0
  179. data/lib/mmtrix/agent/transaction/trace.rb +150 -0
  180. data/lib/mmtrix/agent/transaction/trace_node.rb +190 -0
  181. data/lib/mmtrix/agent/transaction/transaction_sample_buffer.rb +105 -0
  182. data/lib/mmtrix/agent/transaction/xray_sample_buffer.rb +64 -0
  183. data/lib/mmtrix/agent/transaction.rb +940 -0
  184. data/lib/mmtrix/agent/transaction_event_aggregator.rb +265 -0
  185. data/lib/mmtrix/agent/transaction_metrics.rb +57 -0
  186. data/lib/mmtrix/agent/transaction_sample_builder.rb +141 -0
  187. data/lib/mmtrix/agent/transaction_sampler.rb +317 -0
  188. data/lib/mmtrix/agent/transaction_state.rb +153 -0
  189. data/lib/mmtrix/agent/transaction_timings.rb +57 -0
  190. data/lib/mmtrix/agent/utilization_data.rb +64 -0
  191. data/lib/mmtrix/agent/vm/jruby_vm.rb +40 -0
  192. data/lib/mmtrix/agent/vm/monotonic_gc_profiler.rb +45 -0
  193. data/lib/mmtrix/agent/vm/mri_vm.rb +87 -0
  194. data/lib/mmtrix/agent/vm/rubinius_vm.rb +132 -0
  195. data/lib/mmtrix/agent/vm/snapshot.rb +20 -0
  196. data/lib/mmtrix/agent/vm.rb +32 -0
  197. data/lib/mmtrix/agent/worker_loop.rb +98 -0
  198. data/lib/mmtrix/agent.rb +714 -0
  199. data/lib/mmtrix/build.rb +2 -0
  200. data/lib/mmtrix/cli/command.rb +91 -0
  201. data/lib/mmtrix/cli/commands/deployments.rb +134 -0
  202. data/lib/mmtrix/cli/commands/install.rb +84 -0
  203. data/lib/mmtrix/coerce.rb +70 -0
  204. data/lib/mmtrix/collection_helper.rb +79 -0
  205. data/lib/mmtrix/control/class_methods.rb +62 -0
  206. data/lib/mmtrix/control/frameworks/external.rb +20 -0
  207. data/lib/mmtrix/control/frameworks/merb.rb +29 -0
  208. data/lib/mmtrix/control/frameworks/rails.rb +139 -0
  209. data/lib/mmtrix/control/frameworks/rails3.rb +45 -0
  210. data/lib/mmtrix/control/frameworks/rails4.rb +23 -0
  211. data/lib/mmtrix/control/frameworks/ruby.rb +24 -0
  212. data/lib/mmtrix/control/frameworks/sinatra.rb +14 -0
  213. data/lib/mmtrix/control/frameworks.rb +14 -0
  214. data/lib/mmtrix/control/instance_methods.rb +161 -0
  215. data/lib/mmtrix/control/instrumentation.rb +71 -0
  216. data/lib/mmtrix/control/server_methods.rb +32 -0
  217. data/lib/mmtrix/control.rb +43 -0
  218. data/lib/mmtrix/delayed_job_injection.rb +10 -0
  219. data/lib/mmtrix/environment_report.rb +131 -0
  220. data/lib/mmtrix/helper.rb +55 -0
  221. data/lib/mmtrix/json_wrapper.rb +78 -0
  222. data/lib/mmtrix/language_support.rb +144 -0
  223. data/lib/mmtrix/latest_changes.rb +64 -0
  224. data/lib/mmtrix/local_environment.rb +207 -0
  225. data/lib/mmtrix/merbtasks.rb +10 -0
  226. data/lib/mmtrix/metric_data.rb +74 -0
  227. data/lib/mmtrix/metric_spec.rb +81 -0
  228. data/lib/mmtrix/metrics.rb +13 -0
  229. data/lib/mmtrix/noticed_error.rb +164 -0
  230. data/lib/mmtrix/okjson.rb +602 -0
  231. data/lib/mmtrix/rack/agent_hooks.rb +33 -0
  232. data/lib/mmtrix/rack/agent_middleware.rb +40 -0
  233. data/lib/mmtrix/rack/browser_monitoring.rb +150 -0
  234. data/lib/mmtrix/rack/developer_mode/segment_summary.rb +56 -0
  235. data/lib/mmtrix/rack/developer_mode.rb +321 -0
  236. data/lib/mmtrix/rack/error_collector.rb +27 -0
  237. data/lib/mmtrix/rack.rb +17 -0
  238. data/lib/mmtrix/recipes/capistrano3.rb +66 -0
  239. data/lib/mmtrix/recipes/capistrano_legacy.rb +98 -0
  240. data/lib/mmtrix/recipes.rb +24 -0
  241. data/lib/mmtrix/timer_lib.rb +31 -0
  242. data/lib/mmtrix/version.rb +70 -0
  243. data/lib/mmtrix_rpm.rb +54 -0
  244. data/lib/sequel/extensions/mmtrix_instrumentation.rb +79 -0
  245. data/lib/sequel/plugins/mmtrix_instrumentation.rb +65 -0
  246. data/lib/tasks/all.rb +8 -0
  247. data/lib/tasks/config.html.erb +28 -0
  248. data/lib/tasks/config.rake +134 -0
  249. data/lib/tasks/config.text.erb +7 -0
  250. data/lib/tasks/install.rake +11 -0
  251. data/lib/tasks/multiverse.rake +2 -0
  252. data/lib/tasks/multiverse.rb +50 -0
  253. data/lib/tasks/tests.rake +36 -0
  254. data/lib/tasks/versions.html.erb +27 -0
  255. data/lib/tasks/versions.rake +53 -0
  256. data/lib/tasks/versions.txt.erb +14 -0
  257. data/mmtrix.yml +47 -0
  258. data/mmtrix_rpm.gemspec +73 -0
  259. data/recipes/mmtrix.rb +10 -0
  260. data/test/agent_helper.rb +666 -0
  261. data/test/config/mmtrix.yml +46 -0
  262. data/test/config/test.cert.crt +18 -0
  263. data/test/config/test.cert.key +15 -0
  264. data/test/config/test_control.rb +54 -0
  265. data/test/environments/.gitignore +16 -0
  266. data/test/environments/lib/environments/runner.rb +113 -0
  267. data/test/environments/norails/Gemfile +21 -0
  268. data/test/environments/norails/Rakefile +9 -0
  269. data/test/environments/rails21/Gemfile +25 -0
  270. data/test/environments/rails21/Rakefile +16 -0
  271. data/test/environments/rails21/app/controllers/application.rb +20 -0
  272. data/test/environments/rails21/config/boot.rb +113 -0
  273. data/test/environments/rails21/config/database.yml +26 -0
  274. data/test/environments/rails21/config/environment.rb +26 -0
  275. data/test/environments/rails21/config/environments/development.rb +10 -0
  276. data/test/environments/rails21/config/environments/production.rb +8 -0
  277. data/test/environments/rails21/config/environments/test.rb +10 -0
  278. data/test/environments/rails21/config/routes.rb +5 -0
  279. data/test/environments/rails21/db/schema.rb +5 -0
  280. data/test/environments/rails22/Gemfile +25 -0
  281. data/test/environments/rails22/Rakefile +16 -0
  282. data/test/environments/rails22/app/controllers/application.rb +20 -0
  283. data/test/environments/rails22/config/boot.rb +113 -0
  284. data/test/environments/rails22/config/database.yml +26 -0
  285. data/test/environments/rails22/config/environment.rb +25 -0
  286. data/test/environments/rails22/config/environments/development.rb +10 -0
  287. data/test/environments/rails22/config/environments/production.rb +8 -0
  288. data/test/environments/rails22/config/environments/test.rb +10 -0
  289. data/test/environments/rails22/config/routes.rb +5 -0
  290. data/test/environments/rails22/db/schema.rb +5 -0
  291. data/test/environments/rails23/Gemfile +24 -0
  292. data/test/environments/rails23/Rakefile +16 -0
  293. data/test/environments/rails23/app/controllers/application.rb +20 -0
  294. data/test/environments/rails23/config/boot.rb +127 -0
  295. data/test/environments/rails23/config/database.yml +26 -0
  296. data/test/environments/rails23/config/environment.rb +16 -0
  297. data/test/environments/rails23/config/environments/production.rb +8 -0
  298. data/test/environments/rails23/config/environments/test.rb +10 -0
  299. data/test/environments/rails23/config/preinitializer.rb +25 -0
  300. data/test/environments/rails23/config/routes.rb +5 -0
  301. data/test/environments/rails23/db/schema.rb +5 -0
  302. data/test/environments/rails30/Gemfile +23 -0
  303. data/test/environments/rails30/Rakefile +11 -0
  304. data/test/environments/rails30/config/application.rb +17 -0
  305. data/test/environments/rails30/config/boot.rb +10 -0
  306. data/test/environments/rails30/config/database.yml +26 -0
  307. data/test/environments/rails30/config/environment.rb +6 -0
  308. data/test/environments/rails30/config/initializers/new_rails_defaults.rb +11 -0
  309. data/test/environments/rails30/db/schema.rb +5 -0
  310. data/test/environments/rails31/Gemfile +24 -0
  311. data/test/environments/rails31/Rakefile +11 -0
  312. data/test/environments/rails31/config/application.rb +18 -0
  313. data/test/environments/rails31/config/boot.rb +10 -0
  314. data/test/environments/rails31/config/database.yml +26 -0
  315. data/test/environments/rails31/config/environment.rb +6 -0
  316. data/test/environments/rails31/config/initializers/new_rails_defaults.rb +21 -0
  317. data/test/environments/rails31/db/schema.rb +5 -0
  318. data/test/environments/rails32/Gemfile +26 -0
  319. data/test/environments/rails32/Rakefile +11 -0
  320. data/test/environments/rails32/config/application.rb +19 -0
  321. data/test/environments/rails32/config/boot.rb +10 -0
  322. data/test/environments/rails32/config/database.yml +31 -0
  323. data/test/environments/rails32/config/environment.rb +6 -0
  324. data/test/environments/rails32/db/schema.rb +5 -0
  325. data/test/environments/rails40/Gemfile +43 -0
  326. data/test/environments/rails40/Rakefile +11 -0
  327. data/test/environments/rails40/config/application.rb +18 -0
  328. data/test/environments/rails40/config/boot.rb +10 -0
  329. data/test/environments/rails40/config/database.yml +26 -0
  330. data/test/environments/rails40/config/environment.rb +6 -0
  331. data/test/environments/rails40/db/schema.rb +5 -0
  332. data/test/environments/rails41/Gemfile +35 -0
  333. data/test/environments/rails41/Rakefile +11 -0
  334. data/test/environments/rails41/config/application.rb +18 -0
  335. data/test/environments/rails41/config/boot.rb +10 -0
  336. data/test/environments/rails41/config/database.yml +26 -0
  337. data/test/environments/rails41/config/environment.rb +6 -0
  338. data/test/environments/rails41/db/schema.rb +5 -0
  339. data/test/environments/rails42/Gemfile +39 -0
  340. data/test/environments/rails42/Rakefile +11 -0
  341. data/test/environments/rails42/config/application.rb +18 -0
  342. data/test/environments/rails42/config/boot.rb +10 -0
  343. data/test/environments/rails42/config/database.yml +26 -0
  344. data/test/environments/rails42/config/environment.rb +6 -0
  345. data/test/environments/rails42/db/schema.rb +5 -0
  346. data/test/fixtures/cross_agent_tests/README.md +56 -0
  347. data/test/fixtures/cross_agent_tests/attribute_configuration.json +384 -0
  348. data/test/fixtures/cross_agent_tests/aws.json +218 -0
  349. data/test/fixtures/cross_agent_tests/cat_map.json +597 -0
  350. data/test/fixtures/cross_agent_tests/docker_container_id/README.md +6 -0
  351. data/test/fixtures/cross_agent_tests/docker_container_id/cases.json +75 -0
  352. data/test/fixtures/cross_agent_tests/docker_container_id/docker-0.9.1.txt +10 -0
  353. data/test/fixtures/cross_agent_tests/docker_container_id/docker-1.0.0.txt +10 -0
  354. data/test/fixtures/cross_agent_tests/docker_container_id/docker-1.1.2-lxc-driver.txt +10 -0
  355. data/test/fixtures/cross_agent_tests/docker_container_id/docker-1.1.2-native-driver-fs.txt +10 -0
  356. data/test/fixtures/cross_agent_tests/docker_container_id/docker-1.1.2-native-driver-systemd.txt +10 -0
  357. data/test/fixtures/cross_agent_tests/docker_container_id/docker-1.3.txt +9 -0
  358. data/test/fixtures/cross_agent_tests/docker_container_id/empty.txt +0 -0
  359. data/test/fixtures/cross_agent_tests/docker_container_id/heroku.txt +1 -0
  360. data/test/fixtures/cross_agent_tests/docker_container_id/invalid-characters.txt +9 -0
  361. data/test/fixtures/cross_agent_tests/docker_container_id/invalid-length.txt +9 -0
  362. data/test/fixtures/cross_agent_tests/docker_container_id/ubuntu-14.04-lxc-container.txt +10 -0
  363. data/test/fixtures/cross_agent_tests/docker_container_id/ubuntu-14.04-no-container.txt +10 -0
  364. data/test/fixtures/cross_agent_tests/docker_container_id/ubuntu-14.10-no-container.txt +10 -0
  365. data/test/fixtures/cross_agent_tests/labels.json +133 -0
  366. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/README.md +16 -0
  367. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/basic_where.colon_obfuscated.txt +3 -0
  368. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/basic_where.explain.txt +3 -0
  369. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/basic_where.obfuscated.txt +3 -0
  370. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/basic_where.query.txt +1 -0
  371. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/current_date.colon_obfuscated.txt +2 -0
  372. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/current_date.explain.txt +2 -0
  373. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/current_date.obfuscated.txt +2 -0
  374. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/current_date.query.txt +1 -0
  375. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/date.colon_obfuscated.txt +2 -0
  376. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/date.explain.txt +2 -0
  377. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/date.obfuscated.txt +2 -0
  378. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/date.query.txt +1 -0
  379. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/embedded_newline.colon_obfuscated.txt +2 -0
  380. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/embedded_newline.explain.txt +3 -0
  381. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/embedded_newline.obfuscated.txt +2 -0
  382. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/embedded_newline.query.txt +1 -0
  383. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/embedded_quote.colon_obfuscated.txt +2 -0
  384. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/embedded_quote.explain.txt +2 -0
  385. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/embedded_quote.obfuscated.txt +2 -0
  386. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/embedded_quote.query.txt +1 -0
  387. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/floating_point.colon_obfuscated.txt +2 -0
  388. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/floating_point.explain.txt +2 -0
  389. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/floating_point.obfuscated.txt +2 -0
  390. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/floating_point.query.txt +1 -0
  391. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/function_with_strings.colon_obfuscated.txt +5 -0
  392. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/function_with_strings.explain.txt +5 -0
  393. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/function_with_strings.obfuscated.txt +5 -0
  394. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/function_with_strings.query.txt +1 -0
  395. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/quote_in_table_name.colon_obfuscated.txt +2 -0
  396. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/quote_in_table_name.explain.txt +2 -0
  397. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/quote_in_table_name.obfuscated.txt +2 -0
  398. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/quote_in_table_name.query.txt +1 -0
  399. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/subplan.colon_obfuscated.txt +5 -0
  400. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/subplan.explain.txt +5 -0
  401. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/subplan.obfuscated.txt +5 -0
  402. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/subplan.query.txt +1 -0
  403. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/where_with_integer.colon_obfuscated.txt +2 -0
  404. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/where_with_integer.explain.txt +2 -0
  405. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/where_with_integer.obfuscated.txt +2 -0
  406. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/where_with_integer.query.txt +1 -0
  407. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/where_with_regex_chars.colon_obfuscated.txt +2 -0
  408. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/where_with_regex_chars.explain.txt +2 -0
  409. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/where_with_regex_chars.obfuscated.txt +2 -0
  410. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/where_with_regex_chars.query.txt +1 -0
  411. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/where_with_substring.colon_obfuscated.txt +3 -0
  412. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/where_with_substring.explain.txt +3 -0
  413. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/where_with_substring.obfuscated.txt +3 -0
  414. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/where_with_substring.query.txt +1 -0
  415. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case1.colon_obfuscated.txt +2 -0
  416. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case1.explain.txt +2 -0
  417. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case1.obfuscated.txt +2 -0
  418. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case1.query.txt +1 -0
  419. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case2.colon_obfuscated.txt +2 -0
  420. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case2.explain.txt +3 -0
  421. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case2.obfuscated.txt +2 -0
  422. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case2.query.txt +1 -0
  423. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case3.colon_obfuscated.txt +2 -0
  424. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case3.explain.txt +2 -0
  425. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case3.obfuscated.txt +2 -0
  426. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case3.query.txt +1 -0
  427. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case4.colon_obfuscated.txt +2 -0
  428. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case4.explain.txt +2 -0
  429. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case4.obfuscated.txt +2 -0
  430. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case4.query.txt +1 -0
  431. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case5.colon_obfuscated.txt +2 -0
  432. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case5.explain.txt +2 -0
  433. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case5.obfuscated.txt +2 -0
  434. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case5.query.txt +1 -0
  435. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case6.colon_obfuscated.txt +2 -0
  436. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case6.explain.txt +2 -0
  437. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case6.obfuscated.txt +2 -0
  438. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case6.query.txt +1 -0
  439. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case7.colon_obfuscated.txt +2 -0
  440. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case7.explain.txt +2 -0
  441. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case7.obfuscated.txt +2 -0
  442. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case7.query.txt +1 -0
  443. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case8.colon_obfuscated.txt +2 -0
  444. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case8.explain.txt +2 -0
  445. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case8.obfuscated.txt +2 -0
  446. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case8.query.txt +1 -0
  447. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case9.colon_obfuscated.txt +2 -0
  448. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case9.explain.txt +2 -0
  449. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case9.obfuscated.txt +2 -0
  450. data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case9.query.txt +1 -0
  451. data/test/fixtures/cross_agent_tests/proc_cpuinfo/1pack_1core_1logical.txt +3 -0
  452. data/test/fixtures/cross_agent_tests/proc_cpuinfo/1pack_1core_2logical.txt +14 -0
  453. data/test/fixtures/cross_agent_tests/proc_cpuinfo/1pack_2core_2logical.txt +14 -0
  454. data/test/fixtures/cross_agent_tests/proc_cpuinfo/1pack_4core_4logical.txt +28 -0
  455. data/test/fixtures/cross_agent_tests/proc_cpuinfo/2pack_12core_24logical.txt +575 -0
  456. data/test/fixtures/cross_agent_tests/proc_cpuinfo/2pack_20core_40logical.txt +999 -0
  457. data/test/fixtures/cross_agent_tests/proc_cpuinfo/2pack_2core_2logical.txt +51 -0
  458. data/test/fixtures/cross_agent_tests/proc_cpuinfo/2pack_2core_4logical.txt +28 -0
  459. data/test/fixtures/cross_agent_tests/proc_cpuinfo/2pack_4core_4logical.txt +28 -0
  460. data/test/fixtures/cross_agent_tests/proc_cpuinfo/4pack_4core_4logical.txt +103 -0
  461. data/test/fixtures/cross_agent_tests/proc_cpuinfo/8pack_8core_8logical.txt +199 -0
  462. data/test/fixtures/cross_agent_tests/proc_cpuinfo/README.md +24 -0
  463. data/test/fixtures/cross_agent_tests/proc_cpuinfo/Xpack_Xcore_2logical.txt +43 -0
  464. data/test/fixtures/cross_agent_tests/proc_meminfo/README.md +7 -0
  465. data/test/fixtures/cross_agent_tests/proc_meminfo/meminfo_4096MB.txt +47 -0
  466. data/test/fixtures/cross_agent_tests/rules.json +165 -0
  467. data/test/fixtures/cross_agent_tests/rum_client_config.json +62 -0
  468. data/test/fixtures/cross_agent_tests/rum_footer_insertion_location/close-body-in-comment.html +10 -0
  469. data/test/fixtures/cross_agent_tests/rum_footer_insertion_location/dynamic-iframe.html +19 -0
  470. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/basic.html +10 -0
  471. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/body_with_attributes.html +3 -0
  472. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/charset_tag.html +11 -0
  473. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/charset_tag_after_x_ua_tag.html +11 -0
  474. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/charset_tag_before_x_ua_tag.html +11 -0
  475. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/charset_tag_with_spaces.html +11 -0
  476. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/comments1.html +24 -0
  477. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/comments2.html +24 -0
  478. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/content_type_charset_tag.html +11 -0
  479. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/content_type_charset_tag_after_x_ua_tag.html +11 -0
  480. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/content_type_charset_tag_before_x_ua_tag.html +11 -0
  481. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/empty_head +4 -0
  482. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/gt_in_quotes1.html +27 -0
  483. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/gt_in_quotes2.html +24 -0
  484. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/gt_in_quotes_mismatch.html +24 -0
  485. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/gt_in_single_quotes1.html +25 -0
  486. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/gt_in_single_quotes_mismatch.html +25 -0
  487. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/head_with_attributes.html +10 -0
  488. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/incomplete_non_meta_tags.html +10 -0
  489. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/no_end_header.html +6 -0
  490. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/no_header.html +7 -0
  491. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/no_html_and_no_header.html +3 -0
  492. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/no_start_header.html +9 -0
  493. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/script1.html +19 -0
  494. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/script2.html +17 -0
  495. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/x_ua_meta_tag.html +10 -0
  496. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/x_ua_meta_tag_multiline.html +11 -0
  497. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/x_ua_meta_tag_multiple_tags.html +12 -0
  498. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/x_ua_meta_tag_spaces_around_equals.html +10 -0
  499. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/x_ua_meta_tag_with_others.html +11 -0
  500. data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/x_ua_meta_tag_with_spaces.html +10 -0
  501. data/test/fixtures/cross_agent_tests/sql_obfuscation/README.md +30 -0
  502. data/test/fixtures/cross_agent_tests/sql_obfuscation/sql_obfuscation.json +365 -0
  503. data/test/fixtures/cross_agent_tests/sql_parsing.json +55 -0
  504. data/test/fixtures/cross_agent_tests/synthetics/README.md +65 -0
  505. data/test/fixtures/cross_agent_tests/synthetics/synthetics.json +317 -0
  506. data/test/fixtures/cross_agent_tests/transaction_segment_terms.json +101 -0
  507. data/test/fixtures/cross_agent_tests/url_clean.json +15 -0
  508. data/test/fixtures/cross_agent_tests/url_domain_extraction.json +35 -0
  509. data/test/helpers/exceptions.rb +16 -0
  510. data/test/helpers/file_searching.rb +28 -0
  511. data/test/helpers/mongo_metric_builder.rb +28 -0
  512. data/test/helpers/runtime_detection.rb +17 -0
  513. data/test/intentional_fail.rb +13 -0
  514. data/test/mmtrix/FAKECHANGELOG +21 -0
  515. data/test/mmtrix/agent/agent/connect_test.rb +308 -0
  516. data/test/mmtrix/agent/agent/start_test.rb +191 -0
  517. data/test/mmtrix/agent/agent/start_worker_thread_test.rb +74 -0
  518. data/test/mmtrix/agent/agent_logger_test.rb +392 -0
  519. data/test/mmtrix/agent/agent_test.rb +631 -0
  520. data/test/mmtrix/agent/agent_test_controller.rb +84 -0
  521. data/test/mmtrix/agent/apdex_from_server_test.rb +13 -0
  522. data/test/mmtrix/agent/attribute_filter_test.rb +218 -0
  523. data/test/mmtrix/agent/attribute_processing_test.rb +165 -0
  524. data/test/mmtrix/agent/audit_logger_test.rb +213 -0
  525. data/test/mmtrix/agent/autostart_test.rb +79 -0
  526. data/test/mmtrix/agent/aws_info_test.rb +61 -0
  527. data/test/mmtrix/agent/busy_calculator_test.rb +98 -0
  528. data/test/mmtrix/agent/commands/agent_command_router_test.rb +256 -0
  529. data/test/mmtrix/agent/commands/agent_command_test.rb +37 -0
  530. data/test/mmtrix/agent/commands/thread_profiler_session_test.rb +215 -0
  531. data/test/mmtrix/agent/commands/xray_session_collection_test.rb +332 -0
  532. data/test/mmtrix/agent/commands/xray_session_test.rb +42 -0
  533. data/test/mmtrix/agent/configuration/default_source_test.rb +226 -0
  534. data/test/mmtrix/agent/configuration/dotted_hash_test.rb +53 -0
  535. data/test/mmtrix/agent/configuration/environment_source_test.rb +201 -0
  536. data/test/mmtrix/agent/configuration/high_security_source_test.rb +83 -0
  537. data/test/mmtrix/agent/configuration/manager_test.rb +460 -0
  538. data/test/mmtrix/agent/configuration/manual_source_test.rb +18 -0
  539. data/test/mmtrix/agent/configuration/orphan_configuration_test.rb +89 -0
  540. data/test/mmtrix/agent/configuration/server_source_test.rb +202 -0
  541. data/test/mmtrix/agent/configuration/yaml_source_test.rb +117 -0
  542. data/test/mmtrix/agent/cross_app_monitor_test.rb +248 -0
  543. data/test/mmtrix/agent/cross_app_tracing_test.rb +71 -0
  544. data/test/mmtrix/agent/custom_event_aggregator_test.rb +88 -0
  545. data/test/mmtrix/agent/database/postgres_explain_obfuscator_test.rb +34 -0
  546. data/test/mmtrix/agent/database/sql_obfuscation_test.rb +59 -0
  547. data/test/mmtrix/agent/database_test.rb +401 -0
  548. data/test/mmtrix/agent/datastores/metric_helper_test.rb +132 -0
  549. data/test/mmtrix/agent/datastores/mongo/metric_translator_test.rb +320 -0
  550. data/test/mmtrix/agent/datastores/mongo/obfuscator_test.rb +91 -0
  551. data/test/mmtrix/agent/datastores/mongo/statement_formatter_test.rb +72 -0
  552. data/test/mmtrix/agent/datastores_test.rb +195 -0
  553. data/test/mmtrix/agent/deprecator_test.rb +52 -0
  554. data/test/mmtrix/agent/encoding_normalizer_test.rb +66 -0
  555. data/test/mmtrix/agent/error_collector_test.rb +618 -0
  556. data/test/mmtrix/agent/event_buffer_test_cases.rb +152 -0
  557. data/test/mmtrix/agent/event_listener_test.rb +70 -0
  558. data/test/mmtrix/agent/event_loop_test.rb +202 -0
  559. data/test/mmtrix/agent/harvester_test.rb +79 -0
  560. data/test/mmtrix/agent/hash_extensions_test.rb +34 -0
  561. data/test/mmtrix/agent/hostname_test.rb +93 -0
  562. data/test/mmtrix/agent/http_clients/uri_util_test.rb +64 -0
  563. data/test/mmtrix/agent/inbound_request_monitor_test.rb +49 -0
  564. data/test/mmtrix/agent/instrumentation/action_controller_subscriber_test.rb +299 -0
  565. data/test/mmtrix/agent/instrumentation/action_view_subscriber_test.rb +239 -0
  566. data/test/mmtrix/agent/instrumentation/active_job_test.rb +20 -0
  567. data/test/mmtrix/agent/instrumentation/active_record_helper_test.rb +77 -0
  568. data/test/mmtrix/agent/instrumentation/active_record_subscriber_test.rb +132 -0
  569. data/test/mmtrix/agent/instrumentation/controller_instrumentation_test.rb +328 -0
  570. data/test/mmtrix/agent/instrumentation/instrumentation_test.rb +14 -0
  571. data/test/mmtrix/agent/instrumentation/metric_frame_test.rb +22 -0
  572. data/test/mmtrix/agent/instrumentation/middleware_proxy_test.rb +257 -0
  573. data/test/mmtrix/agent/instrumentation/middleware_tracing_test.rb +49 -0
  574. data/test/mmtrix/agent/instrumentation/net_instrumentation_test.rb +35 -0
  575. data/test/mmtrix/agent/instrumentation/queue_time_test.rb +103 -0
  576. data/test/mmtrix/agent/instrumentation/rack_test.rb +47 -0
  577. data/test/mmtrix/agent/instrumentation/sequel_helper_test.rb +36 -0
  578. data/test/mmtrix/agent/instrumentation/sinatra/transaction_namer_test.rb +55 -0
  579. data/test/mmtrix/agent/instrumentation/sinatra_test.rb +80 -0
  580. data/test/mmtrix/agent/instrumentation/task_instrumentation_test.rb +196 -0
  581. data/test/mmtrix/agent/javascript_instrumentor_test.rb +340 -0
  582. data/test/mmtrix/agent/memory_logger_test.rb +85 -0
  583. data/test/mmtrix/agent/method_interrobang_test.rb +31 -0
  584. data/test/mmtrix/agent/method_tracer/class_methods/add_method_tracer_test.rb +122 -0
  585. data/test/mmtrix/agent/method_tracer/instance_methods/trace_execution_scoped_test.rb +224 -0
  586. data/test/mmtrix/agent/method_tracer_test.rb +474 -0
  587. data/test/mmtrix/agent/method_visibility_test.rb +90 -0
  588. data/test/mmtrix/agent/mmtrix_service_test.rb +1056 -0
  589. data/test/mmtrix/agent/mock_scope_listener.rb +27 -0
  590. data/test/mmtrix/agent/obfuscator_test.rb +77 -0
  591. data/test/mmtrix/agent/parameter_filtering_test.rb +39 -0
  592. data/test/mmtrix/agent/pipe_channel_manager_test.rb +278 -0
  593. data/test/mmtrix/agent/pipe_service_test.rb +145 -0
  594. data/test/mmtrix/agent/rpm_agent_test.rb +94 -0
  595. data/test/mmtrix/agent/rules_engine_test.rb +136 -0
  596. data/test/mmtrix/agent/sampled_buffer_test.rb +106 -0
  597. data/test/mmtrix/agent/sampler_collection_test.rb +90 -0
  598. data/test/mmtrix/agent/sampler_test.rb +66 -0
  599. data/test/mmtrix/agent/samplers/cpu_sampler_test.rb +51 -0
  600. data/test/mmtrix/agent/samplers/vm_sampler_test.rb +349 -0
  601. data/test/mmtrix/agent/sized_buffer_test.rb +29 -0
  602. data/test/mmtrix/agent/sql_sampler_test.rb +403 -0
  603. data/test/mmtrix/agent/stats_engine/gc_profiler_test.rb +188 -0
  604. data/test/mmtrix/agent/stats_engine/metric_stats_test.rb +347 -0
  605. data/test/mmtrix/agent/stats_engine/samplers_test.rb +98 -0
  606. data/test/mmtrix/agent/stats_engine/stats_hash_test.rb +194 -0
  607. data/test/mmtrix/agent/stats_engine_test.rb +32 -0
  608. data/test/mmtrix/agent/stats_test.rb +189 -0
  609. data/test/mmtrix/agent/synthetics_event_buffer_test.rb +54 -0
  610. data/test/mmtrix/agent/synthetics_monitor_test.rb +93 -0
  611. data/test/mmtrix/agent/system_info_test.rb +119 -0
  612. data/test/mmtrix/agent/threading/agent_thread_test.rb +149 -0
  613. data/test/mmtrix/agent/threading/backtrace_node_test.rb +184 -0
  614. data/test/mmtrix/agent/threading/backtrace_service_test.rb +595 -0
  615. data/test/mmtrix/agent/threading/fake_thread.rb +43 -0
  616. data/test/mmtrix/agent/threading/thread_profile_test.rb +272 -0
  617. data/test/mmtrix/agent/threading/threaded_test_case.rb +18 -0
  618. data/test/mmtrix/agent/traced_method_stack_test.rb +187 -0
  619. data/test/mmtrix/agent/transaction/attributes_test.rb +276 -0
  620. data/test/mmtrix/agent/transaction/developer_mode_sample_buffer_test.rb +75 -0
  621. data/test/mmtrix/agent/transaction/slowest_sample_buffer_test.rb +67 -0
  622. data/test/mmtrix/agent/transaction/synthetics_sample_buffer_test.rb +38 -0
  623. data/test/mmtrix/agent/transaction/trace_node_test.rb +361 -0
  624. data/test/mmtrix/agent/transaction/trace_test.rb +394 -0
  625. data/test/mmtrix/agent/transaction/xray_sample_buffer_test.rb +71 -0
  626. data/test/mmtrix/agent/transaction_event_aggregator_test.rb +426 -0
  627. data/test/mmtrix/agent/transaction_interrobang_test.rb +33 -0
  628. data/test/mmtrix/agent/transaction_metrics_test.rb +113 -0
  629. data/test/mmtrix/agent/transaction_sample_builder_test.rb +215 -0
  630. data/test/mmtrix/agent/transaction_sampler_test.rb +849 -0
  631. data/test/mmtrix/agent/transaction_state_test.rb +122 -0
  632. data/test/mmtrix/agent/transaction_test.rb +1435 -0
  633. data/test/mmtrix/agent/transaction_timings_test.rb +91 -0
  634. data/test/mmtrix/agent/utilization_data_test.rb +147 -0
  635. data/test/mmtrix/agent/vm/monotonic_gc_profiler_test.rb +42 -0
  636. data/test/mmtrix/agent/vm/mri_vm_test.rb +42 -0
  637. data/test/mmtrix/agent/vm/rubinius_vm_test.rb +69 -0
  638. data/test/mmtrix/agent/vm/snapshot_test.rb +13 -0
  639. data/test/mmtrix/agent/vm_test.rb +48 -0
  640. data/test/mmtrix/agent/worker_loop_test.rb +98 -0
  641. data/test/mmtrix/agent_test.rb +471 -0
  642. data/test/mmtrix/cli/commands/deployments_test.rb +131 -0
  643. data/test/mmtrix/cli/commands/install_test.rb +27 -0
  644. data/test/mmtrix/coerce_test.rb +95 -0
  645. data/test/mmtrix/collection_helper_test.rb +151 -0
  646. data/test/mmtrix/control/class_methods_test.rb +48 -0
  647. data/test/mmtrix/control/frameworks/rails_test.rb +29 -0
  648. data/test/mmtrix/control/instance_methods_test.rb +50 -0
  649. data/test/mmtrix/control/instrumentation_test.rb +41 -0
  650. data/test/mmtrix/control_test.rb +169 -0
  651. data/test/mmtrix/data_container_tests.rb +76 -0
  652. data/test/mmtrix/dependency_detection_test.rb +155 -0
  653. data/test/mmtrix/dispatcher_test.rb +59 -0
  654. data/test/mmtrix/environment_report_test.rb +107 -0
  655. data/test/mmtrix/evil_server.rb +55 -0
  656. data/test/mmtrix/fake_collector.rb +385 -0
  657. data/test/mmtrix/fake_external_server.rb +65 -0
  658. data/test/mmtrix/fake_instance_metadata_service.rb +45 -0
  659. data/test/mmtrix/fake_rpm_site.rb +35 -0
  660. data/test/mmtrix/fake_server.rb +104 -0
  661. data/test/mmtrix/filtering_test_app.rb +19 -0
  662. data/test/mmtrix/framework_test.rb +58 -0
  663. data/test/mmtrix/http_client_test_cases.rb +621 -0
  664. data/test/mmtrix/json_wrapper_test.rb +32 -0
  665. data/test/mmtrix/language_support_test.rb +104 -0
  666. data/test/mmtrix/latest_changes_test.rb +45 -0
  667. data/test/mmtrix/license_test.rb +128 -0
  668. data/test/mmtrix/load_test.rb +15 -0
  669. data/test/mmtrix/local_environment_test.rb +103 -0
  670. data/test/mmtrix/marshalling_test_cases.rb +140 -0
  671. data/test/mmtrix/metric_data_test.rb +191 -0
  672. data/test/mmtrix/metric_parser/metric_parser_test.rb +17 -0
  673. data/test/mmtrix/metric_spec_test.rb +145 -0
  674. data/test/mmtrix/multiverse_helpers.rb +283 -0
  675. data/test/mmtrix/noticed_error_test.rb +197 -0
  676. data/test/mmtrix/rack/agent_hooks_test.rb +44 -0
  677. data/test/mmtrix/rack/agent_middleware_test.rb +32 -0
  678. data/test/mmtrix/rack/browser_monitoring_test.rb +197 -0
  679. data/test/mmtrix/rack/deferred_instrumentation_test.rb +33 -0
  680. data/test/mmtrix/rack/developer_mode/segment_summary_test.rb +96 -0
  681. data/test/mmtrix/rack/developer_mode_helper_test.rb +136 -0
  682. data/test/mmtrix/rack/developer_mode_test.rb +93 -0
  683. data/test/mmtrix/rack/error_collector_test.rb +77 -0
  684. data/test/mmtrix/transaction_ignoring_test_cases.rb +102 -0
  685. data/test/mmtrix/version_number_test.rb +101 -0
  686. data/test/multiverse/.gitignore +13 -0
  687. data/test/multiverse/README.md +85 -0
  688. data/test/multiverse/lib/multiverse/color.rb +23 -0
  689. data/test/multiverse/lib/multiverse/envfile.rb +66 -0
  690. data/test/multiverse/lib/multiverse/environment.rb +19 -0
  691. data/test/multiverse/lib/multiverse/output_collector.rb +82 -0
  692. data/test/multiverse/lib/multiverse/runner.rb +117 -0
  693. data/test/multiverse/lib/multiverse/suite.rb +528 -0
  694. data/test/multiverse/script/runner +5 -0
  695. data/test/multiverse/suites/active_record/.gitignore +1 -0
  696. data/test/multiverse/suites/active_record/Envfile +73 -0
  697. data/test/multiverse/suites/active_record/Rakefile +9 -0
  698. data/test/multiverse/suites/active_record/active_record_test.rb +568 -0
  699. data/test/multiverse/suites/active_record/app/models/models.rb +34 -0
  700. data/test/multiverse/suites/active_record/ar_method_aliasing.rb +43 -0
  701. data/test/multiverse/suites/active_record/before_suite.rb +23 -0
  702. data/test/multiverse/suites/active_record/config/database.rb +80 -0
  703. data/test/multiverse/suites/active_record/config/database.yml +19 -0
  704. data/test/multiverse/suites/active_record/config/mmtrix.yml +18 -0
  705. data/test/multiverse/suites/active_record/db/migrate/20141105131800_create_users_and_aliases.rb +21 -0
  706. data/test/multiverse/suites/active_record/db/migrate/20141106082200_create_orders_and_shipments.rb +25 -0
  707. data/test/multiverse/suites/active_record/db/migrate/20150413011200_add_timestamps_to_orders.rb +16 -0
  708. data/test/multiverse/suites/active_record/db/migrate/20150414084400_create_groups.rb +21 -0
  709. data/test/multiverse/suites/activemerchant/Envfile +36 -0
  710. data/test/multiverse/suites/activemerchant/activemerchant_test.rb +62 -0
  711. data/test/multiverse/suites/agent_only/Envfile +4 -0
  712. data/test/multiverse/suites/agent_only/agent_attributes_test.rb +168 -0
  713. data/test/multiverse/suites/agent_only/agent_run_id_handling_test.rb +39 -0
  714. data/test/multiverse/suites/agent_only/audit_log_test.rb +58 -0
  715. data/test/multiverse/suites/agent_only/collector_exception_handling_test.rb +87 -0
  716. data/test/multiverse/suites/agent_only/config/mmtrix.yml +27 -0
  717. data/test/multiverse/suites/agent_only/cross_application_tracing_test.rb +94 -0
  718. data/test/multiverse/suites/agent_only/custom_analytics_events_test.rb +67 -0
  719. data/test/multiverse/suites/agent_only/custom_queue_time_test.rb +60 -0
  720. data/test/multiverse/suites/agent_only/encoding_handling_test.rb +130 -0
  721. data/test/multiverse/suites/agent_only/exclusive_time_test.rb +176 -0
  722. data/test/multiverse/suites/agent_only/harvest_timestamps_test.rb +83 -0
  723. data/test/multiverse/suites/agent_only/http_response_code_test.rb +38 -0
  724. data/test/multiverse/suites/agent_only/keepalive_test.rb +24 -0
  725. data/test/multiverse/suites/agent_only/key_transactions_test.rb +118 -0
  726. data/test/multiverse/suites/agent_only/labels_test.rb +83 -0
  727. data/test/multiverse/suites/agent_only/logging_test.rb +162 -0
  728. data/test/multiverse/suites/agent_only/marshaling_test.rb +88 -0
  729. data/test/multiverse/suites/agent_only/pipe_manager_test.rb +41 -0
  730. data/test/multiverse/suites/agent_only/rename_rule_test.rb +91 -0
  731. data/test/multiverse/suites/agent_only/rum_instrumentation_test.rb +97 -0
  732. data/test/multiverse/suites/agent_only/script/env_change.rb +10 -0
  733. data/test/multiverse/suites/agent_only/script/loading.rb +20 -0
  734. data/test/multiverse/suites/agent_only/script/public_api_when_disabled.rb +68 -0
  735. data/test/multiverse/suites/agent_only/script/symbol_env.rb +10 -0
  736. data/test/multiverse/suites/agent_only/service_timeout_test.rb +39 -0
  737. data/test/multiverse/suites/agent_only/set_transaction_name_test.rb +118 -0
  738. data/test/multiverse/suites/agent_only/ssl_test.rb +21 -0
  739. data/test/multiverse/suites/agent_only/start_up_test.rb +74 -0
  740. data/test/multiverse/suites/agent_only/synthetics_test.rb +131 -0
  741. data/test/multiverse/suites/agent_only/testing_app.rb +58 -0
  742. data/test/multiverse/suites/agent_only/thread_profiling_test.rb +160 -0
  743. data/test/multiverse/suites/agent_only/transaction_ignoring_test.rb +42 -0
  744. data/test/multiverse/suites/agent_only/utilization_data_collection_test.rb +110 -0
  745. data/test/multiverse/suites/agent_only/xray_sessions_test.rb +199 -0
  746. data/test/multiverse/suites/bare/Envfile +3 -0
  747. data/test/multiverse/suites/bare/standalone_instrumentation_test.rb +43 -0
  748. data/test/multiverse/suites/capistrano/Capfile +26 -0
  749. data/test/multiverse/suites/capistrano/Envfile +18 -0
  750. data/test/multiverse/suites/capistrano/config/deploy/production.rb +9 -0
  751. data/test/multiverse/suites/capistrano/config/deploy.rb +14 -0
  752. data/test/multiverse/suites/capistrano/config/mmtrix.yml +21 -0
  753. data/test/multiverse/suites/capistrano/deployment_test.rb +54 -0
  754. data/test/multiverse/suites/capistrano2/Capfile +4 -0
  755. data/test/multiverse/suites/capistrano2/Envfile +8 -0
  756. data/test/multiverse/suites/capistrano2/config/deploy.rb +19 -0
  757. data/test/multiverse/suites/capistrano2/config/mmtrix.yml +21 -0
  758. data/test/multiverse/suites/capistrano2/deployment_test.rb +37 -0
  759. data/test/multiverse/suites/config_file_loading/Envfile +13 -0
  760. data/test/multiverse/suites/config_file_loading/config_file_loading_test.rb +213 -0
  761. data/test/multiverse/suites/curb/Envfile +31 -0
  762. data/test/multiverse/suites/curb/config/mmtrix.yml +18 -0
  763. data/test/multiverse/suites/curb/curb_test.rb +213 -0
  764. data/test/multiverse/suites/datamapper/Envfile +30 -0
  765. data/test/multiverse/suites/datamapper/config/mmtrix.yml +20 -0
  766. data/test/multiverse/suites/datamapper/datamapper_test.rb +335 -0
  767. data/test/multiverse/suites/deferred_instrumentation/Envfile +15 -0
  768. data/test/multiverse/suites/deferred_instrumentation/config/mmtrix.yml +20 -0
  769. data/test/multiverse/suites/deferred_instrumentation/sinatra_test.rb +107 -0
  770. data/test/multiverse/suites/delayed_job/Envfile +102 -0
  771. data/test/multiverse/suites/delayed_job/before_suite.rb +33 -0
  772. data/test/multiverse/suites/delayed_job/config/mmtrix.yml +18 -0
  773. data/test/multiverse/suites/delayed_job/delayed_job_sampler_test.rb +128 -0
  774. data/test/multiverse/suites/delayed_job/unsupported_backend_test.rb +21 -0
  775. data/test/multiverse/suites/excon/Envfile +21 -0
  776. data/test/multiverse/suites/excon/config/mmtrix.yml +18 -0
  777. data/test/multiverse/suites/excon/excon_test.rb +81 -0
  778. data/test/multiverse/suites/grape/Envfile +13 -0
  779. data/test/multiverse/suites/grape/config/mmtrix.yml +19 -0
  780. data/test/multiverse/suites/grape/grape_test.rb +202 -0
  781. data/test/multiverse/suites/grape/grape_test_api.rb +64 -0
  782. data/test/multiverse/suites/grape/grape_versioning_test.rb +64 -0
  783. data/test/multiverse/suites/grape/grape_versioning_test_api.rb +72 -0
  784. data/test/multiverse/suites/grape/unsupported_version_test.rb +28 -0
  785. data/test/multiverse/suites/high_security/Envfile +3 -0
  786. data/test/multiverse/suites/high_security/config/mmtrix.yml +70 -0
  787. data/test/multiverse/suites/high_security/high_security_test.rb +214 -0
  788. data/test/multiverse/suites/httpclient/Envfile +13 -0
  789. data/test/multiverse/suites/httpclient/config/mmtrix.yml +18 -0
  790. data/test/multiverse/suites/httpclient/httpclient_test.rb +75 -0
  791. data/test/multiverse/suites/json/Envfile +25 -0
  792. data/test/multiverse/suites/json/config/mmtrix.yml +22 -0
  793. data/test/multiverse/suites/json/json_test.rb +16 -0
  794. data/test/multiverse/suites/marshalling/Envfile +12 -0
  795. data/test/multiverse/suites/marshalling/config/mmtrix.yml +20 -0
  796. data/test/multiverse/suites/marshalling/marshalling_test.rb +16 -0
  797. data/test/multiverse/suites/memcached/Envfile +52 -0
  798. data/test/multiverse/suites/memcached/dalli_test.rb +89 -0
  799. data/test/multiverse/suites/memcached/memcache_client_test.rb +25 -0
  800. data/test/multiverse/suites/memcached/memcache_test_cases.rb +302 -0
  801. data/test/multiverse/suites/memcached/memcached_test.rb +159 -0
  802. data/test/multiverse/suites/mongo/Envfile +69 -0
  803. data/test/multiverse/suites/mongo/config/mmtrix.yml +18 -0
  804. data/test/multiverse/suites/mongo/helpers/mongo_operation_tests.rb +489 -0
  805. data/test/multiverse/suites/mongo/helpers/mongo_replica_set.rb +97 -0
  806. data/test/multiverse/suites/mongo/helpers/mongo_replica_set_test.rb +82 -0
  807. data/test/multiverse/suites/mongo/helpers/mongo_server.rb +241 -0
  808. data/test/multiverse/suites/mongo/helpers/mongo_server_test.rb +176 -0
  809. data/test/multiverse/suites/mongo/mongo_connection_test.rb +39 -0
  810. data/test/multiverse/suites/mongo/mongo_instrumentation_test.rb +39 -0
  811. data/test/multiverse/suites/mongo/mongo_unsupported_version_test.rb +72 -0
  812. data/test/multiverse/suites/net_http/Envfile +4 -0
  813. data/test/multiverse/suites/net_http/config/mmtrix.yml +18 -0
  814. data/test/multiverse/suites/net_http/net_http_test.rb +111 -0
  815. data/test/multiverse/suites/padrino/Envfile +14 -0
  816. data/test/multiverse/suites/padrino/config/mmtrix.yml +20 -0
  817. data/test/multiverse/suites/padrino/padrino_test.rb +52 -0
  818. data/test/multiverse/suites/rack/Envfile +35 -0
  819. data/test/multiverse/suites/rack/builder_map_test.rb +128 -0
  820. data/test/multiverse/suites/rack/example_app.rb +100 -0
  821. data/test/multiverse/suites/rack/http_response_code_test.rb +50 -0
  822. data/test/multiverse/suites/rack/nested_non_rack_app_test.rb +66 -0
  823. data/test/multiverse/suites/rack/rack_auto_instrumentation_test.rb +144 -0
  824. data/test/multiverse/suites/rack/rack_cascade_test.rb +45 -0
  825. data/test/multiverse/suites/rack/rack_env_mutation_test.rb +53 -0
  826. data/test/multiverse/suites/rack/rack_parameter_filtering_test.rb +49 -0
  827. data/test/multiverse/suites/rack/rack_unsupported_version_test.rb +43 -0
  828. data/test/multiverse/suites/rack/url_map_test.rb +117 -0
  829. data/test/multiverse/suites/rails/Envfile +61 -0
  830. data/test/multiverse/suites/rails/action_controller_live_rum_test.rb +39 -0
  831. data/test/multiverse/suites/rails/activejob_test.rb +152 -0
  832. data/test/multiverse/suites/rails/app/views/foos/_foo.html.haml +1 -0
  833. data/test/multiverse/suites/rails/app/views/views/_a_partial.html.erb +2 -0
  834. data/test/multiverse/suites/rails/app/views/views/_mid_partial.html.erb +1 -0
  835. data/test/multiverse/suites/rails/app/views/views/_top_partial.html.erb +3 -0
  836. data/test/multiverse/suites/rails/app/views/views/deep_partial.html.erb +3 -0
  837. data/test/multiverse/suites/rails/app/views/views/haml_view.html.haml +6 -0
  838. data/test/multiverse/suites/rails/app/views/views/index.html.erb +4 -0
  839. data/test/multiverse/suites/rails/app.rb +44 -0
  840. data/test/multiverse/suites/rails/bad_instrumentation_test.rb +29 -0
  841. data/test/multiverse/suites/rails/config/mmtrix.yml +30 -0
  842. data/test/multiverse/suites/rails/dummy.txt +1 -0
  843. data/test/multiverse/suites/rails/error_tracing_test.rb +322 -0
  844. data/test/multiverse/suites/rails/gc_instrumentation_test.rb +93 -0
  845. data/test/multiverse/suites/rails/ignore_test.rb +79 -0
  846. data/test/multiverse/suites/rails/middleware_instrumentation_test.rb +41 -0
  847. data/test/multiverse/suites/rails/middlewares.rb +19 -0
  848. data/test/multiverse/suites/rails/parameter_capture_test.rb +299 -0
  849. data/test/multiverse/suites/rails/queue_time_test.rb +89 -0
  850. data/test/multiverse/suites/rails/rails2_app/app/controllers/application.rb +7 -0
  851. data/test/multiverse/suites/rails/rails2_app/config/boot.rb +127 -0
  852. data/test/multiverse/suites/rails/rails2_app/config/database.yml +18 -0
  853. data/test/multiverse/suites/rails/rails2_app/config/environment.rb +16 -0
  854. data/test/multiverse/suites/rails/rails2_app/config/environments/development.rb +10 -0
  855. data/test/multiverse/suites/rails/rails2_app/config/initializers/load_mmtrix_rpm.rb +9 -0
  856. data/test/multiverse/suites/rails/rails2_app/config/preinitializer.rb +25 -0
  857. data/test/multiverse/suites/rails/rails2_app/config/routes.rb +19 -0
  858. data/test/multiverse/suites/rails/rails2_app/db/schema.rb +5 -0
  859. data/test/multiverse/suites/rails/rails3_app/app_rails3_plus.rb +92 -0
  860. data/test/multiverse/suites/rails/request_statistics_test.rb +192 -0
  861. data/test/multiverse/suites/rails/transaction_ignoring_test.rb +41 -0
  862. data/test/multiverse/suites/rails/view_instrumentation_test.rb +254 -0
  863. data/test/multiverse/suites/resque/Envfile +11 -0
  864. data/test/multiverse/suites/resque/Rakefile +3 -0
  865. data/test/multiverse/suites/resque/config/mmtrix.yml +19 -0
  866. data/test/multiverse/suites/resque/instrumentation_test.rb +155 -0
  867. data/test/multiverse/suites/resque/resque_marshalling_test.rb +53 -0
  868. data/test/multiverse/suites/sequel/Envfile +34 -0
  869. data/test/multiverse/suites/sequel/config/mmtrix.yml +18 -0
  870. data/test/multiverse/suites/sequel/database.rb +57 -0
  871. data/test/multiverse/suites/sequel/sequel_extension_test.rb +142 -0
  872. data/test/multiverse/suites/sequel/sequel_helpers.rb +62 -0
  873. data/test/multiverse/suites/sequel/sequel_plugin_test.rb +230 -0
  874. data/test/multiverse/suites/sequel/sequel_safety_test.rb +30 -0
  875. data/test/multiverse/suites/sidekiq/Envfile +31 -0
  876. data/test/multiverse/suites/sidekiq/after_suite.rb +16 -0
  877. data/test/multiverse/suites/sidekiq/config/mmtrix.yml +20 -0
  878. data/test/multiverse/suites/sidekiq/log/.gitkeep +0 -0
  879. data/test/multiverse/suites/sidekiq/sidekiq_instrumentation_test.rb +219 -0
  880. data/test/multiverse/suites/sidekiq/sidekiq_server.rb +31 -0
  881. data/test/multiverse/suites/sidekiq/test_worker.rb +71 -0
  882. data/test/multiverse/suites/sinatra/Envfile +17 -0
  883. data/test/multiverse/suites/sinatra/config/mmtrix.yml +21 -0
  884. data/test/multiverse/suites/sinatra/ignoring_test.rb +208 -0
  885. data/test/multiverse/suites/sinatra/nested_middleware_test.rb +39 -0
  886. data/test/multiverse/suites/sinatra/sinatra_classic_test.rb +99 -0
  887. data/test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb +45 -0
  888. data/test/multiverse/suites/sinatra/sinatra_metric_explosion_test.rb +96 -0
  889. data/test/multiverse/suites/sinatra/sinatra_modular_test.rb +89 -0
  890. data/test/multiverse/suites/sinatra/sinatra_parameter_capture_test.rb +65 -0
  891. data/test/multiverse/suites/sinatra/sinatra_routes_test.rb +49 -0
  892. data/test/multiverse/suites/sinatra/sinatra_test_cases.rb +137 -0
  893. data/test/multiverse/suites/typhoeus/Envfile +57 -0
  894. data/test/multiverse/suites/typhoeus/config/mmtrix.yml +18 -0
  895. data/test/multiverse/suites/typhoeus/typhoeus_test.rb +144 -0
  896. data/test/multiverse/suites/yajl/Envfile +13 -0
  897. data/test/multiverse/suites/yajl/config/mmtrix.yml +21 -0
  898. data/test/multiverse/suites/yajl/yajl_test.rb +18 -0
  899. data/test/multiverse/test/multiverse_test.rb +59 -0
  900. data/test/multiverse/test/suite_examples/one/a/Envfile +3 -0
  901. data/test/multiverse/test/suite_examples/one/a/a_test.rb +14 -0
  902. data/test/multiverse/test/suite_examples/one/a/config/mmtrix.yml +22 -0
  903. data/test/multiverse/test/suite_examples/one/b/Envfile +3 -0
  904. data/test/multiverse/test/suite_examples/one/b/b_test.rb +14 -0
  905. data/test/multiverse/test/suite_examples/one/b/config/mmtrix.yml +22 -0
  906. data/test/multiverse/test/suite_examples/three/a/Envfile +2 -0
  907. data/test/multiverse/test/suite_examples/three/a/fail_test.rb +10 -0
  908. data/test/multiverse/test/suite_examples/three/b/Envfile +2 -0
  909. data/test/multiverse/test/suite_examples/three/b/win_test.rb +10 -0
  910. data/test/multiverse/test/suite_examples/two/a/Envfile +1 -0
  911. data/test/multiverse/test/suite_examples/two/a/fail_test.rb +10 -0
  912. data/test/performance/README.md +182 -0
  913. data/test/performance/lib/performance/baseline.rb +36 -0
  914. data/test/performance/lib/performance/baseline_compare_reporter.rb +103 -0
  915. data/test/performance/lib/performance/baseline_save_reporter.rb +24 -0
  916. data/test/performance/lib/performance/console_reporter.rb +66 -0
  917. data/test/performance/lib/performance/formatting_helpers.rb +22 -0
  918. data/test/performance/lib/performance/hako_client.rb +31 -0
  919. data/test/performance/lib/performance/hako_reporter.rb +26 -0
  920. data/test/performance/lib/performance/instrumentation/cpu_usage.rb +26 -0
  921. data/test/performance/lib/performance/instrumentation/gc_stats.rb +58 -0
  922. data/test/performance/lib/performance/instrumentation/perf_tools.rb +30 -0
  923. data/test/performance/lib/performance/instrumentation/stackprof.rb +46 -0
  924. data/test/performance/lib/performance/instrumentor.rb +96 -0
  925. data/test/performance/lib/performance/json_reporter.rb +15 -0
  926. data/test/performance/lib/performance/platform.rb +37 -0
  927. data/test/performance/lib/performance/reporting.rb +36 -0
  928. data/test/performance/lib/performance/result.rb +104 -0
  929. data/test/performance/lib/performance/runner.rb +221 -0
  930. data/test/performance/lib/performance/table.rb +105 -0
  931. data/test/performance/lib/performance/test_case.rb +152 -0
  932. data/test/performance/lib/performance/timer.rb +40 -0
  933. data/test/performance/lib/performance.rb +38 -0
  934. data/test/performance/script/baselines +102 -0
  935. data/test/performance/script/mega-runner +37 -0
  936. data/test/performance/script/runner +133 -0
  937. data/test/performance/suites/active_record.rb +47 -0
  938. data/test/performance/suites/agent_attributes.rb +62 -0
  939. data/test/performance/suites/config.rb +35 -0
  940. data/test/performance/suites/marshalling.rb +156 -0
  941. data/test/performance/suites/queue_time.rb +21 -0
  942. data/test/performance/suites/rack_middleware.rb +136 -0
  943. data/test/performance/suites/rum_autoinsertion.rb +75 -0
  944. data/test/performance/suites/sql_obfuscation.rb +30 -0
  945. data/test/performance/suites/startup.rb +12 -0
  946. data/test/performance/suites/stats_hash.rb +31 -0
  947. data/test/performance/suites/thread_profiling.rb +116 -0
  948. data/test/performance/suites/trace_execution_scoped.rb +32 -0
  949. data/test/performance/suites/transaction_tracing.rb +106 -0
  950. data/test/script/build_test_gem.sh +57 -0
  951. data/test/script/ci.sh +170 -0
  952. data/test/script/ci_agent-tests_runner.sh +82 -0
  953. data/test/script/ci_bench.sh +52 -0
  954. data/test/script/ci_multiverse_runner.sh +63 -0
  955. data/test/script/path_hash.rb +49 -0
  956. data/test/test_helper.rb +266 -0
  957. data/ui/helpers/developer_mode_helper.rb +324 -0
  958. data/ui/helpers/google_pie_chart.rb +53 -0
  959. data/ui/views/layouts/mmtrix_default.rhtml +48 -0
  960. data/ui/views/mmtrix/_explain_plans.rhtml +27 -0
  961. data/ui/views/mmtrix/_sample.rhtml +20 -0
  962. data/ui/views/mmtrix/_segment.rhtml +28 -0
  963. data/ui/views/mmtrix/_segment_limit_message.rhtml +1 -0
  964. data/ui/views/mmtrix/_segment_row.rhtml +12 -0
  965. data/ui/views/mmtrix/_show_sample_detail.rhtml +24 -0
  966. data/ui/views/mmtrix/_show_sample_sql.rhtml +24 -0
  967. data/ui/views/mmtrix/_show_sample_summary.rhtml +3 -0
  968. data/ui/views/mmtrix/_sql_row.rhtml +16 -0
  969. data/ui/views/mmtrix/_stack_trace.rhtml +15 -0
  970. data/ui/views/mmtrix/_table.rhtml +12 -0
  971. data/ui/views/mmtrix/explain_sql.rhtml +43 -0
  972. data/ui/views/mmtrix/file/images/arrow-close.png +0 -0
  973. data/ui/views/mmtrix/file/images/arrow-open.png +0 -0
  974. data/ui/views/mmtrix/file/images/blue_bar.gif +0 -0
  975. data/ui/views/mmtrix/file/images/file_icon.png +0 -0
  976. data/ui/views/mmtrix/file/images/gray_bar.gif +0 -0
  977. data/ui/views/mmtrix/file/images/mmtrix-rpm-desktop.gif +0 -0
  978. data/ui/views/mmtrix/file/images/mmtrix_rpm_desktop.gif +0 -0
  979. data/ui/views/mmtrix/file/images/textmate.png +0 -0
  980. data/ui/views/mmtrix/file/javascript/jquery-1.4.2.js +6243 -0
  981. data/ui/views/mmtrix/file/javascript/transaction_sample.js +123 -0
  982. data/ui/views/mmtrix/file/stylesheets/style.css +490 -0
  983. data/ui/views/mmtrix/index.rhtml +70 -0
  984. data/ui/views/mmtrix/sample_not_found.rhtml +2 -0
  985. data/ui/views/mmtrix/show_sample.rhtml +81 -0
  986. data/ui/views/mmtrix/threads.rhtml +45 -0
  987. data/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection/version.rb +7 -0
  988. data/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb +122 -0
  989. data/vendor/gems/metric_parser-0.1.0.pre1/.specification +116 -0
  990. data/vendor/gems/metric_parser-0.1.0.pre1/lib/metric_parser.rb +5 -0
  991. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/action_mailer.rb +18 -0
  992. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/active_merchant.rb +35 -0
  993. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/active_record.rb +37 -0
  994. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/apdex.rb +93 -0
  995. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/background_transaction.rb +11 -0
  996. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/client.rb +50 -0
  997. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/controller.rb +71 -0
  998. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/controller_cpu.rb +47 -0
  999. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/controller_ext.rb +21 -0
  1000. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/database.rb +52 -0
  1001. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/database_pool.rb +28 -0
  1002. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/dot_net.rb +32 -0
  1003. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/dot_net_parser.rb +21 -0
  1004. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/errors.rb +15 -0
  1005. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/external.rb +59 -0
  1006. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/frontend.rb +44 -0
  1007. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/gc.rb +24 -0
  1008. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/hibernate_session.rb +11 -0
  1009. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/java.rb +35 -0
  1010. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/java_parser.rb +21 -0
  1011. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/jsp.rb +38 -0
  1012. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/jsp_tag.rb +11 -0
  1013. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/mem_cache.rb +59 -0
  1014. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/metric_parser.rb +138 -0
  1015. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/middleware.rb +34 -0
  1016. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/nested.rb +24 -0
  1017. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/orm.rb +31 -0
  1018. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/other_transaction.rb +44 -0
  1019. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/servlet.rb +11 -0
  1020. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/servlet_context_listener.rb +11 -0
  1021. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/servlet_filter.rb +11 -0
  1022. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/servlet_init.rb +11 -0
  1023. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/solr.rb +31 -0
  1024. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/solr_request_handler.rb +19 -0
  1025. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/spring.rb +58 -0
  1026. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/spring_controller.rb +10 -0
  1027. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/spring_view.rb +10 -0
  1028. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/struts_action.rb +24 -0
  1029. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/struts_result.rb +24 -0
  1030. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/version.rb +9 -0
  1031. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/view.rb +74 -0
  1032. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/web_frontend.rb +22 -0
  1033. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/web_service.rb +18 -0
  1034. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser/web_transaction.rb +137 -0
  1035. data/vendor/gems/metric_parser-0.1.0.pre1/lib/mmtrix/metric_parser.rb +70 -0
  1036. metadata +1263 -0
@@ -0,0 +1,317 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under Mmtrix's license terms.
3
+ # See https://github.com/mmtrix/rpm/blob/master/LICENSE for complete details.
4
+
5
+ require 'mmtrix/agent/transaction_sample_builder'
6
+ require 'mmtrix/agent/transaction/developer_mode_sample_buffer'
7
+ require 'mmtrix/agent/transaction/slowest_sample_buffer'
8
+ require 'mmtrix/agent/transaction/synthetics_sample_buffer'
9
+ require 'mmtrix/agent/transaction/xray_sample_buffer'
10
+
11
+ module Mmtrix
12
+ module Agent
13
+
14
+ # This class contains the logic for recording and storing transaction
15
+ # traces (sometimes referred to as 'transaction samples').
16
+ #
17
+ # A transaction trace is a detailed timeline of the events that happened
18
+ # during the processing of a single transaction, including database calls,
19
+ # template rendering calls, and other instrumented method calls.
20
+ #
21
+ # @api public
22
+ class TransactionSampler
23
+ attr_reader :last_sample, :dev_mode_sample_buffer, :xray_sample_buffer
24
+
25
+ def initialize
26
+ @dev_mode_sample_buffer = Mmtrix::Agent::Transaction::DeveloperModeSampleBuffer.new
27
+ @xray_sample_buffer = Mmtrix::Agent::Transaction::XraySampleBuffer.new
28
+
29
+ @sample_buffers = []
30
+ @sample_buffers << @dev_mode_sample_buffer
31
+ @sample_buffers << @xray_sample_buffer
32
+ @sample_buffers << Mmtrix::Agent::Transaction::SlowestSampleBuffer.new
33
+ @sample_buffers << Mmtrix::Agent::Transaction::SyntheticsSampleBuffer.new
34
+
35
+ # This lock is used to synchronize access to the @last_sample
36
+ # and related variables. It can become necessary on JRuby or
37
+ # any 'honest-to-god'-multithreaded system
38
+ @samples_lock = Mutex.new
39
+
40
+ Agent.config.register_callback(:'transaction_tracer.enabled') do |enabled|
41
+ if enabled
42
+ threshold = Agent.config[:'transaction_tracer.transaction_threshold']
43
+ ::Mmtrix::Agent.logger.debug "Transaction tracing threshold is #{threshold} seconds."
44
+ else
45
+ ::Mmtrix::Agent.logger.debug "Transaction traces will not be sent to the Mmtrix service."
46
+ end
47
+ end
48
+
49
+ Agent.config.register_callback(:'transaction_tracer.record_sql') do |config|
50
+ if config == 'raw'
51
+ ::Mmtrix::Agent.logger.warn("Agent is configured to send raw SQL to the service")
52
+ end
53
+ end
54
+ end
55
+
56
+ def enabled?
57
+ Agent.config[:'transaction_tracer.enabled'] || Agent.config[:developer_mode]
58
+ end
59
+
60
+ def on_start_transaction(state, start_time)
61
+ if enabled?
62
+ start_builder(state, start_time.to_f)
63
+ end
64
+ end
65
+
66
+ # This delegates to the builder to create a new open transaction node
67
+ # for the frame, beginning at the optionally specified time.
68
+ #
69
+ # Note that in developer mode, this captures a stacktrace for
70
+ # the beginning of each node, which can be fairly slow
71
+ def notice_push_frame(state, time=Time.now)
72
+ builder = state.transaction_sample_builder
73
+ return unless builder
74
+
75
+ node = builder.trace_entry(time.to_f)
76
+ if @dev_mode_sample_buffer
77
+ @dev_mode_sample_buffer.visit_node(node)
78
+ end
79
+ node
80
+ end
81
+
82
+ # Informs the transaction sample builder about the end of a traced frame
83
+ def notice_pop_frame(state, frame, time = Time.now)
84
+ builder = state.transaction_sample_builder
85
+ return unless builder
86
+ raise "finished already???" if builder.sample.finished
87
+ builder.trace_exit(frame, time.to_f)
88
+ end
89
+
90
+ # This is called when we are done with the transaction. We've
91
+ # unwound the stack to the top level. It also clears the
92
+ # transaction sample builder so that it won't continue to have
93
+ # frames appended to it.
94
+ #
95
+ # It sets various instance variables to the finished sample,
96
+ # depending on which settings are active. See `store_sample`
97
+ def on_finishing_transaction(state, txn, time=Time.now)
98
+ last_builder = state.transaction_sample_builder
99
+ return unless last_builder && enabled?
100
+
101
+ state.transaction_sample_builder = nil
102
+ return if txn.ignore_trace?
103
+
104
+ last_builder.finish_trace(time.to_f)
105
+
106
+ last_sample = last_builder.sample
107
+ last_sample.transaction_name = txn.best_name
108
+ last_sample.uri = txn.request_path
109
+ last_sample.guid = txn.guid
110
+ last_sample.attributes = txn.attributes
111
+
112
+ @samples_lock.synchronize do
113
+ @last_sample = last_sample
114
+ store_sample(@last_sample)
115
+ @last_sample
116
+ end
117
+ end
118
+
119
+ def store_sample(sample)
120
+ @sample_buffers.each do |sample_buffer|
121
+ sample_buffer.store(sample)
122
+ end
123
+ end
124
+
125
+ MAX_DATA_LENGTH = 16384
126
+ # This method is used to record metadata into the currently
127
+ # active node like a sql query, memcache key, or Net::HTTP uri
128
+ #
129
+ # duration is seconds, float value.
130
+ def notice_extra_data(builder, message, duration, key)
131
+ return unless builder
132
+ node = builder.current_node
133
+ if node
134
+ if key == :sql
135
+ sql = node[:sql]
136
+ if(sql && !sql.empty?)
137
+ sql = self.class.truncate_message(sql << "\n#{message}") if sql.length <= MAX_DATA_LENGTH
138
+ else
139
+ # message is expected to have been pre-truncated by notice_sql
140
+ node[:sql] = message
141
+ end
142
+ else
143
+ node[key] = self.class.truncate_message(message)
144
+ end
145
+ append_backtrace(node, duration)
146
+ end
147
+ end
148
+
149
+ private :notice_extra_data
150
+
151
+ # Truncates the message to `MAX_DATA_LENGTH` if needed, and
152
+ # appends an ellipsis because it makes the trucation clearer in
153
+ # the UI
154
+ def self.truncate_message(message)
155
+ if message.length > (MAX_DATA_LENGTH - 4)
156
+ message.slice!(MAX_DATA_LENGTH - 4..message.length)
157
+ message << "..."
158
+ else
159
+ message
160
+ end
161
+ end
162
+
163
+ # Appends a backtrace to a node if that node took longer
164
+ # than the specified duration
165
+ def append_backtrace(node, duration)
166
+ if duration >= Agent.config[:'transaction_tracer.stack_trace_threshold']
167
+ node[:backtrace] = caller.join("\n")
168
+ end
169
+ end
170
+
171
+ # Attaches an SQL query on the current transaction trace node.
172
+ #
173
+ # This method should be used only by gem authors wishing to extend
174
+ # the Ruby agent to instrument new database interfaces - it should
175
+ # generally not be called directly from application code.
176
+ #
177
+ # @param sql [String] the SQL query being recorded
178
+ # @param config [Object] the driver configuration for the connection
179
+ # @param duration [Float] number of seconds the query took to execute
180
+ # @param explainer [Proc] for internal use only - 3rd-party clients must
181
+ # not pass this parameter.
182
+ #
183
+ # @api public
184
+ # @deprecated Use {Datastores.notice_sql} instead.
185
+ #
186
+ def notice_sql(sql, config, duration, state=nil, explainer=nil) #THREAD_LOCAL_ACCESS sometimes
187
+ # some statements (particularly INSERTS with large BLOBS
188
+ # may be very large; we should trim them to a maximum usable length
189
+ state ||= TransactionState.tl_get
190
+ builder = state.transaction_sample_builder
191
+ if state.is_sql_recorded?
192
+ statement = build_database_statement(sql, config, explainer)
193
+ notice_extra_data(builder, statement, duration, :sql)
194
+ end
195
+ end
196
+
197
+ def build_database_statement(sql, config, explainer)
198
+ statement = Database::Statement.new(Database.capture_query(sql))
199
+ if config
200
+ statement.adapter = config[:adapter]
201
+ statement.config = config
202
+ end
203
+ statement.explainer = explainer
204
+
205
+ statement
206
+ end
207
+
208
+ # Attaches an additional non-SQL query parameter to the current
209
+ # transaction trace node.
210
+ #
211
+ # This may be used for recording a query against a key-value store like
212
+ # memcached or redis.
213
+ #
214
+ # This method should be used only by gem authors wishing to extend
215
+ # the Ruby agent to instrument uninstrumented key-value stores - it should
216
+ # generally not be called directly from application code.
217
+ #
218
+ # @param key [String] the name of the key that was queried
219
+ # @param duration [Float] number of seconds the query took to execute
220
+ #
221
+ # @api public
222
+ # @deprecated Use {Datastores.notice_statement} instead.
223
+ #
224
+ def notice_nosql(key, duration) #THREAD_LOCAL_ACCESS
225
+ builder = tl_builder
226
+ notice_extra_data(builder, key, duration, :key)
227
+ end
228
+
229
+ def notice_nosql_statement(statement, duration) #THREAD_LOCAL_ACCESS
230
+ builder = tl_builder
231
+ notice_extra_data(builder, statement, duration, :statement)
232
+ end
233
+
234
+ # Set parameters on the current node.
235
+ def add_node_parameters(params) #THREAD_LOCAL_ACCESS
236
+ builder = tl_builder
237
+ return unless builder
238
+ params.each { |k,v| builder.current_node[k] = v }
239
+ end
240
+
241
+ # Gather transaction traces that we'd like to transmit to the server.
242
+ def harvest!
243
+ return [] unless enabled?
244
+
245
+ samples = @samples_lock.synchronize do
246
+ @last_sample = nil
247
+ harvest_from_sample_buffers
248
+ end
249
+ prepare_samples(samples)
250
+ end
251
+
252
+ def prepare_samples(samples)
253
+ samples.select do |sample|
254
+ begin
255
+ sample.prepare_to_send!
256
+ rescue => e
257
+ Mmtrix::Agent.logger.error("Failed to prepare transaction trace. Error: ", e)
258
+ false
259
+ else
260
+ true
261
+ end
262
+ end
263
+ end
264
+
265
+ def merge!(previous)
266
+ @samples_lock.synchronize do
267
+ @sample_buffers.each do |buffer|
268
+ buffer.store_previous(previous)
269
+ end
270
+ end
271
+ end
272
+
273
+ def count
274
+ @samples_lock.synchronize do
275
+ samples = @sample_buffers.inject([]) { |all, b| all.concat(b.samples) }
276
+ samples.uniq.size
277
+ end
278
+ end
279
+
280
+ def harvest_from_sample_buffers
281
+ # map + flatten hit mocking issues calling to_ary on 1.9.2. We only
282
+ # want a single level flatten anyway, but, as you probably already
283
+ # know, Ruby 1.8.6 :/
284
+ result = []
285
+ @sample_buffers.each { |buffer| result.concat(buffer.harvest_samples) }
286
+ result.uniq
287
+ end
288
+
289
+ # reset samples without rebooting the web server (used by dev mode)
290
+ def reset!
291
+ @samples_lock.synchronize do
292
+ @last_sample = nil
293
+ @sample_buffers.each { |sample_buffer| sample_buffer.reset! }
294
+ end
295
+ end
296
+
297
+ # Checks to see if the transaction sampler is disabled, if
298
+ # transaction trace recording is disabled by a thread local, or
299
+ # if execution is untraced - if so it clears the transaction
300
+ # sample builder from the thread local, otherwise it generates a
301
+ # new transaction sample builder with the stated time as a
302
+ # starting point and saves it in the thread local variable
303
+ def start_builder(state, time=nil)
304
+ if !enabled? || !state.is_transaction_traced? || !state.is_execution_traced?
305
+ state.transaction_sample_builder = nil
306
+ else
307
+ state.transaction_sample_builder ||= TransactionSampleBuilder.new(time)
308
+ end
309
+ end
310
+
311
+ # The current thread-local transaction sample builder
312
+ def tl_builder
313
+ TransactionState.tl_get.transaction_sample_builder
314
+ end
315
+ end
316
+ end
317
+ end
@@ -0,0 +1,153 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under Mmtrix's license terms.
3
+ # See https://github.com/mmtrix/rpm/blob/master/LICENSE for complete details.
4
+
5
+ require 'mmtrix/agent/traced_method_stack'
6
+
7
+ module Mmtrix
8
+ module Agent
9
+
10
+ # This is THE location to store thread local information during a transaction
11
+ # Need a new piece of data? Add a method here, NOT a new thread local variable.
12
+ class TransactionState
13
+ def self.tl_get
14
+ tl_state_for(Thread.current)
15
+ end
16
+
17
+ # This method should only be used by TransactionState for access to the
18
+ # current thread's state or to provide read-only accessors for other threads
19
+ #
20
+ # If ever exposed, this requires additional synchronization
21
+ def self.tl_state_for(thread)
22
+ state = thread[:mmtrix_transaction_state]
23
+
24
+ if state.nil?
25
+ state = TransactionState.new
26
+ thread[:mmtrix_transaction_state] = state
27
+ end
28
+
29
+ state
30
+ end
31
+
32
+ def self.tl_clear_for_testing
33
+ Thread.current[:mmtrix_transaction_state] = nil
34
+ end
35
+
36
+ def initialize
37
+ @untraced = []
38
+ @traced_method_stack = TracedMethodStack.new
39
+ @current_transaction = nil
40
+ end
41
+
42
+ # This starts the timer for the transaction.
43
+ def reset(transaction=nil)
44
+ # We purposefully don't reset @untraced, @record_tt and @record_sql
45
+ # since those are managed by Mmtrix::Agent.disable_* calls explicitly
46
+ # and (more importantly) outside the scope of a transaction
47
+
48
+ @timings = nil
49
+ @request = nil
50
+ @current_transaction = transaction
51
+
52
+ @traced_method_stack.clear
53
+
54
+ @is_cross_app_caller = false
55
+ @client_cross_app_id = nil
56
+ @referring_transaction_info = nil
57
+
58
+ @transaction_sample_builder = nil
59
+ @sql_sampler_transaction_data = nil
60
+
61
+ @busy_entries = 0
62
+ end
63
+
64
+ def timings
65
+ @timings ||= TransactionTimings.new(transaction_queue_time, transaction_start_time, transaction_name)
66
+ end
67
+
68
+ # Cross app tracing
69
+ # Because we need values from headers before the transaction actually starts
70
+ attr_accessor :client_cross_app_id, :referring_transaction_info, :is_cross_app_caller
71
+
72
+ def is_cross_app_caller?
73
+ @is_cross_app_caller
74
+ end
75
+
76
+ def is_cross_app_callee?
77
+ referring_transaction_info != nil
78
+ end
79
+
80
+ def is_cross_app?
81
+ is_cross_app_caller? || is_cross_app_callee?
82
+ end
83
+
84
+ # Request data
85
+ attr_accessor :request
86
+
87
+ def request_guid
88
+ return nil unless current_transaction
89
+ current_transaction.guid
90
+ end
91
+
92
+ # Current transaction stack and sample building
93
+ attr_reader :current_transaction
94
+ attr_accessor :transaction_sample_builder
95
+
96
+ def transaction_start_time
97
+ current_transaction.start_time if current_transaction
98
+ end
99
+
100
+ def transaction_queue_time
101
+ current_transaction.nil? ? 0.0 : current_transaction.queue_time
102
+ end
103
+
104
+ def transaction_name
105
+ current_transaction.nil? ? nil : current_transaction.best_name
106
+ end
107
+
108
+ def in_background_transaction?
109
+ !current_transaction.nil? && !current_transaction.recording_web_transaction?
110
+ end
111
+
112
+ def in_web_transaction?
113
+ !current_transaction.nil? && current_transaction.recording_web_transaction?
114
+ end
115
+
116
+ # Execution tracing on current thread
117
+ attr_accessor :untraced
118
+
119
+ def push_traced(should_trace)
120
+ @untraced << should_trace
121
+ end
122
+
123
+ def pop_traced
124
+ @untraced.pop if @untraced
125
+ end
126
+
127
+ def is_execution_traced?
128
+ @untraced.nil? || @untraced.last != false
129
+ end
130
+
131
+ # TT's and SQL
132
+ attr_accessor :record_tt, :record_sql
133
+
134
+ def is_transaction_traced?
135
+ @record_tt != false
136
+ end
137
+
138
+ def is_sql_recorded?
139
+ @record_sql != false
140
+ end
141
+
142
+ # Busy calculator
143
+ attr_accessor :busy_entries
144
+
145
+ # Sql Sampler Transaction Data
146
+ attr_accessor :sql_sampler_transaction_data
147
+
148
+ # Scope stack tracking from Mmtrix::StatsEngine::Transactions
149
+ # Should not be nil--this class manages its initialization and resetting
150
+ attr_reader :traced_method_stack
151
+ end
152
+ end
153
+ end
@@ -0,0 +1,57 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under Mmtrix's license terms.
3
+ # See https://github.com/mmtrix/rpm/blob/master/LICENSE for complete details.
4
+
5
+ module Mmtrix
6
+ module Agent
7
+ class TransactionTimings
8
+
9
+ def initialize(queue_time_in_seconds, start_time_in_seconds, transaction_name)
10
+ @now = Time.now.to_f
11
+ @queue_time_in_seconds = clamp_to_positive(queue_time_in_seconds.to_f)
12
+ @start_time_in_seconds = clamp_to_positive(start_time_in_seconds.to_f)
13
+
14
+ @transaction_name = transaction_name
15
+ end
16
+
17
+ attr_reader :transaction_name,
18
+ :start_time_in_seconds, :queue_time_in_seconds
19
+
20
+ def transaction_name_or_unknown
21
+ transaction_name || ::Mmtrix::Agent::UNKNOWN_METRIC
22
+ end
23
+
24
+ def start_time_as_time
25
+ Time.at(@start_time_in_seconds)
26
+ end
27
+
28
+ def start_time_in_millis
29
+ convert_to_milliseconds(@start_time_in_seconds)
30
+ end
31
+
32
+ def queue_time_in_millis
33
+ convert_to_milliseconds(queue_time_in_seconds)
34
+ end
35
+
36
+ def app_time_in_millis
37
+ convert_to_milliseconds(app_time_in_seconds)
38
+ end
39
+
40
+ def app_time_in_seconds
41
+ @now - @start_time_in_seconds
42
+ end
43
+
44
+ # Helpers
45
+
46
+ def convert_to_milliseconds(value_in_seconds)
47
+ clamp_to_positive((value_in_seconds.to_f * 1000.0).round)
48
+ end
49
+
50
+ def clamp_to_positive(value)
51
+ return 0.0 if value < 0.0
52
+ value
53
+ end
54
+
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,64 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under Mmtrix's license terms.
3
+ # See https://github.com/mmtrix/rpm/blob/master/LICENSE for complete details.
4
+
5
+ require 'mmtrix/agent/aws_info'
6
+
7
+ module Mmtrix
8
+ module Agent
9
+ class UtilizationData
10
+ METADATA_VERSION = 1
11
+
12
+ def hostname
13
+ Mmtrix::Agent::Hostname.get
14
+ end
15
+
16
+ def container_id
17
+ ::Mmtrix::Agent::SystemInfo.docker_container_id
18
+ end
19
+
20
+ def cpu_count
21
+ ::Mmtrix::Agent::SystemInfo.clear_processor_info
22
+ ::Mmtrix::Agent::SystemInfo.num_logical_processors
23
+ end
24
+
25
+ def ram_in_mib
26
+ ::Mmtrix::Agent::SystemInfo.ram_in_mib
27
+ end
28
+
29
+ def to_collector_hash
30
+ result = {
31
+ :metadata_version => METADATA_VERSION,
32
+ :logical_processors => cpu_count,
33
+ :total_ram_mib => ram_in_mib,
34
+ :hostname => hostname
35
+ }
36
+
37
+ append_aws_info(result)
38
+ append_docker_info(result)
39
+
40
+ result
41
+ end
42
+
43
+ def append_aws_info(collector_hash)
44
+ return unless Agent.config[:'utilization.detect_aws']
45
+
46
+ aws_info = AWSInfo.new
47
+
48
+ if aws_info.loaded?
49
+ collector_hash[:vendors] ||= {}
50
+ collector_hash[:vendors][:aws] = aws_info.to_collector_hash
51
+ end
52
+ end
53
+
54
+ def append_docker_info(collector_hash)
55
+ return unless Agent.config[:'utilization.detect_docker']
56
+
57
+ if docker_container_id = container_id
58
+ collector_hash[:vendors] ||= {}
59
+ collector_hash[:vendors][:docker] = {:id => docker_container_id}
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,40 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under Mmtrix's license terms.
3
+ # See https://github.com/mmtrix/rpm/blob/master/LICENSE for complete details.
4
+
5
+ require 'thread'
6
+ require 'mmtrix/agent/vm/snapshot'
7
+
8
+ module Mmtrix
9
+ module Agent
10
+ module VM
11
+ class JRubyVM
12
+ def snapshot
13
+ snap = Snapshot.new
14
+ gather_stats(snap)
15
+ snap
16
+ end
17
+
18
+ def gather_stats(snap)
19
+ if supports?(:gc_runs)
20
+ gc_stats = GC.stat
21
+ snap.gc_runs = gc_stats[:count]
22
+ end
23
+
24
+ snap.thread_count = Thread.list.size
25
+ end
26
+
27
+ def supports?(key)
28
+ case key
29
+ when :gc_runs
30
+ RUBY_VERSION >= "1.9.2"
31
+ when :thread_count
32
+ true
33
+ else
34
+ false
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,45 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under Mmtrix's license terms.
3
+ # See https://github.com/mmtrix/rpm/blob/master/LICENSE for complete details.
4
+
5
+ # The GC::Profiler class available on MRI has to be reset periodically to avoid
6
+ # memory "leaking" in the underlying implementation. However, it's a major
7
+ # bummer for how we want to gather those statistics.
8
+ #
9
+ # This class comes to the rescue. It relies on being the only party to reset
10
+ # the underlying GC::Profiler, but otherwise gives us a steadily increasing
11
+ # total time.
12
+
13
+ module Mmtrix
14
+ module Agent
15
+ module VM
16
+ class MonotonicGCProfiler
17
+ def initialize
18
+ @total_time_s = 0
19
+ @lock = Mutex.new
20
+ end
21
+
22
+ def total_time_s
23
+ if Mmtrix::LanguageSupport.gc_profiler_enabled?
24
+ # There's a race here if the next two lines don't execute as an atomic
25
+ # unit - we may end up double-counting some GC time in that scenario.
26
+ # Locking around them guarantees atomicity of the read/increment/reset
27
+ # sequence.
28
+ @lock.synchronize do
29
+ # The Ruby 1.9.x docs claim that GC::Profiler.total_time returns
30
+ # a value in milliseconds. They are incorrect - both 1.9.x and 2.x
31
+ # return values in seconds.
32
+ @total_time_s += ::GC::Profiler.total_time
33
+ ::GC::Profiler.clear
34
+ end
35
+ else
36
+ Mmtrix::Agent.logger.log_once(:warn, :gc_profiler_disabled,
37
+ "Tried to measure GC time, but GC::Profiler was not enabled.")
38
+ end
39
+
40
+ @total_time_s
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end