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,50 @@
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 Configuration
8
+ class DottedHash < ::Hash
9
+ def initialize(hash, keep_nesting=false)
10
+ # Add the hash keys to our collection explicitly so they survive the
11
+ # dot flattening. This is typical for full config source instances,
12
+ # but not for uses of DottedHash serializing for transmission.
13
+ self.merge!(hash) if keep_nesting
14
+
15
+ self.merge!(dot_flattened(hash))
16
+ DottedHash.symbolize(self)
17
+ end
18
+
19
+ def inspect
20
+ "#<#{self.class.name}:#{object_id} #{super}>"
21
+ end
22
+
23
+ def to_hash
24
+ {}.replace(self)
25
+ end
26
+
27
+ def self.symbolize(hash)
28
+ hash.keys.each do |key|
29
+ hash[key.to_sym] = hash.delete(key)
30
+ end
31
+ end
32
+
33
+ protected
34
+ # turns {'a' => {'b' => 'c'}} into {'a.b' => 'c'}
35
+ def dot_flattened(nested_hash, names=[], result={})
36
+ nested_hash.each do |key, val|
37
+ next if val == nil
38
+ if val.respond_to?(:has_key?)
39
+ dot_flattened(val, names + [key], result)
40
+ else
41
+ result[(names + [key]).join('.')] = val
42
+ end
43
+ end
44
+ result
45
+ end
46
+ end
47
+
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,116 @@
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 Configuration
8
+ class EnvironmentSource < DottedHash
9
+ SUPPORTED_PREFIXES = /^mmtrix_|^mmtrix_/i
10
+ SPECIAL_CASE_KEYS = [
11
+ 'MM_TRIX_ENV', # read by Mmtrix::Control::Frameworks::Ruby
12
+ 'MM_TRIX_LOG' # read by set_log_file
13
+ ]
14
+
15
+ attr_accessor :alias_map, :type_map
16
+
17
+ def initialize
18
+ set_log_file
19
+ set_config_file
20
+
21
+ @alias_map = {}
22
+ @type_map = {}
23
+
24
+ DEFAULTS.each do |config_setting, value|
25
+ self.type_map[config_setting] = value[:type]
26
+ set_aliases(config_setting, value)
27
+ end
28
+
29
+ set_values_from_mmtrix_environment_variables
30
+ end
31
+
32
+ def set_aliases(config_setting, value)
33
+ set_dotted_alias(config_setting)
34
+
35
+ return unless value[:aliases]
36
+ value[:aliases].each do |config_alias|
37
+ self.alias_map[config_alias] = config_setting
38
+ end
39
+ end
40
+
41
+ def set_dotted_alias(original_config_setting)
42
+ config_setting = original_config_setting.to_s
43
+
44
+ if config_setting.include? '.'
45
+ config_alias = config_setting.gsub(/\./,'_').to_sym
46
+ self.alias_map[config_alias] = original_config_setting
47
+ end
48
+ end
49
+
50
+ def set_log_file
51
+ if ENV['MM_TRIX_LOG']
52
+ if ENV['MM_TRIX_LOG'].upcase == 'STDOUT'
53
+ self[:log_file_path] = self[:log_file_name] = 'STDOUT'
54
+ else
55
+ self[:log_file_path] = File.dirname(ENV['MM_TRIX_LOG'])
56
+ self[:log_file_name] = File.basename(ENV['MM_TRIX_LOG'])
57
+ end
58
+ end
59
+ end
60
+
61
+ def set_config_file
62
+ self[:config_path] = ENV['NRCONFIG'] if ENV['NRCONFIG']
63
+ end
64
+
65
+ def set_values_from_mmtrix_environment_variables
66
+ nr_env_var_keys = collect_mmtrix_environment_variable_keys
67
+
68
+ nr_env_var_keys.each do |key|
69
+ next if SPECIAL_CASE_KEYS.include?(key.upcase)
70
+ set_value_from_environment_variable(key)
71
+ end
72
+ end
73
+
74
+ def set_value_from_environment_variable(key)
75
+ config_key = convert_environment_key_to_config_key(key)
76
+ set_key_by_type(config_key, key)
77
+ end
78
+
79
+ def set_key_by_type(config_key, environment_key)
80
+ value = ENV[environment_key]
81
+ type = self.type_map[config_key]
82
+
83
+ if type == String
84
+ self[config_key] = value
85
+ elsif type == Fixnum
86
+ self[config_key] = value.to_i
87
+ elsif type == Float
88
+ self[config_key] = value.to_f
89
+ elsif type == Symbol
90
+ self[config_key] = value.to_sym
91
+ elsif type == Mmtrix::Agent::Configuration::Boolean
92
+ if value =~ /false|off|no/i
93
+ self[config_key] = false
94
+ elsif value != nil
95
+ self[config_key] = true
96
+ end
97
+ else
98
+ ::Mmtrix::Agent.logger.info("#{environment_key} does not have a corresponding configuration setting (#{config_key} does not exist).")
99
+ ::Mmtrix::Agent.logger.info("Run `rake mmtrix:config:docs` or visit https://mmtrix.com/docs/ruby/ruby-agent-configuration to see a list of available configuration settings.")
100
+ self[config_key] = value
101
+ end
102
+ end
103
+
104
+ def convert_environment_key_to_config_key(key)
105
+ stripped_key = key.gsub(SUPPORTED_PREFIXES, '').downcase.to_sym
106
+ self.alias_map[stripped_key] || stripped_key
107
+ end
108
+
109
+ def collect_mmtrix_environment_variable_keys
110
+ ENV.keys.select { |key| key.match(SUPPORTED_PREFIXES) }
111
+ end
112
+
113
+ end
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,51 @@
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/configuration/dotted_hash'
6
+
7
+ module Mmtrix
8
+ module Agent
9
+ module Configuration
10
+ class HighSecuritySource < DottedHash
11
+ def initialize(local_settings)
12
+ super({
13
+ :ssl => true,
14
+
15
+ :capture_params => false,
16
+ :'resque.capture_params' => false,
17
+ :'sidekiq.capture_params' => false,
18
+
19
+ :'transaction_tracer.record_sql' => record_sql_setting(local_settings, :'transaction_tracer.record_sql'),
20
+ :'slow_sql.record_sql' => record_sql_setting(local_settings, :'slow_sql.record_sql'),
21
+ :'mongo.obfuscate_queries' => true,
22
+
23
+ :'custom_insights_events.enabled' => false,
24
+ :'strip_exception_messages.enabled' => true
25
+ })
26
+ end
27
+
28
+ OFF = "off".freeze
29
+ RAW = "raw".freeze
30
+ OBFUSCATED = "obfuscated".freeze
31
+
32
+ SET_TO_OBFUSCATED = [RAW, OBFUSCATED]
33
+
34
+ def record_sql_setting(local_settings, key)
35
+ original_value = local_settings[key]
36
+ result = if SET_TO_OBFUSCATED.include?(original_value)
37
+ OBFUSCATED
38
+ else
39
+ OFF
40
+ end
41
+
42
+ if result != original_value
43
+ Mmtrix::Agent.logger.info("Disabling setting #{key}='#{original_value}' because high security mode is enabled. Value will be '#{result}'")
44
+ end
45
+
46
+ result
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,395 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under Mmtrix's license terms.
3
+ # See https://github.com/mmtrix/rpm/blob/master/LICENSE for complete details.
4
+
5
+ require 'forwardable'
6
+ require 'mmtrix/agent/configuration/mask_defaults'
7
+ require 'mmtrix/agent/configuration/yaml_source'
8
+ require 'mmtrix/agent/configuration/default_source'
9
+ require 'mmtrix/agent/configuration/server_source'
10
+ require 'mmtrix/agent/configuration/environment_source'
11
+ require 'mmtrix/agent/configuration/high_security_source'
12
+
13
+ module Mmtrix
14
+ module Agent
15
+ module Configuration
16
+ class Manager
17
+
18
+ # Defining these explicitly saves object allocations that we incur
19
+ # if we use Forwardable and def_delegators.
20
+ def [](key)
21
+ @cache[key]
22
+ end
23
+
24
+ def has_key?(key)
25
+ @cache.has_key?[key]
26
+ end
27
+
28
+ def keys
29
+ @cache.keys
30
+ end
31
+
32
+ def initialize
33
+ reset_to_defaults
34
+ @callbacks = Hash.new {|hash,key| hash[key] = [] }
35
+ end
36
+
37
+ def add_config_for_testing(source, level=0)
38
+ raise 'Invalid config type for testing' unless [Hash, DottedHash].include?(source.class)
39
+ invoke_callbacks(:add, source)
40
+ @configs_for_testing << [source.freeze, level]
41
+ reset_cache
42
+ log_config(:add, source)
43
+ end
44
+
45
+ def remove_config_type(sym)
46
+ source = case sym
47
+ when :high_security then @high_security_source
48
+ when :environment then @environment_source
49
+ when :server then @server_source
50
+ when :manual then @manual_source
51
+ when :yaml then @yaml_source
52
+ when :default then @default_source
53
+ end
54
+
55
+ remove_config(source)
56
+ end
57
+
58
+ def remove_config(source)
59
+ case source
60
+ when HighSecuritySource then @high_security_source = nil
61
+ when EnvironmentSource then @environment_source = nil
62
+ when ServerSource then @server_source = nil
63
+ when ManualSource then @manual_source = nil
64
+ when YamlSource then @yaml_source = nil
65
+ when DefaultSource then @default_source = nil
66
+ else
67
+ @configs_for_testing.delete_if {|src,lvl| src == source}
68
+ end
69
+
70
+ reset_cache
71
+ invoke_callbacks(:remove, source)
72
+ log_config(:remove, source)
73
+ end
74
+
75
+ def replace_or_add_config(source)
76
+ source.freeze
77
+ was_finished = finished_configuring?
78
+
79
+ invoke_callbacks(:add, source)
80
+ case source
81
+ when HighSecuritySource then @high_security_source = source
82
+ when EnvironmentSource then @environment_source = source
83
+ when ServerSource then @server_source = source
84
+ when ManualSource then @manual_source = source
85
+ when YamlSource then @yaml_source = source
86
+ when DefaultSource then @default_source = source
87
+ else
88
+ Mmtrix::Agent.logger.warn("Invalid config format; config will be ignored: #{source}")
89
+ end
90
+
91
+ reset_cache
92
+ log_config(:add, source)
93
+
94
+ notify_finished_configuring if !was_finished && finished_configuring?
95
+ end
96
+
97
+ def source(key)
98
+ config_stack.each do |config|
99
+ if config.respond_to?(key.to_sym) || config.has_key?(key.to_sym)
100
+ return config
101
+ end
102
+ end
103
+ end
104
+
105
+ def fetch(key)
106
+ config_stack.each do |config|
107
+ next unless config
108
+ accessor = key.to_sym
109
+
110
+ if config.has_key?(accessor)
111
+ evaluated = evaluate_procs(config[accessor])
112
+
113
+ begin
114
+ return apply_transformations(accessor, evaluated)
115
+ rescue
116
+ next
117
+ end
118
+ end
119
+ end
120
+
121
+ nil
122
+ end
123
+
124
+ def evaluate_procs(value)
125
+ if value.respond_to?(:call)
126
+ instance_eval(&value)
127
+ else
128
+ value
129
+ end
130
+ end
131
+
132
+ def apply_transformations(key, value)
133
+ if transform = transform_from_default(key)
134
+ begin
135
+ transform.call(value)
136
+ rescue => e
137
+ ::Mmtrix::Agent.logger.error("Error applying transformation for #{key}, pre-transform value was: #{value}.", e)
138
+ raise e
139
+ end
140
+ else
141
+ value
142
+ end
143
+ end
144
+
145
+ def transform_from_default(key)
146
+ ::Mmtrix::Agent::Configuration::DefaultSource.transform_for(key)
147
+ end
148
+
149
+ def register_callback(key, &proc)
150
+ @callbacks[key] << proc
151
+ proc.call(@cache[key])
152
+ end
153
+
154
+ def invoke_callbacks(direction, source)
155
+ return unless source
156
+ source.keys.each do |key|
157
+
158
+ if @cache[key] != source[key]
159
+ @callbacks[key].each do |proc|
160
+ if direction == :add
161
+ proc.call(source[key])
162
+ else
163
+ proc.call(@cache[key])
164
+ end
165
+ end
166
+ end
167
+ end
168
+ end
169
+
170
+ def notify_finished_configuring
171
+ Mmtrix::Agent.instance.events.notify(:finished_configuring)
172
+ end
173
+
174
+ def finished_configuring?
175
+ !@server_source.nil?
176
+ end
177
+
178
+ def flattened
179
+ config_stack.reverse.inject({}) do |flat,layer|
180
+ thawed_layer = layer.to_hash.dup
181
+ thawed_layer.each do |k,v|
182
+ begin
183
+ thawed_layer[k] = instance_eval(&v) if v.respond_to?(:call)
184
+ rescue => e
185
+ ::Mmtrix::Agent.logger.debug("#{e.class.name} : #{e.message} - when accessing config key #{k}")
186
+ thawed_layer[k] = nil
187
+ end
188
+ thawed_layer.delete(:config)
189
+ end
190
+ flat.merge(thawed_layer.to_hash)
191
+ end
192
+ end
193
+
194
+ def apply_mask(hash)
195
+ MASK_DEFAULTS. \
196
+ select {|_, proc| proc.call}. \
197
+ each {|key, _| hash.delete(key) }
198
+ hash
199
+ end
200
+
201
+ def to_collector_hash
202
+ DottedHash.new(apply_mask(flattened)).to_hash.delete_if do |k, v|
203
+ default = DEFAULTS[k]
204
+ if default
205
+ default[:exclude_from_reported_settings]
206
+ else
207
+ # In our tests, we add totally bogus configs, because testing.
208
+ # In those cases, there will be no default. So we'll just let
209
+ # them through.
210
+ false
211
+ end
212
+ end
213
+ end
214
+
215
+ def app_names
216
+ case Mmtrix::Agent.config[:app_name]
217
+ when Array then Mmtrix::Agent.config[:app_name]
218
+ when String then Mmtrix::Agent.config[:app_name].split(';')
219
+ else []
220
+ end
221
+ end
222
+
223
+ MALFORMED_LABELS_WARNING = "Skipping malformed labels configuration"
224
+ PARSING_LABELS_FAILURE = "Failure during parsing labels. Ignoring and carrying on with connect."
225
+
226
+ MAX_LABEL_COUNT = 64
227
+ MAX_LABEL_LENGTH = 255
228
+
229
+ def parsed_labels
230
+ case Mmtrix::Agent.config[:labels]
231
+ when String
232
+ parse_labels_from_string
233
+ else
234
+ parse_labels_from_dictionary
235
+ end
236
+ rescue => e
237
+ Mmtrix::Agent.logger.error(PARSING_LABELS_FAILURE, e)
238
+ []
239
+ end
240
+
241
+ def parse_labels_from_string
242
+ labels = Mmtrix::Agent.config[:labels]
243
+ label_pairs = break_label_string_into_pairs(labels)
244
+ make_label_hash(label_pairs, labels)
245
+ end
246
+
247
+ def break_label_string_into_pairs(labels)
248
+ stripped_labels = labels.strip
249
+ stripped_labels.split(';').map do |pair|
250
+ pair.split(':').map(&:strip)
251
+ end
252
+ end
253
+
254
+ def valid_label_pairs?(label_pairs)
255
+ label_pairs.all? do |pair|
256
+ pair.length == 2 &&
257
+ valid_label_item?(pair.first) &&
258
+ valid_label_item?(pair.last)
259
+ end
260
+ end
261
+
262
+ def valid_label_item?(item)
263
+ case item
264
+ when String then !item.empty?
265
+ when Numeric then true
266
+ when true then true
267
+ when false then true
268
+ else false
269
+ end
270
+ end
271
+
272
+ def make_label_hash(pairs, labels = nil)
273
+ # This can accept a hash, so force it down to an array of pairs first
274
+ pairs = Array(pairs)
275
+
276
+ unless valid_label_pairs?(pairs)
277
+ Mmtrix::Agent.logger.warn("#{MALFORMED_LABELS_WARNING}: #{labels||pairs}")
278
+ return []
279
+ end
280
+
281
+ pairs = limit_number_of_labels(pairs)
282
+ pairs = remove_duplicates(pairs)
283
+ pairs.map do |key, value|
284
+ {
285
+ 'label_type' => truncate(key),
286
+ 'label_value' => truncate(value.to_s, key)
287
+ }
288
+ end
289
+ end
290
+
291
+ def truncate(text, key=nil)
292
+ if text.length > MAX_LABEL_LENGTH
293
+ if key
294
+ msg = "The value for the label '#{key}' is longer than the allowed #{MAX_LABEL_LENGTH} and will be truncated. Value = '#{text}'"
295
+ else
296
+ msg = "Label name longer than the allowed #{MAX_LABEL_LENGTH} will be truncated. Name = '#{text}'"
297
+ end
298
+ Mmtrix::Agent.logger.warn(msg)
299
+ text[0..MAX_LABEL_LENGTH-1]
300
+ else
301
+ text
302
+ end
303
+ end
304
+
305
+ def limit_number_of_labels(pairs)
306
+ if pairs.length > MAX_LABEL_COUNT
307
+ Mmtrix::Agent.logger.warn("Too many labels defined. Only taking first #{MAX_LABEL_COUNT}")
308
+ pairs[0...64]
309
+ else
310
+ pairs
311
+ end
312
+ end
313
+
314
+ # We only take the last value provided for a given label type key
315
+ def remove_duplicates(pairs)
316
+ grouped_by_type = pairs.group_by(&:first)
317
+ grouped_by_type.values.map(&:last)
318
+ end
319
+
320
+ def parse_labels_from_dictionary
321
+ make_label_hash(Mmtrix::Agent.config[:labels])
322
+ end
323
+
324
+ # Generally only useful during initial construction and tests
325
+ def reset_to_defaults
326
+ @high_security_source = nil
327
+ @environment_source = EnvironmentSource.new
328
+ @server_source = nil
329
+ @manual_source = nil
330
+ @yaml_source = nil
331
+ @default_source = DefaultSource.new
332
+
333
+ @configs_for_testing = []
334
+
335
+ reset_cache
336
+ end
337
+
338
+ def reset_cache
339
+ @cache = Hash.new {|hash,key| hash[key] = self.fetch(key) }
340
+ end
341
+
342
+ def log_config(direction, source)
343
+ # Just generating this log message (specifically calling
344
+ # flattened.inspect) is expensive enough that we don't want to do it
345
+ # unless we're actually going to be logging the message based on our
346
+ # current log level.
347
+ ::Mmtrix::Agent.logger.debug do
348
+ "Updating config (#{direction}) from #{source.class}. Results: #{flattened.inspect}"
349
+ end
350
+ end
351
+
352
+ def delete_all_configs_for_testing
353
+ @high_security_source = nil
354
+ @environment_source = nil
355
+ @server_source = nil
356
+ @manual_source = nil
357
+ @yaml_source = nil
358
+ @default_source = nil
359
+ @configs_for_testing = []
360
+ end
361
+
362
+ def num_configs_for_testing
363
+ config_stack.size
364
+ end
365
+
366
+ def config_classes_for_testing
367
+ config_stack.map(&:class)
368
+ end
369
+
370
+ private
371
+
372
+ def config_stack
373
+ stack = [@high_security_source,
374
+ @environment_source,
375
+ @server_source,
376
+ @manual_source,
377
+ @yaml_source,
378
+ @default_source]
379
+
380
+ stack.compact!
381
+
382
+ @configs_for_testing.each do |config, at_start|
383
+ if at_start
384
+ stack.insert(0, config)
385
+ else
386
+ stack.push(config)
387
+ end
388
+ end
389
+
390
+ stack
391
+ end
392
+ end
393
+ end
394
+ end
395
+ end
@@ -0,0 +1,17 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under Mmtrix's license terms.
3
+ # See https://github.com/mmtrix/rpm/blob/master/LICENSE for complete details.
4
+
5
+ require 'mmtrix/agent/configuration/dotted_hash'
6
+
7
+ module Mmtrix
8
+ module Agent
9
+ module Configuration
10
+ class ManualSource < DottedHash
11
+ def initialize(hash)
12
+ super(hash, true)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,14 @@
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 Configuration
8
+ MASK_DEFAULTS = {
9
+ :'thread_profiler' => Proc.new { !Mmtrix::Agent::Threading::BacktraceService.is_supported? },
10
+ :'thread_profiler.enabled' => Proc.new { !Mmtrix::Agent::Threading::BacktraceService.is_supported? }
11
+ }
12
+ end
13
+ end
14
+ end