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,90 @@
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 AWSInfo
8
+
9
+ class ResponseError < StandardError; end
10
+
11
+ attr_reader :instance_type, :instance_id, :availability_zone
12
+
13
+ def initialize
14
+ handle_remote_calls do
15
+ @instance_type = remote_fetch('instance-type')
16
+ @instance_id = remote_fetch('instance-id')
17
+ @availability_zone = remote_fetch('placement/availability-zone')
18
+ end
19
+ end
20
+
21
+ def loaded?
22
+ instance_type && instance_id && availability_zone
23
+ end
24
+
25
+ def to_collector_hash
26
+ {
27
+ :id => instance_id,
28
+ :type => instance_type,
29
+ :zone => availability_zone
30
+ }
31
+ end
32
+
33
+ private
34
+
35
+ def reset
36
+ @instance_type = @instance_id = @availability_zone = nil
37
+ end
38
+
39
+ REMOTE_DATA_VALID_CHARS = /^[0-9a-zA-Z_ .\/-]$/.freeze
40
+ INSTANCE_HOST = '169.254.169.254'
41
+ API_VERSION = '2008-02-01'
42
+
43
+ def remote_fetch(remote_key)
44
+ uri = URI("http://#{INSTANCE_HOST}/#{API_VERSION}/meta-data/#{remote_key}")
45
+ response = Net::HTTP::get(uri)
46
+
47
+ data = filter_remote_data(response)
48
+
49
+ unless data
50
+ Mmtrix::Agent.increment_metric('Supportability/utilization/aws/error')
51
+ raise ResponseError, "Fetching instance metadata for #{remote_key.inspect} returned invalid data: #{response.inspect}"
52
+ end
53
+
54
+ data
55
+ end
56
+
57
+ def handle_remote_calls
58
+ begin
59
+ Timeout::timeout(1) do
60
+ yield
61
+ end
62
+ rescue Timeout::Error
63
+ handle_error "UtilizationData timed out fetching remote keys."
64
+ rescue StandardError => e
65
+ handle_error "UtilizationData encountered error fetching remote keys", e
66
+ end
67
+ end
68
+
69
+ def handle_error(*messages)
70
+ Mmtrix::Agent.logger.debug(*messages)
71
+ reset
72
+ end
73
+
74
+ def filter_remote_data(data_str)
75
+ return nil unless data_str.kind_of?(String)
76
+ return nil unless data_str.bytesize <= 255
77
+
78
+ data_str.each_char do |ch|
79
+ next if ch =~ REMOTE_DATA_VALID_CHARS
80
+ code_point = ch[0].ord # this works in Ruby 1.8.7 - 2.1.2
81
+ next if code_point >= 0x80
82
+
83
+ return nil # it's in neither set of valid characters
84
+ end
85
+
86
+ data_str
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,117 @@
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_state'
6
+
7
+ module Mmtrix
8
+ module Agent
9
+ # This module supports calculation of actual time spent processing requests over the course of
10
+ # one harvest period. It's similar to what you would get if you just added up all the
11
+ # execution times of controller calls, however that will be inaccurate when requests
12
+ # span the minute boundaries. This module manages accounting of requests not yet
13
+ # completed.
14
+ #
15
+ # Calls are re-entrant. All start calls must be paired with finish
16
+ # calls, or a reset call.
17
+ module BusyCalculator
18
+
19
+ extend self
20
+
21
+ # For testability, add accessors:
22
+ attr_reader :harvest_start, :accumulator
23
+
24
+ # sets up busy calculations based on the start and end of
25
+ # transactions - used for a rough estimate of what percentage of
26
+ # wall clock time is spent processing requests
27
+ def dispatcher_start(time) #THREAD_LOCAL_ACCESS
28
+ state = TransactionState.tl_get
29
+ state.busy_entries ||= 0
30
+ callers = state.busy_entries += 1
31
+ return if callers > 1
32
+ @lock.synchronize do
33
+ @entrypoint_stack.push time
34
+ end
35
+ end
36
+
37
+ # called when a transaction finishes, to add time to the
38
+ # instance variable accumulator. this is harvested when we send
39
+ # data to the server
40
+ def dispatcher_finish(end_time = nil) #THREAD_LOCAL_ACCESS
41
+ state = TransactionState.tl_get
42
+ # If #dispatcher_start hasn't been called at least once, abort early
43
+ return unless state.busy_entries
44
+
45
+ end_time ||= time_now
46
+ callers = state.busy_entries -= 1
47
+
48
+ # Ignore nested calls
49
+ return if callers > 0
50
+
51
+ @lock.synchronize do
52
+ if @entrypoint_stack.empty?
53
+ ::Mmtrix::Agent.logger.warn("Stack underflow tracking dispatcher entry and exit!\n #{caller.join(" \n")}")
54
+ else
55
+ @accumulator += (end_time - @entrypoint_stack.pop).to_f
56
+ end
57
+ end
58
+ end
59
+
60
+ # this returns the size of the entry point stack, which
61
+ # determines how many transactions are running
62
+ def busy_count
63
+ @entrypoint_stack.size
64
+ end
65
+
66
+ # Reset the state of the information accumulated by all threads,
67
+ # but only reset the recursion counter for this thread.
68
+ def reset #THREAD_LOCAL_ACCESS
69
+ @entrypoint_stack = []
70
+ TransactionState.tl_get.busy_entries = 0
71
+ @lock ||= Mutex.new
72
+ @accumulator = 0
73
+ @harvest_start = time_now
74
+ end
75
+
76
+
77
+ # Called before uploading to to the server to collect current busy stats.
78
+ def harvest_busy
79
+ busy = 0
80
+ t0 = time_now
81
+ @lock.synchronize do
82
+ busy = accumulator
83
+ @accumulator = 0
84
+
85
+ # Walk through the stack and capture all times up to
86
+ # now for entrypoints
87
+ @entrypoint_stack.size.times do |frame|
88
+ busy += (t0 - @entrypoint_stack[frame]).to_f
89
+ @entrypoint_stack[frame] = t0
90
+ end
91
+
92
+ end
93
+
94
+ busy = 0.0 if busy < 0.0 # don't go below 0%
95
+
96
+ time_window = (t0 - harvest_start).to_f
97
+ time_window = 1.0 if time_window == 0.0 # protect against divide by zero
98
+
99
+ busy = busy / time_window
100
+
101
+ if Agent.config[:report_instance_busy]
102
+ Mmtrix::Agent.record_metric('Instance/Busy', busy)
103
+ end
104
+ @harvest_start = t0
105
+ end
106
+
107
+ private
108
+
109
+ # so we can stub Time.now only for the BusyCalculator in tests
110
+ def time_now
111
+ Time.now
112
+ end
113
+
114
+ self.reset
115
+ end
116
+ end
117
+ end
@@ -0,0 +1,17 @@
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
+ # This class is used by Mmtrix::Agent.set_sql_obfuscator to chain multiple
6
+ # obfuscation blocks when not using the default :replace action
7
+ class Mmtrix::ChainedCall
8
+ def initialize(block1, block2)
9
+ @block1 = block1
10
+ @block2 = block2
11
+ end
12
+
13
+ def call(sql)
14
+ sql = @block1.call(sql)
15
+ @block2.call(sql)
16
+ end
17
+ end
@@ -0,0 +1,19 @@
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
+ module Commands
8
+ class AgentCommand
9
+ attr_reader :id, :name, :arguments
10
+
11
+ def initialize(raw_collector_command)
12
+ @id = raw_collector_command[0]
13
+ @name = raw_collector_command[1]["name"]
14
+ @arguments = raw_collector_command[1]["arguments"]
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,160 @@
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
+ # This class is the central point for dispatching get_agent_commands messages
6
+ # to the various components that actually process them.
7
+ #
8
+ # This could be evented further, but we eventually need direct access to things
9
+ # like the ThreadProfiler, so it's simpler to just keep it together here.
10
+
11
+ require 'mmtrix/agent/commands/agent_command'
12
+ require 'mmtrix/agent/commands/xray_session_collection'
13
+ require 'mmtrix/agent/threading/backtrace_service'
14
+
15
+ module Mmtrix
16
+ module Agent
17
+ module Commands
18
+ class AgentCommandRouter
19
+ attr_reader :handlers
20
+
21
+ attr_accessor :thread_profiler_session, :backtrace_service,
22
+ :xray_session_collection
23
+
24
+ def initialize(event_listener=nil)
25
+ @handlers = Hash.new { |*| Proc.new { |cmd| self.unrecognized_agent_command(cmd) } }
26
+
27
+ @backtrace_service = Threading::BacktraceService.new(event_listener)
28
+
29
+ @thread_profiler_session = ThreadProfilerSession.new(@backtrace_service)
30
+ @xray_session_collection = XraySessionCollection.new(@backtrace_service, event_listener)
31
+
32
+ @handlers['start_profiler'] = Proc.new { |cmd| thread_profiler_session.handle_start_command(cmd) }
33
+ @handlers['stop_profiler'] = Proc.new { |cmd| thread_profiler_session.handle_stop_command(cmd) }
34
+ @handlers['active_xray_sessions'] = Proc.new { |cmd| xray_session_collection.handle_active_xray_sessions(cmd) }
35
+
36
+ if event_listener
37
+ event_listener.subscribe(:before_shutdown, &method(:on_before_shutdown))
38
+ end
39
+ end
40
+
41
+ def mmtrix_service
42
+ Mmtrix::Agent.instance.service
43
+ end
44
+
45
+ def check_for_and_handle_agent_commands
46
+ commands = get_agent_commands
47
+
48
+ stop_xray_sessions unless active_xray_command?(commands)
49
+
50
+ results = invoke_commands(commands)
51
+ mmtrix_service.agent_command_results(results) unless results.empty?
52
+ end
53
+
54
+ def stop_xray_sessions
55
+ self.xray_session_collection.stop_all_sessions
56
+ end
57
+
58
+ def active_xray_command?(commands)
59
+ commands.any? {|command| command.name == 'active_xray_sessions'}
60
+ end
61
+
62
+ def on_before_shutdown(*args)
63
+ if self.thread_profiler_session.running?
64
+ self.thread_profiler_session.stop(true)
65
+ end
66
+ end
67
+
68
+ def harvest!
69
+ profiles = []
70
+ profiles += harvest_from_xray_session_collection
71
+ profiles += harvest_from_thread_profiler_session
72
+ log_profiles(profiles)
73
+ profiles
74
+ end
75
+
76
+ # We don't currently support merging thread profiles that failed to send
77
+ # back into the AgentCommandRouter, so we just no-op this method.
78
+ # Same with reset! - we don't support asynchronous cancellation of a
79
+ # running thread profile or X-Ray session currently.
80
+ def merge!(*args); end
81
+ def reset!; end
82
+
83
+ def harvest_from_xray_session_collection
84
+ self.xray_session_collection.harvest_thread_profiles
85
+ end
86
+
87
+ def harvest_from_thread_profiler_session
88
+ if self.thread_profiler_session.ready_to_harvest?
89
+ self.thread_profiler_session.stop(true)
90
+ [self.thread_profiler_session.harvest]
91
+ else
92
+ []
93
+ end
94
+ end
95
+
96
+ def log_profiles(profiles)
97
+ if profiles.empty?
98
+ ::Mmtrix::Agent.logger.debug "No thread profiles with data found to send."
99
+ else
100
+ profile_descriptions = profiles.map { |p| p.to_log_description }
101
+ ::Mmtrix::Agent.logger.debug "Sending thread profiles [#{profile_descriptions.join(", ")}]"
102
+ end
103
+ end
104
+
105
+ def get_agent_commands
106
+ commands = mmtrix_service.get_agent_commands
107
+ Mmtrix::Agent.logger.debug "Received get_agent_commands = #{commands.inspect}"
108
+ commands.map {|collector_command| AgentCommand.new(collector_command)}
109
+ end
110
+
111
+ def invoke_commands(agent_commands)
112
+ results = {}
113
+
114
+ agent_commands.each do |agent_command|
115
+ results[agent_command.id.to_s] = invoke_command(agent_command)
116
+ end
117
+
118
+ results
119
+ end
120
+
121
+ class AgentCommandError < StandardError
122
+ end
123
+
124
+ def invoke_command(agent_command)
125
+ begin
126
+ call_handler_for(agent_command)
127
+ return success
128
+ rescue AgentCommandError => e
129
+ Mmtrix::Agent.logger.debug(e)
130
+ error(e)
131
+ end
132
+ end
133
+
134
+ SUCCESS_RESULT = {}.freeze
135
+ ERROR_KEY = "error"
136
+
137
+ def success
138
+ SUCCESS_RESULT
139
+ end
140
+
141
+ def error(err)
142
+ { ERROR_KEY => err.message }
143
+ end
144
+
145
+ def call_handler_for(agent_command)
146
+ handler = select_handler(agent_command)
147
+ handler.call(agent_command)
148
+ end
149
+
150
+ def select_handler(agent_command)
151
+ @handlers[agent_command.name]
152
+ end
153
+
154
+ def unrecognized_agent_command(agent_command)
155
+ Mmtrix::Agent.logger.debug("Unrecognized agent command #{agent_command.inspect}")
156
+ end
157
+ end
158
+ end
159
+ end
160
+ end
@@ -0,0 +1,110 @@
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/threading/agent_thread'
6
+ require 'mmtrix/agent/threading/backtrace_service'
7
+ require 'mmtrix/agent/threading/thread_profile'
8
+
9
+ module Mmtrix
10
+ module Agent
11
+ module Commands
12
+
13
+ class ThreadProfilerSession
14
+
15
+ def initialize(backtrace_service)
16
+ @backtrace_service = backtrace_service
17
+ end
18
+
19
+ def handle_start_command(agent_command)
20
+ raise_unsupported_error unless Mmtrix::Agent::Threading::BacktraceService.is_supported?
21
+ raise_thread_profiler_disabled unless enabled?
22
+ raise_already_started_error if running?
23
+ start(agent_command)
24
+ end
25
+
26
+ def handle_stop_command(agent_command)
27
+ report_data = agent_command.arguments.fetch("report_data", true)
28
+ stop(report_data)
29
+ end
30
+
31
+ def start(agent_command)
32
+ Mmtrix::Agent.logger.debug("Starting Thread Profiler.")
33
+ profile = @backtrace_service.subscribe(
34
+ Mmtrix::Agent::Threading::BacktraceService::ALL_TRANSACTIONS,
35
+ agent_command.arguments
36
+ )
37
+
38
+ @started_at = Time.now
39
+ @duration = profile.duration if profile
40
+ end
41
+
42
+ def stop(report_data)
43
+ return unless running?
44
+ Mmtrix::Agent.logger.debug("Stopping Thread Profiler.")
45
+ @finished_profile = @backtrace_service.harvest(Mmtrix::Agent::Threading::BacktraceService::ALL_TRANSACTIONS)
46
+ @backtrace_service.unsubscribe(Mmtrix::Agent::Threading::BacktraceService::ALL_TRANSACTIONS)
47
+ @finished_profile = nil if !report_data
48
+ end
49
+
50
+ def harvest
51
+ Mmtrix::Agent.logger.debug("Harvesting from Thread Profiler #{@finished_profile.to_log_description unless @finished_profile.nil?}")
52
+ profile = @finished_profile
53
+ @backtrace_service.profile_agent_code = false
54
+ @finished_profile = nil
55
+ @started_at = nil
56
+ profile
57
+ end
58
+
59
+ def enabled?
60
+ Mmtrix::Agent.config[:'thread_profiler.enabled']
61
+ end
62
+
63
+ def running?
64
+ @backtrace_service.subscribed?(Mmtrix::Agent::Threading::BacktraceService::ALL_TRANSACTIONS)
65
+ end
66
+
67
+ def ready_to_harvest?
68
+ past_time? || stopped?
69
+ end
70
+
71
+ def past_time?
72
+ @started_at && (Time.now > @started_at + @duration)
73
+ end
74
+
75
+ def stopped?
76
+ !!@finished_profile
77
+ end
78
+
79
+ private
80
+
81
+ def raise_command_error(msg)
82
+ raise Mmtrix::Agent::Commands::AgentCommandRouter::AgentCommandError.new(msg)
83
+ end
84
+
85
+ def raise_unsupported_error
86
+ msg = <<-EOF
87
+ Thread profiling is only supported on 1.9.2 and greater versions of Ruby.
88
+ We detected running agents capable of profiling, but the profile started with
89
+ an agent running Ruby #{RUBY_VERSION}.
90
+
91
+ Profiling again might select an appropriate agent, but we recommend running a
92
+ consistent version of Ruby across your application for better results.
93
+ EOF
94
+ raise_command_error(msg)
95
+ end
96
+
97
+ def raise_thread_profiler_disabled
98
+ msg = "Not starting Thread Profiler because of config 'thread_profiler.enabled' = #{enabled?}"
99
+ raise_command_error(msg)
100
+ end
101
+
102
+ def raise_already_started_error
103
+ msg = "Profile already in progress. Ignoring agent command to start another."
104
+ raise_command_error(msg)
105
+ end
106
+
107
+ end
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,55 @@
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 'forwardable'
6
+
7
+ module Mmtrix
8
+ module Agent
9
+ module Commands
10
+ class XraySession
11
+ extend Forwardable
12
+
13
+ attr_reader :id, :command_arguments
14
+ attr_reader :xray_session_name, :key_transaction_name,
15
+ :requested_trace_count, :duration, :sample_period
16
+
17
+ def initialize(command_arguments)
18
+ @command_arguments = command_arguments
19
+ @id = command_arguments.fetch("x_ray_id", nil)
20
+ @xray_session_name = command_arguments.fetch("xray_session_name", "")
21
+ @key_transaction_name = command_arguments.fetch("key_transaction_name", "")
22
+ @requested_trace_count = command_arguments.fetch("requested_trace_count", 100)
23
+ @duration = command_arguments.fetch("duration", 86400)
24
+ @sample_period = command_arguments.fetch("sample_period", 0.1)
25
+ @run_profiler = command_arguments.fetch("run_profiler", true)
26
+ end
27
+
28
+ def active?
29
+ @active
30
+ end
31
+
32
+ def run_profiler?
33
+ @run_profiler && Mmtrix::Agent.config[:'xray_session.allow_profiles']
34
+ end
35
+
36
+ def activate
37
+ @active = true
38
+ @start_time = Time.now
39
+ end
40
+
41
+ def deactivate
42
+ @active = false
43
+ end
44
+
45
+ def requested_period
46
+ @sample_period
47
+ end
48
+
49
+ def finished?
50
+ @start_time + @duration < Time.now
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end