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,339 @@
1
+ # -*- ruby -*-
2
+ # encoding: utf-8
3
+ # This file is distributed under Mmtrix's license terms.
4
+ # See https://github.com/mmtrix/rpm/blob/master/LICENSE for complete details.
5
+
6
+ module Mmtrix
7
+ module Agent
8
+ module CrossAppTracing
9
+
10
+ # Exception raised if there is a problem with cross app transactions.
11
+ class Error < RuntimeError; end
12
+
13
+ # The cross app response header for "outgoing" calls
14
+ NR_APPDATA_HEADER = 'X-Mmtrix-App-Data'
15
+
16
+ # The cross app id header for "outgoing" calls
17
+ NR_ID_HEADER = 'X-Mmtrix-ID'
18
+
19
+ # The cross app transaction header for "outgoing" calls
20
+ NR_TXN_HEADER = 'X-Mmtrix-Transaction'
21
+
22
+ # The cross app synthetics header
23
+ NR_SYNTHETICS_HEADER = 'X-Mmtrix-Synthetics'
24
+
25
+ # The index of the transaction GUID in the appdata header of responses
26
+ APPDATA_TXN_GUID_INDEX = 5
27
+
28
+
29
+ ###############
30
+ module_function
31
+ ###############
32
+
33
+ # Send the given +request+, adding metrics appropriate to the
34
+ # response when it comes back.
35
+ #
36
+ # See the documentation for +start_trace+ for an explanation of what
37
+ # +request+ should look like.
38
+ #
39
+ def tl_trace_http_request(request)
40
+ state = Mmtrix::Agent::TransactionState.tl_get
41
+ return yield unless state.is_execution_traced?
42
+
43
+ # It's important to set t0 outside the ensured block, otherwise there's
44
+ # a race condition if we raise after begin but before t0's set.
45
+ t0 = Time.now
46
+ begin
47
+ node = start_trace(state, t0, request)
48
+ response = yield
49
+ ensure
50
+ finish_trace(state, t0, node, request, response)
51
+ end
52
+
53
+ return response
54
+ end
55
+
56
+ # Set up the necessary state for cross-application tracing before the
57
+ # given +request+ goes out.
58
+ #
59
+ # The +request+ object passed in must respond to the following methods:
60
+ #
61
+ # * type - Return a String describing the underlying library being used
62
+ # to make the request (e.g. 'Net::HTTP' or 'Typhoeus')
63
+ # * host - Return a String with the hostname or IP of the host being
64
+ # communicated with.
65
+ # * method - Return a String with the HTTP method name for this request
66
+ # * [](key) - Lookup an HTTP request header by name
67
+ # * []=(key, val) - Set an HTTP request header by name
68
+ # * uri - Full URI of the request
69
+ #
70
+ # This method returns the transaction node if it was sucessfully pushed.
71
+ def start_trace(state, t0, request)
72
+ inject_request_headers(state, request) if cross_app_enabled?
73
+ stack = state.traced_method_stack
74
+ node = stack.push_frame(state, :http_request, t0)
75
+
76
+ return node
77
+ rescue => err
78
+ Mmtrix::Agent.logger.error "Uncaught exception while tracing HTTP request", err
79
+ return nil
80
+ rescue Exception => e
81
+ Mmtrix::Agent.logger.debug "Unexpected exception raised while tracing HTTP request", e
82
+
83
+ raise e
84
+ end
85
+
86
+
87
+ # Finish tracing the HTTP +request+ that started at +t0+ with the information in
88
+ # +response+ and the given +http+ connection.
89
+ #
90
+ # The +request+ must conform to the same interface described in the documentation
91
+ # for +start_trace+.
92
+ #
93
+ # The +response+ must respond to the following methods:
94
+ #
95
+ # * [](key) - Reads response headers.
96
+ # * to_hash - Converts response headers to a Hash
97
+ #
98
+ def finish_trace(state, t0, node, request, response)
99
+ unless t0
100
+ Mmtrix::Agent.logger.error("HTTP request trace finished without start time. This is probably an agent bug.")
101
+ return
102
+ end
103
+
104
+ t1 = Time.now
105
+ duration = t1.to_f - t0.to_f
106
+
107
+ begin
108
+ if request
109
+ # Figure out which metrics we need to report based on the request and response
110
+ # The last (most-specific) one is scoped.
111
+ metrics = metrics_for(request, response)
112
+ scoped_metric = metrics.pop
113
+
114
+ stats_engine.record_scoped_and_unscoped_metrics(
115
+ state, scoped_metric, metrics, duration)
116
+
117
+ # If we don't have node, something failed during start_trace so
118
+ # the current node isn't the HTTP call it should have been.
119
+ if node
120
+ node.name = scoped_metric
121
+ add_transaction_trace_parameters(request, response)
122
+ end
123
+ end
124
+ ensure
125
+ # If we have a node, always pop the traced method stack to avoid
126
+ # an inconsistent state, which prevents tracing of whole transaction.
127
+ if node
128
+ stack = state.traced_method_stack
129
+ stack.pop_frame(state, node, scoped_metric, t1)
130
+ end
131
+ end
132
+ rescue Mmtrix::Agent::CrossAppTracing::Error => err
133
+ Mmtrix::Agent.logger.debug "while cross app tracing", err
134
+ rescue => err
135
+ Mmtrix::Agent.logger.error "Uncaught exception while finishing an HTTP request trace", err
136
+ end
137
+
138
+ # Return +true+ if cross app tracing is enabled in the config.
139
+ def cross_app_enabled?
140
+ valid_cross_process_id? &&
141
+ valid_encoding_key? &&
142
+ cross_application_tracer_enabled?
143
+ end
144
+
145
+ def valid_cross_process_id?
146
+ Mmtrix::Agent.config[:cross_process_id] && Mmtrix::Agent.config[:cross_process_id].length > 0
147
+ end
148
+
149
+ def valid_encoding_key?
150
+ Mmtrix::Agent.config[:encoding_key] && Mmtrix::Agent.config[:encoding_key].length > 0
151
+ end
152
+
153
+ def cross_application_tracer_enabled?
154
+ Mmtrix::Agent.config[:"cross_application_tracer.enabled"] || Mmtrix::Agent.config[:cross_application_tracing]
155
+ end
156
+
157
+ # Fetcher for the cross app encoding key. Raises a
158
+ # Mmtrix::Agent::CrossAppTracing::Error if the key isn't configured.
159
+ def cross_app_encoding_key
160
+ Mmtrix::Agent.config[:encoding_key] or
161
+ raise Mmtrix::Agent::CrossAppTracing::Error, "No encoding_key set."
162
+ end
163
+
164
+ def obfuscator
165
+ @obfuscator ||= Mmtrix::Agent::Obfuscator.new(cross_app_encoding_key)
166
+ end
167
+
168
+ # Inject the X-Process header into the outgoing +request+.
169
+ def inject_request_headers(state, request)
170
+ cross_app_id = Mmtrix::Agent.config[:cross_process_id] or
171
+ raise Mmtrix::Agent::CrossAppTracing::Error, "no cross app ID configured"
172
+
173
+ state.is_cross_app_caller = true
174
+ txn_guid = state.request_guid
175
+ txn = state.current_transaction
176
+ if txn
177
+ trip_id = txn.cat_trip_id(state)
178
+ path_hash = txn.cat_path_hash(state)
179
+
180
+ if txn.raw_synthetics_header
181
+ request[NR_SYNTHETICS_HEADER] = txn.raw_synthetics_header
182
+ end
183
+ end
184
+ txn_data = Mmtrix::JSONWrapper.dump([txn_guid, false, trip_id, path_hash])
185
+
186
+ request[NR_ID_HEADER] = obfuscator.obfuscate(cross_app_id)
187
+ request[NR_TXN_HEADER] = obfuscator.obfuscate(txn_data)
188
+
189
+ rescue Mmtrix::Agent::CrossAppTracing::Error => err
190
+ Mmtrix::Agent.logger.debug "Not injecting x-process header", err
191
+ end
192
+
193
+ def add_transaction_trace_parameters(request, response)
194
+ filtered_uri = ::Mmtrix::Agent::HTTPClients::URIUtil.filter_uri(request.uri)
195
+ transaction_sampler.add_node_parameters(:uri => filtered_uri)
196
+ if response && response_is_crossapp?(response)
197
+ add_cat_transaction_trace_parameters(response)
198
+ end
199
+ end
200
+
201
+
202
+ # Extract any custom parameters from +response+ if it's cross-application and
203
+ # add them to the current TT node.
204
+ def add_cat_transaction_trace_parameters( response )
205
+ appdata = extract_appdata( response )
206
+ transaction_sampler.add_node_parameters( \
207
+ :transaction_guid => appdata[APPDATA_TXN_GUID_INDEX] )
208
+ end
209
+
210
+
211
+ # Return the set of metric names that correspond to
212
+ # the given +request+ and +response+.
213
+ # +response+ may be nil in the case that the request produced an error
214
+ # without ever receiving an HTTP response.
215
+ def metrics_for( request, response )
216
+ metrics = common_metrics( request )
217
+
218
+ if response && response_is_crossapp?( response )
219
+ begin
220
+ metrics.concat metrics_for_crossapp_response( request, response )
221
+ rescue => err
222
+ # Fall back to regular metrics if there's a problem with x-process metrics
223
+ Mmtrix::Agent.logger.debug "%p while fetching x-process metrics: %s" %
224
+ [ err.class, err.message ]
225
+ metrics.concat metrics_for_regular_request( request )
226
+ end
227
+ else
228
+ metrics.concat metrics_for_regular_request( request )
229
+ end
230
+
231
+ return metrics
232
+ end
233
+
234
+
235
+ # Return an Array of metrics used for every response.
236
+ def common_metrics( request )
237
+ metrics = [ "External/all" ]
238
+ metrics << "External/#{request.host}/all"
239
+
240
+ if Mmtrix::Agent::Transaction.recording_web_transaction?
241
+ metrics << "External/allWeb"
242
+ else
243
+ metrics << "External/allOther"
244
+ end
245
+
246
+ return metrics
247
+ end
248
+
249
+
250
+ # Returns +true+ if Cross Application Tracing is enabled, and the given +response+
251
+ # has the appropriate headers.
252
+ def response_is_crossapp?( response )
253
+ return false unless cross_app_enabled?
254
+ unless response[NR_APPDATA_HEADER]
255
+ return false
256
+ end
257
+
258
+ return true
259
+ end
260
+
261
+
262
+ # Return the set of metric objects appropriate for the given cross app
263
+ # +response+.
264
+ def metrics_for_crossapp_response( request, response )
265
+ xp_id, txn_name, _q_time, _r_time, _req_len, _ = extract_appdata( response )
266
+
267
+ check_crossapp_id( xp_id )
268
+ check_transaction_name( txn_name )
269
+
270
+ metrics = []
271
+ metrics << "ExternalApp/#{request.host}/#{xp_id}/all"
272
+ metrics << "ExternalTransaction/#{request.host}/#{xp_id}/#{txn_name}"
273
+
274
+ return metrics
275
+ end
276
+
277
+
278
+ # Extract x-process application data from the specified +response+ and return
279
+ # it as an array of the form:
280
+ #
281
+ # [
282
+ # <cross app ID>,
283
+ # <transaction name>,
284
+ # <queue time in seconds>,
285
+ # <response time in seconds>,
286
+ # <request content length in bytes>,
287
+ # <transaction GUID>
288
+ # ]
289
+ def extract_appdata( response )
290
+ appdata = response[NR_APPDATA_HEADER] or
291
+ raise Mmtrix::Agent::CrossAppTracing::Error,
292
+ "Can't derive metrics for response: no #{NR_APPDATA_HEADER} header!"
293
+
294
+ decoded_appdata = obfuscator.deobfuscate( appdata )
295
+ decoded_appdata.set_encoding( ::Encoding::UTF_8 ) if
296
+ decoded_appdata.respond_to?( :set_encoding )
297
+
298
+ return Mmtrix::JSONWrapper.load( decoded_appdata )
299
+ end
300
+
301
+
302
+ # Return the set of metric objects appropriate for the given (non-cross app)
303
+ # +request+.
304
+ def metrics_for_regular_request( request )
305
+ metrics = []
306
+ metrics << "External/#{request.host}/#{request.type}/#{request.method}"
307
+
308
+ return metrics
309
+ end
310
+
311
+
312
+ # Fetch a reference to the stats engine.
313
+ def stats_engine
314
+ Mmtrix::Agent.instance.stats_engine
315
+ end
316
+
317
+ def transaction_sampler
318
+ Mmtrix::Agent.instance.transaction_sampler
319
+ end
320
+
321
+ # Check the given +id+ to ensure it conforms to the format of a cross-application
322
+ # ID. Raises an Mmtrix::Agent::CrossAppTracing::Error if it doesn't.
323
+ def check_crossapp_id( id )
324
+ id =~ /\A\d+#\d+\z/ or
325
+ raise Mmtrix::Agent::CrossAppTracing::Error,
326
+ "malformed cross application ID %p" % [ id ]
327
+ end
328
+
329
+
330
+ # Check the given +name+ to ensure it conforms to the format of a valid transaction
331
+ # name.
332
+ def check_transaction_name( name )
333
+ # No-op -- apparently absolutely anything is a valid transaction name?
334
+ # This is here for when that inevitably comes back to haunt us.
335
+ end
336
+
337
+ end
338
+ end
339
+ end
@@ -0,0 +1,100 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under Mmtrix's license terms.
3
+ # See https://github.com/mmtrix/rpm/blob/master/LICENSE for complete details.
4
+
5
+ require 'mmtrix/agent/sized_buffer'
6
+ require 'mmtrix/agent/attribute_processing'
7
+
8
+ module Mmtrix
9
+ module Agent
10
+ class CustomEventAggregator
11
+ include Mmtrix::Coerce
12
+
13
+ TYPE = 'type'.freeze
14
+ TIMESTAMP = 'timestamp'.freeze
15
+ EVENT_TYPE_REGEX = /^[a-zA-Z0-9:_ ]+$/.freeze
16
+
17
+ DEFAULT_CAPACITY_KEY = :'custom_insights_events.max_samples_stored'
18
+
19
+ def initialize
20
+ @lock = Mutex.new
21
+ @buffer = SampledBuffer.new(Mmtrix::Agent.config[DEFAULT_CAPACITY_KEY])
22
+ @type_strings = Hash.new { |hash, key| hash[key] = key.to_s.freeze }
23
+ register_config_callbacks
24
+ end
25
+
26
+ def register_config_callbacks
27
+ Mmtrix::Agent.config.register_callback(DEFAULT_CAPACITY_KEY) do |max_samples|
28
+ Mmtrix::Agent.logger.debug "CustomEventAggregator max_samples set to #{max_samples}"
29
+ @lock.synchronize do
30
+ @buffer.capacity = max_samples
31
+ end
32
+ end
33
+ end
34
+
35
+ def record(type, attributes)
36
+ unless attributes.is_a? Hash
37
+ raise ArgumentError, "Expected Hash but got #{attributes.class}"
38
+ end
39
+
40
+ type = @type_strings[type]
41
+ unless type =~ EVENT_TYPE_REGEX
42
+ note_dropped_event(type)
43
+ return false
44
+ end
45
+
46
+ event = [
47
+ { TYPE => type, TIMESTAMP => Time.now.to_i },
48
+ AttributeProcessing.flatten_and_coerce(attributes)
49
+ ]
50
+
51
+ stored = @lock.synchronize do
52
+ @buffer.append(event)
53
+ end
54
+ stored
55
+ end
56
+
57
+ def harvest!
58
+ results = []
59
+ drop_count = 0
60
+ @lock.synchronize do
61
+ results.concat(@buffer.to_a)
62
+ drop_count += @buffer.num_dropped
63
+ @buffer.reset!
64
+ end
65
+ note_dropped_events(results.size, drop_count)
66
+ results
67
+ end
68
+
69
+ def note_dropped_events(captured_count, dropped_count)
70
+ total_count = captured_count + dropped_count
71
+ if dropped_count > 0
72
+ Mmtrix::Agent.logger.warn("Dropped #{dropped_count} custom events out of #{total_count}.")
73
+ end
74
+ engine = Mmtrix::Agent.instance.stats_engine
75
+ engine.tl_record_supportability_metric_count("Events/Customer/Seen" , total_count)
76
+ engine.tl_record_supportability_metric_count("Events/Customer/Sent" , captured_count)
77
+ engine.tl_record_supportability_metric_count("Events/Customer/Dropped", dropped_count)
78
+ end
79
+
80
+ def merge!(events)
81
+ @lock.synchronize do
82
+ events.each do |event|
83
+ @buffer.append(event)
84
+ end
85
+ end
86
+ end
87
+
88
+ def reset!
89
+ @lock.synchronize { @buffer.reset! }
90
+ end
91
+
92
+ def note_dropped_event(type)
93
+ ::Mmtrix::Agent.logger.log_once(:warn, "dropping_event_of_type:#{type}",
94
+ "Invalid event type name '#{type}', not recording.")
95
+ @buffer.note_dropped
96
+ end
97
+
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,78 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under Mmtrix's license terms.
3
+ # See https://github.com/mmtrix/rpm/blob/master/LICENSE for complete details.
4
+
5
+ module Mmtrix
6
+ module Agent
7
+ module Database
8
+ module ObfuscationHelpers
9
+ # Note that the following two regexes are applied to a reversed version
10
+ # of the query. This is why the backslash escape sequences (\' and \")
11
+ # appear reversed within them.
12
+ #
13
+ # Note that some database adapters (notably, PostgreSQL with
14
+ # standard_conforming_strings on and MySQL with NO_BACKSLASH_ESCAPES on)
15
+ # do not apply special treatment to backslashes within quoted string
16
+ # literals. We don't have an easy way of determining whether the
17
+ # database connection from which a query was captured was operating in
18
+ # one of these modes, but the obfuscation is done in such a way that it
19
+ # should not matter.
20
+ #
21
+ # Reversing the query string before obfuscation allows us to get around
22
+ # the fact that a \' appearing within a string may or may not terminate
23
+ # the string, because we know that a string cannot *start* with a \'.
24
+ REVERSE_SINGLE_QUOTES_REGEX = /'(?:''|'\\|[^'])*'/
25
+ REVERSE_ANY_QUOTES_REGEX = /'(?:''|'\\|[^'])*'|"(?:""|"\\|[^"])*"/
26
+
27
+ NUMERICS_REGEX = /\b\d+\b/
28
+
29
+ # We take a conservative, overly-aggressive approach to obfuscating
30
+ # comments, and drop everything from the query after encountering any
31
+ # character sequence that could be a comment initiator. We do this after
32
+ # removal of string literals to avoid accidentally over-obfuscating when
33
+ # a string literal contains a comment initiator.
34
+ SQL_COMMENT_REGEX = Regexp.new('(?:/\*|--|#).*', Regexp::MULTILINE).freeze
35
+
36
+ # We use these to check whether the query contains any quote characters
37
+ # after obfuscation. If so, that's a good indication that the original
38
+ # query was malformed, and so our obfuscation can't reliabily find
39
+ # literals. In such a case, we'll replace the entire query with a
40
+ # placeholder.
41
+ LITERAL_SINGLE_QUOTE = "'".freeze
42
+ LITERAL_DOUBLE_QUOTE = '"'.freeze
43
+
44
+ PLACEHOLDER = '?'.freeze
45
+
46
+ def obfuscate_single_quote_literals(sql)
47
+ obfuscated = sql.reverse
48
+ obfuscated.gsub!(REVERSE_SINGLE_QUOTES_REGEX, PLACEHOLDER)
49
+ obfuscated.reverse!
50
+ obfuscated
51
+ end
52
+
53
+ def obfuscate_quoted_literals(sql)
54
+ obfuscated = sql.reverse
55
+ obfuscated.gsub!(REVERSE_ANY_QUOTES_REGEX, PLACEHOLDER)
56
+ obfuscated.reverse!
57
+ obfuscated
58
+ end
59
+
60
+ def obfuscate_numeric_literals(sql)
61
+ sql.gsub(NUMERICS_REGEX, PLACEHOLDER)
62
+ end
63
+
64
+ def remove_comments(sql)
65
+ sql.gsub(SQL_COMMENT_REGEX, PLACEHOLDER)
66
+ end
67
+
68
+ def contains_single_quotes?(str)
69
+ str.include?(LITERAL_SINGLE_QUOTE)
70
+ end
71
+
72
+ def contains_quotes?(str)
73
+ str.include?(LITERAL_SINGLE_QUOTE) || str.include?(LITERAL_DOUBLE_QUOTE)
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,80 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under Mmtrix's license terms.
3
+ # See https://github.com/mmtrix/rpm/blob/master/LICENSE for complete details.
4
+
5
+ require 'mmtrix/agent/database/obfuscation_helpers'
6
+
7
+ module Mmtrix
8
+ module Agent
9
+ module Database
10
+ class Obfuscator
11
+ include Singleton
12
+ include ObfuscationHelpers
13
+
14
+ attr_reader :obfuscator
15
+
16
+ QUERY_TOO_LARGE_MESSAGE = "Query too large (over 16k characters) to safely obfuscate"
17
+ FAILED_TO_OBFUSCATE_MESSAGE = "Failed to obfuscate SQL query - quote characters remained after obfuscation"
18
+
19
+ def initialize
20
+ reset
21
+ end
22
+
23
+ def reset
24
+ @obfuscator = method(:default_sql_obfuscator)
25
+ end
26
+
27
+ # Sets the sql obfuscator used to clean up sql when sending it
28
+ # to the server. Possible types are:
29
+ #
30
+ # :before => sets the block to run before the existing
31
+ # obfuscators
32
+ #
33
+ # :after => sets the block to run after the existing
34
+ # obfuscator(s)
35
+ #
36
+ # :replace => removes the current obfuscator and replaces it
37
+ # with the provided block
38
+ def set_sql_obfuscator(type, &block)
39
+ if type == :before
40
+ @obfuscator = Mmtrix::ChainedCall.new(block, @obfuscator)
41
+ elsif type == :after
42
+ @obfuscator = Mmtrix::ChainedCall.new(@obfuscator, block)
43
+ elsif type == :replace
44
+ @obfuscator = block
45
+ else
46
+ fail "unknown sql_obfuscator type #{type}"
47
+ end
48
+ end
49
+
50
+ def default_sql_obfuscator(sql)
51
+ if sql[-3,3] == '...'
52
+ return QUERY_TOO_LARGE_MESSAGE
53
+ end
54
+
55
+ stmt = sql.kind_of?(Statement) ? sql : Statement.new(sql)
56
+ obfuscate_double_quotes = stmt.adapter.to_s !~ /postgres|sqlite/
57
+
58
+ obfuscated = obfuscate_numeric_literals(stmt)
59
+
60
+ if obfuscate_double_quotes
61
+ obfuscated = obfuscate_quoted_literals(obfuscated)
62
+ obfuscated = remove_comments(obfuscated)
63
+ if contains_quotes?(obfuscated)
64
+ obfuscated = FAILED_TO_OBFUSCATE_MESSAGE
65
+ end
66
+ else
67
+ obfuscated = obfuscate_single_quote_literals(obfuscated)
68
+ obfuscated = remove_comments(obfuscated)
69
+ if contains_single_quotes?(obfuscated)
70
+ obfuscated = FAILED_TO_OBFUSCATE_MESSAGE
71
+ end
72
+ end
73
+
74
+
75
+ obfuscated.to_s # return back to a regular String
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,46 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under Mmtrix's license terms.
3
+ # See https://github.com/mmtrix/rpm/blob/master/LICENSE for complete details.
4
+
5
+ require 'mmtrix/agent/database/obfuscation_helpers'
6
+
7
+ module Mmtrix
8
+ module Agent
9
+ module Database
10
+ module PostgresExplainObfuscator
11
+ extend self
12
+
13
+ # Note that this regex can't be shared with the ones in the
14
+ # Database::Obfuscator class because here we don't look for
15
+ # backslash-escaped strings (and those regexes are backwards).
16
+ QUOTED_STRINGS_REGEX = /'(?:[^']|'')*'|"(?:[^"]|"")*"/
17
+ LABEL_LINE_REGEX = /^([^:\n]*:\s+).*$/.freeze
18
+
19
+ def obfuscate(explain)
20
+ # First, we replace all single-quoted strings.
21
+ # This is necessary in order to deal with multi-line string constants
22
+ # embedded in the explain output.
23
+ #
24
+ # Note that we look for both single or double quotes but do not
25
+ # replace double quotes in order to avoid accidentally latching onto a
26
+ # single quote character embedded within a quoted identifier (such as
27
+ # a table name).
28
+ #
29
+ # Note also that we make no special provisions for backslash-escaped
30
+ # single quotes (\') because these are canonicalized to two single
31
+ # quotes ('') in the explain output.
32
+ explain.gsub!(QUOTED_STRINGS_REGEX) do |match|
33
+ match.start_with?('"') ? match : '?'
34
+ end
35
+
36
+ # Now, mask anything after the first colon (:).
37
+ # All parts of the query that can appear in the explain output are
38
+ # prefixed with "<label>: ", so we want to preserve the label, but
39
+ # remove the rest of the line.
40
+ explain.gsub!(LABEL_LINE_REGEX, '\1?')
41
+ explain
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end