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,621 @@
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_rpm"
6
+ require "fake_external_server"
7
+ require "evil_server"
8
+
9
+ module HttpClientTestCases
10
+ include Mmtrix::Agent::Instrumentation::ControllerInstrumentation,
11
+ Mmtrix::Agent::CrossAppTracing,
12
+ MultiverseHelpers
13
+
14
+ TRANSACTION_GUID = 'BEC1BC64675138B9'
15
+
16
+ $fake_server = Mmtrix::FakeExternalServer.new
17
+ $fake_secure_server = Mmtrix::FakeSecureExternalServer.new
18
+
19
+ setup_and_teardown_agent(
20
+ :"cross_application_tracer.enabled" => false,
21
+ :cross_process_id => "269975#22824",
22
+ :encoding_key => "gringletoes",
23
+ :trusted_account_ids => [269975]
24
+ )
25
+
26
+ def after_setup
27
+ $fake_server.reset
28
+ $fake_server.run
29
+
30
+ $fake_secure_server.reset
31
+ $fake_secure_server.run
32
+
33
+ Mmtrix::Agent.instance.events.notify(:finished_configuring)
34
+ Mmtrix::Agent::CrossAppTracing.instance_variable_set(:@obfuscator, nil)
35
+ end
36
+
37
+ # Helpers to support shared tests
38
+
39
+ def use_ssl?
40
+ @ssl
41
+ end
42
+
43
+ def server
44
+ @ssl ? $fake_secure_server : $fake_server
45
+ end
46
+
47
+ def protocol
48
+ @ssl ? "https" : "http"
49
+ end
50
+
51
+ def default_url
52
+ "#{protocol}://localhost:#{server.port}/status"
53
+ end
54
+
55
+ def default_uri
56
+ URI.parse(default_url)
57
+ end
58
+
59
+ def body(res)
60
+ res.body
61
+ end
62
+
63
+ # Tests
64
+
65
+ def test_validate_request_wrapper
66
+ req = request_instance
67
+ req.respond_to?(:type)
68
+ req.respond_to?(:host)
69
+ req.respond_to?(:method)
70
+ req.respond_to?(:[])
71
+ req.respond_to?(:[]=)
72
+ req.respond_to?(:uri)
73
+ end
74
+
75
+ def test_validate_response_wrapper
76
+ res = response_instance
77
+ res.respond_to?(:[])
78
+ res.respond_to?(:to_hash)
79
+ end
80
+
81
+ # Some libraries (older Typhoeus), have had odd behavior around [] for
82
+ # missing keys. This generates log messages, although it behaves right in
83
+ # terms of metrics, so double-check we get what we expect
84
+ def test_request_headers_for_missing_key
85
+ assert_nil request_instance["boo"]
86
+ end
87
+
88
+ def test_response_headers_for_missing_key
89
+ assert_nil response_instance["boo"]
90
+ end
91
+
92
+ def test_response_wrapper_ignores_case_in_header_keys
93
+ res = response_instance('NAMCO' => 'digdug')
94
+ assert_equal 'digdug', res['namco']
95
+ end
96
+
97
+ def test_get
98
+ res = get_response
99
+
100
+ assert_match %r/<head>/i, body(res)
101
+ assert_externals_recorded_for("localhost", "GET")
102
+ end
103
+
104
+ # Although rare, some clients do explicitly set the "host" header on their
105
+ # http requests. Respect that rather than the host IP on the request if so.
106
+ #
107
+ # https://github.com/mmtrix/rpm/pull/124
108
+ def test_get_with_host_header
109
+ uri = default_uri
110
+ uri.host = '127.0.0.1'
111
+ res = get_response(uri.to_s, 'Host' => 'test.local')
112
+
113
+ assert_match %r/<head>/i, body(res)
114
+ assert_externals_recorded_for("test.local", "GET")
115
+ end
116
+
117
+ def test_get_with_host_header_lowercase
118
+ uri = default_uri
119
+ uri.host = '127.0.0.1'
120
+ res = get_response(uri.to_s, 'host' => 'test.local')
121
+
122
+ assert_match %r/<head>/i, body(res)
123
+ assert_externals_recorded_for("test.local", "GET")
124
+ end
125
+
126
+ # Only some HTTP clients support explicit connection reuse, so this test
127
+ # checks whether the host responds to get_response_multi before executing.
128
+ def test_get_with_reused_connection
129
+ if self.respond_to?(:get_response_multi)
130
+ n = 2
131
+ responses = get_response_multi(default_url, n)
132
+
133
+ responses.each do |res|
134
+ assert_match %r/<head>/i, body(res)
135
+ end
136
+
137
+ expected = { :call_count => n }
138
+ assert_externals_recorded_for("localhost", "GET", :counts => expected)
139
+ end
140
+ end
141
+
142
+ def test_background
143
+ res = nil
144
+
145
+ perform_action_with_mmtrix_trace(:name => "task", :category => :task) do
146
+ res = get_response
147
+ end
148
+
149
+ assert_match %r/<head>/i, body(res)
150
+ assert_externals_recorded_for("localhost", "GET")
151
+ assert_metrics_recorded([
152
+ ["External/localhost/#{client_name}/GET", "OtherTransaction/Background/#{self.class.name}/task"],
153
+ "OtherTransaction/Background/#{self.class.name}/task",
154
+ "OtherTransaction/Background/all",
155
+ "OtherTransaction/all"
156
+ ])
157
+ end
158
+
159
+ def test_transactional_metrics
160
+ res = nil
161
+
162
+ perform_action_with_mmtrix_trace(:name => "task") do
163
+ res = get_response
164
+ end
165
+
166
+ assert_match %r/<head>/i, body(res)
167
+ assert_externals_recorded_for("localhost", "GET", :transaction_type => "Web")
168
+ assert_metrics_recorded([
169
+ "Controller/#{self.class.name}/task"
170
+ ])
171
+
172
+ assert_metrics_not_recorded([
173
+ "External/allOther"
174
+ ])
175
+ end
176
+
177
+
178
+ def test_transactional_traces_nodes
179
+ perform_action_with_mmtrix_trace(:name => "task") do
180
+ get_response
181
+
182
+ last_node = find_last_transaction_node()
183
+ assert_equal "External/localhost/#{client_name}/GET", last_node.metric_name
184
+ end
185
+ end
186
+
187
+ def test_ignore
188
+ in_transaction do
189
+ Mmtrix::Agent.disable_all_tracing do
190
+ post_response
191
+ end
192
+ end
193
+
194
+ assert_metrics_recorded([])
195
+ end
196
+
197
+ def test_head
198
+ head_response
199
+ assert_externals_recorded_for("localhost", "HEAD")
200
+ end
201
+
202
+ def test_post
203
+ post_response
204
+ assert_externals_recorded_for("localhost", "POST")
205
+ end
206
+
207
+ def test_put
208
+ put_response
209
+ assert_externals_recorded_for("localhost", "PUT")
210
+ end
211
+
212
+ def test_delete
213
+ delete_response
214
+ assert_externals_recorded_for("localhost", "DELETE")
215
+ end
216
+
217
+ if defined?(::Addressable)
218
+ def test_url_not_supported_by_stdlib_uri
219
+ res = get_response("#{protocol}://foo:^password*12@localhost:#{server.port}/status")
220
+
221
+ assert_match %r/<head>/i, body(res)
222
+ assert_externals_recorded_for("localhost", "GET")
223
+ end
224
+ end
225
+
226
+ # When an http call is made, the agent should add a request header named
227
+ # X-Mmtrix-ID with a value equal to the encoded cross_app_id.
228
+
229
+ def test_adds_a_request_header_to_outgoing_requests_if_xp_enabled
230
+ with_config(:"cross_application_tracer.enabled" => true) do
231
+ get_response
232
+ assert_equal "VURQV1BZRkZdXUFT", server.requests.last["HTTP_X_MMTRIX_ID"]
233
+ end
234
+ end
235
+
236
+ def test_adds_a_request_header_to_outgoing_requests_if_old_xp_config_is_present
237
+ with_config(:cross_application_tracing => true) do
238
+ get_response
239
+ assert_equal "VURQV1BZRkZdXUFT", server.requests.last["HTTP_X_MMTRIX_ID"]
240
+ end
241
+ end
242
+
243
+ def test_adds_mmtrix_transaction_header
244
+ with_config(:cross_application_tracing => true) do
245
+ guid = nil
246
+ path_hash = nil
247
+ in_transaction do |txn|
248
+ guid = txn.guid
249
+ path_hash = txn.cat_path_hash(Mmtrix::Agent::TransactionState.tl_get)
250
+ get_response
251
+ end
252
+
253
+ transaction_data = server.requests.last["HTTP_X_MMTRIX_TRANSACTION"]
254
+ refute_empty(transaction_data)
255
+
256
+ decoded = decode_payload(transaction_data)
257
+
258
+ assert_equal(guid, decoded[0])
259
+ assert_equal(false, decoded[1])
260
+ assert_equal(guid, decoded[2])
261
+ assert_equal(path_hash, decoded[3])
262
+ end
263
+ end
264
+
265
+ def test_agent_doesnt_add_a_request_header_to_outgoing_requests_if_xp_disabled
266
+ get_response
267
+ assert_equal false, server.requests.last.keys.any? {|k| k =~ /MMTRIX_ID/}
268
+ end
269
+
270
+ def test_agent_doesnt_add_a_request_header_if_empty_cross_process_id
271
+ with_config(:'cross_application_tracer.enabled' => true,
272
+ :cross_process_id => "") do
273
+ get_response
274
+ assert_equal false, server.requests.last.keys.any? {|k| k =~ /MMTRIX_ID/}
275
+ end
276
+ end
277
+
278
+ def test_agent_doesnt_add_a_request_header_if_empty_encoding_key
279
+ with_config(:'cross_application_tracer.enabled' => true,
280
+ :encoding_key => "") do
281
+ get_response
282
+ assert_equal false, server.requests.last.keys.any? {|k| k =~ /MMTRIX_ID/}
283
+ end
284
+ end
285
+
286
+ def test_instrumentation_with_crossapp_enabled_records_normal_metrics_if_no_header_present
287
+ $fake_server.override_response_headers('X-Mmtrix-App-Data' => '')
288
+
289
+ with_config(:"cross_application_tracer.enabled" => true) do
290
+ in_transaction("test") do
291
+ get_response
292
+ end
293
+ end
294
+
295
+ assert_externals_recorded_for("localhost", "GET")
296
+ assert_metrics_recorded([["External/localhost/#{client_name}/GET", "test"]])
297
+ end
298
+
299
+ def test_instrumentation_with_crossapp_disabled_records_normal_metrics_even_if_header_is_present
300
+ $fake_server.override_response_headers('X-Mmtrix-App-Data' =>
301
+ make_app_data_payload( "18#1884", "txn-name", 2, 8, 0, TRANSACTION_GUID ))
302
+
303
+ in_transaction("test") do
304
+ get_response
305
+ end
306
+
307
+ assert_externals_recorded_for("localhost", "GET")
308
+ assert_metrics_recorded([["External/localhost/#{client_name}/GET", "test"]])
309
+ end
310
+
311
+ def test_instrumentation_with_crossapp_enabled_records_crossapp_metrics_if_header_present
312
+ $fake_server.override_response_headers('X-Mmtrix-App-Data' =>
313
+ make_app_data_payload( "18#1884", "txn-name", 2, 8, 0, TRANSACTION_GUID ))
314
+
315
+ with_config(:"cross_application_tracer.enabled" => true) do
316
+ in_transaction("test") do
317
+ get_response
318
+
319
+ last_node = find_last_transaction_node()
320
+ assert_includes last_node.params.keys, :transaction_guid
321
+ assert_equal TRANSACTION_GUID, last_node.params[:transaction_guid]
322
+ end
323
+ end
324
+
325
+ assert_metrics_recorded([
326
+ "External/all",
327
+ "External/allOther",
328
+ "ExternalApp/localhost/18#1884/all",
329
+ "ExternalTransaction/localhost/18#1884/txn-name",
330
+ "External/localhost/all",
331
+ ["ExternalTransaction/localhost/18#1884/txn-name", "test"]
332
+ ])
333
+ end
334
+
335
+ def test_crossapp_metrics_allow_valid_utf8_characters
336
+ $fake_server.override_response_headers('X-Mmtrix-App-Data' =>
337
+ make_app_data_payload( "12#1114", "世界線航跡蔵", 18.0, 88.1, 4096, TRANSACTION_GUID ))
338
+
339
+ with_config(:"cross_application_tracer.enabled" => true) do
340
+ in_transaction("test") do
341
+ get_response
342
+
343
+ last_node = find_last_transaction_node()
344
+ assert_includes last_node.params.keys, :transaction_guid
345
+ assert_equal TRANSACTION_GUID, last_node.params[:transaction_guid]
346
+ end
347
+ end
348
+
349
+ assert_metrics_recorded([
350
+ "External/all",
351
+ "External/allOther",
352
+ "ExternalApp/localhost/12#1114/all",
353
+ "External/localhost/all",
354
+ "ExternalTransaction/localhost/12#1114/世界線航跡蔵",
355
+ ["ExternalTransaction/localhost/12#1114/世界線航跡蔵", "test"]
356
+ ])
357
+ end
358
+
359
+ def test_crossapp_metrics_ignores_crossapp_header_with_malformed_crossprocess_id
360
+ $fake_server.override_response_headers('X-Mmtrix-App-Data' =>
361
+ make_app_data_payload( "88#88#88", "invalid", 1, 2, 4096, TRANSACTION_GUID ))
362
+
363
+ with_config(:"cross_application_tracer.enabled" => true) do
364
+ in_transaction("test") do
365
+ get_response
366
+ end
367
+ end
368
+
369
+ assert_externals_recorded_for("localhost", "GET")
370
+ assert_metrics_recorded([["External/localhost/#{client_name}/GET", "test"]])
371
+ end
372
+
373
+ def test_doesnt_affect_the_request_if_an_exception_is_raised_while_setting_up_tracing
374
+ res = nil
375
+ Mmtrix::Agent.instance.stats_engine.stubs( :push_scope ).
376
+ raises( NoMethodError, "undefined method `push_scope'" )
377
+
378
+ with_config(:"cross_application_tracer.enabled" => true) do
379
+ res = get_response
380
+ end
381
+
382
+ assert_equal Mmtrix::FakeExternalServer::STATUS_MESSAGE, body(res)
383
+ end
384
+
385
+ def test_doesnt_affect_the_request_if_an_exception_is_raised_while_finishing_tracing
386
+ res = nil
387
+ Mmtrix::Agent.instance.stats_engine.stubs( :pop_scope ).
388
+ raises( NoMethodError, "undefined method `pop_scope'" )
389
+
390
+ with_config(:"cross_application_tracer.enabled" => true) do
391
+ res = get_response
392
+ end
393
+
394
+ assert_equal Mmtrix::FakeExternalServer::STATUS_MESSAGE, body(res)
395
+ end
396
+
397
+ def test_doesnt_misbehave_when_transaction_tracing_is_disabled
398
+ # The error should have any other consequence other than logging the error, so
399
+ # this will capture logs
400
+ logger = Mmtrix::Agent::MemoryLogger.new
401
+ Mmtrix::Agent.logger = logger
402
+
403
+ with_config(:"cross_application_tracer.enabled" => true) do
404
+ get_response
405
+ end
406
+
407
+ refute_match( /undefined method `.*" for nil:NilClass/i,
408
+ logger.messages.flatten.map {|log| log.to_s }.join(" ") )
409
+ end
410
+
411
+ def test_includes_full_url_in_transaction_trace
412
+ full_url = "#{default_url}?foo=bar#fragment"
413
+ in_transaction do
414
+ get_response(full_url)
415
+ last_node = find_last_transaction_node()
416
+ filtered_uri = default_url
417
+ assert_equal filtered_uri, last_node.params[:uri]
418
+ end
419
+ end
420
+
421
+ # https://mmtrix.atlassian.net/browse/RUBY-1244
422
+ def test_failure_in_our_start_code_still_records_externals
423
+ # Fake a failure in our start-up code...
424
+ Mmtrix::JSONWrapper.stubs(:dump).raises("Boom!")
425
+
426
+ with_config(:"cross_application_tracer.enabled" => true) do
427
+ get_response
428
+ end
429
+
430
+ assert_externals_recorded_for("localhost", "GET")
431
+ end
432
+
433
+ # https://mmtrix.atlassian.net/browse/RUBY-1244
434
+ def test_failure_to_add_tt_node_doesnt_append_params_to_wrong_node
435
+ # Fake a failure in our start-up code...
436
+ Mmtrix::JSONWrapper.stubs(:dump).raises("Boom!")
437
+
438
+ in_transaction do
439
+ with_config(:"cross_application_tracer.enabled" => true) do
440
+ get_response
441
+
442
+ last_node = find_last_transaction_node()
443
+ refute last_node.params.key?(:uri)
444
+ end
445
+ end
446
+ end
447
+
448
+ def test_still_records_tt_node_when_request_fails
449
+ # This test does not work on older versions of Typhoeus, because the
450
+ # on_complete callback is not reliably invoked. That said, it's a corner
451
+ # case, and the failure mode is just that you lose tracing for the one
452
+ # transaction in which the error occurs. That, coupled with the fact that
453
+ # fixing it for old versions of Typhoeus would require large changes to
454
+ # the instrumentation, makes us say 'meh'.
455
+ is_typhoeus = (client_name == 'Typhoeus')
456
+ if !is_typhoeus || (is_typhoeus && Typhoeus::VERSION >= "0.5.4")
457
+ evil_server = Mmtrix::EvilServer.new
458
+ evil_server.start
459
+
460
+ in_transaction do
461
+ begin
462
+ get_response("http://localhost:#{evil_server.port}")
463
+ rescue
464
+ # it's expected that this will raise for some HTTP libraries (e.g.
465
+ # Net::HTTP). we unfortunately don't know the exact exception class
466
+ # across all libraries
467
+ end
468
+
469
+ last_node = find_last_transaction_node()
470
+ assert_equal("External/localhost/#{client_name}/GET", last_node.metric_name)
471
+ end
472
+
473
+ evil_server.stop
474
+ end
475
+ end
476
+
477
+ def test_raw_synthetics_header_is_passed_along_if_present
478
+ with_config(:"cross_application_tracer.enabled" => true) do
479
+ in_transaction do
480
+ state = Mmtrix::Agent::TransactionState.tl_get
481
+ state.current_transaction.raw_synthetics_header = "boo"
482
+
483
+ get_response
484
+
485
+ assert_equal "boo", server.requests.last["HTTP_X_MMTRIX_SYNTHETICS"]
486
+ end
487
+ end
488
+ end
489
+
490
+ def test_no_raw_synthetics_header_if_not_present
491
+ with_config(:"cross_application_tracer.enabled" => true) do
492
+ in_transaction do
493
+ get_response
494
+ refute_includes server.requests.last.keys, "HTTP_X_MMTRIX_SYNTHETICS"
495
+ end
496
+ end
497
+ end
498
+
499
+ load_cross_agent_test("cat_map").each do |test_case|
500
+ # Test cases that don't involve outgoing calls are done elsewhere
501
+ if test_case['outboundRequests']
502
+ define_method("test_#{test_case['name']}") do
503
+ config = {
504
+ :app_name => test_case['appName'],
505
+ :'cross_application_tracer.enabled' => true
506
+ }
507
+ with_config(config) do
508
+ Mmtrix::Agent.instance.events.notify(:finished_configuring)
509
+
510
+ in_transaction do
511
+ state = Mmtrix::Agent::TransactionState.tl_get
512
+ state.referring_transaction_info = test_case['inboundPayload']
513
+ stub_transaction_guid(test_case['transactionGuid'])
514
+ test_case['outboundRequests'].each do |req|
515
+ set_explicit_transaction_name(req['outboundTxnName'])
516
+ get_response
517
+
518
+ outbound_payload = server.requests.last["HTTP_X_MMTRIX_TRANSACTION"]
519
+ decoded_outbound_payload = decode_payload(outbound_payload)
520
+
521
+ assert_equal(req['expectedOutboundPayload'], decoded_outbound_payload)
522
+ end
523
+ set_explicit_transaction_name(test_case['transactionName'])
524
+ end
525
+ end
526
+
527
+ event = get_last_analytics_event
528
+ assert_event_attributes(
529
+ event,
530
+ test_case['name'],
531
+ test_case['expectedIntrinsicFields'],
532
+ test_case['nonExpectedIntrinsicFields']
533
+ )
534
+ end
535
+ end
536
+ end
537
+
538
+ # These tests only cover receiving, validating, and passing on the synthetics
539
+ # request header to any outgoing HTTP requests. They do *not* cover attaching
540
+ # of appropriate data to analytics events or transaction traces.
541
+ #
542
+ # The tests in agent_only/synthetics_test.rb cover that.
543
+ load_cross_agent_test('synthetics/synthetics').each do |test|
544
+ define_method("test_synthetics_http_#{test['name']}") do
545
+ config = {
546
+ :encoding_key => test['settings']['agentEncodingKey'],
547
+ :trusted_account_ids => test['settings']['trustedAccountIds'],
548
+ :'cross_application_tracer.enabled' => true
549
+ }
550
+
551
+ with_config(config) do
552
+ Mmtrix::Agent.instance.events.notify(:finished_configuring)
553
+
554
+ fake_rack_env = {}
555
+ test['inputObfuscatedHeader'].each do |key, value|
556
+ fake_rack_env[http_header_name_to_rack_key(key)] = value
557
+ end
558
+
559
+ in_transaction do
560
+ Mmtrix::Agent.agent.events.notify(:before_call, fake_rack_env)
561
+ get_response
562
+
563
+ last_outbound_request = server.requests.last
564
+ header_specs = test['outputExternalRequestHeader']
565
+
566
+ header_specs['expectedHeader'].each do |key, value|
567
+ expected_key = http_header_name_to_rack_key(key)
568
+ assert_equal(value, last_outbound_request[expected_key])
569
+ end
570
+
571
+ header_specs['nonExpectedHeader'].each do |key|
572
+ non_expected_key = http_header_name_to_rack_key(key)
573
+ refute_includes(last_outbound_request.keys, non_expected_key)
574
+ end
575
+ end
576
+ end
577
+ end
578
+ end
579
+
580
+ def http_header_name_to_rack_key(name)
581
+ "HTTP_" + name.upcase.gsub('-', '_')
582
+ end
583
+
584
+ def make_app_data_payload( *args )
585
+ obfuscator = Mmtrix::Agent::Obfuscator.new('gringletoes')
586
+ return obfuscator.obfuscate( args.to_json ) + "\n"
587
+ end
588
+
589
+ def decode_payload(payload)
590
+ obfuscator = Mmtrix::Agent::Obfuscator.new('gringletoes')
591
+ Mmtrix::JSONWrapper.load(obfuscator.deobfuscate(payload))
592
+ end
593
+
594
+ def set_explicit_transaction_name(name)
595
+ parts = name.split("/")
596
+ category = parts.shift
597
+ Mmtrix::Agent.set_transaction_name(parts.join('/'), :category => category)
598
+ end
599
+
600
+ def assert_externals_recorded_for(host, meth, opts={})
601
+ txn_type = opts.fetch(:transaction_type, "Other")
602
+ counts = opts.fetch(:counts, nil)
603
+
604
+ if counts.nil?
605
+ assert_metrics_recorded([
606
+ "External/all",
607
+ "External/all#{txn_type}",
608
+ "External/#{host}/#{client_name}/#{meth}",
609
+ "External/#{host}/all"
610
+ ])
611
+ else
612
+ assert_metrics_recorded(
613
+ "External/all" => counts,
614
+ "External/all#{txn_type}" => counts,
615
+ "External/#{host}/#{client_name}/#{meth}" => counts,
616
+ "External/#{host}/all" => counts
617
+ )
618
+ end
619
+ end
620
+
621
+ end
@@ -0,0 +1,32 @@
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 File.expand_path(File.join(File.dirname(__FILE__),'..','test_helper'))
6
+ require 'mmtrix_rpm'
7
+
8
+ class JSONWrapperTest < Minitest::Test
9
+ def test_json_roundtrip
10
+ obj = [
11
+ 99, 'luftballons',
12
+ {
13
+ 'Hast du etwas' => 'Zeit für mich',
14
+ 'Dann singe ich' => {
15
+ 'ein lied' => 'für dich'
16
+ }
17
+ }
18
+ ]
19
+ copy = Mmtrix::JSONWrapper.load(Mmtrix::JSONWrapper.dump(obj))
20
+ assert(obj == copy)
21
+ end
22
+
23
+ if Mmtrix::LanguageSupport.supports_string_encodings?
24
+ def test_normalizes_string_encodings_if_asked
25
+ string = (0..255).to_a.pack("C*")
26
+ encoded = Mmtrix::JSONWrapper.dump([string], :normalize => true)
27
+ decoded = Mmtrix::JSONWrapper.load(encoded)
28
+ expected = [string.dup.force_encoding('ISO-8859-1').encode('UTF-8')]
29
+ assert_equal(expected, decoded)
30
+ end
31
+ end
32
+ end