techarch-newrelic_rpm 2.10.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +335 -0
- data/LICENSE +37 -0
- data/Manifest +159 -0
- data/README.md +138 -0
- data/Rakefile +22 -0
- data/bin/mongrel_rpm +33 -0
- data/bin/newrelic_cmd +4 -0
- data/cert/cacert.pem +34 -0
- data/init.rb +38 -0
- data/install.rb +45 -0
- data/lib/new_relic/agent.rb +281 -0
- data/lib/new_relic/agent/agent.rb +636 -0
- data/lib/new_relic/agent/chained_call.rb +13 -0
- data/lib/new_relic/agent/collection_helper.rb +66 -0
- data/lib/new_relic/agent/error_collector.rb +121 -0
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +18 -0
- data/lib/new_relic/agent/instrumentation/active_record_instrumentation.rb +88 -0
- data/lib/new_relic/agent/instrumentation/authlogic.rb +8 -0
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +437 -0
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +90 -0
- data/lib/new_relic/agent/instrumentation/dispatcher_instrumentation.rb +167 -0
- data/lib/new_relic/agent/instrumentation/memcache.rb +24 -0
- data/lib/new_relic/agent/instrumentation/merb/controller.rb +26 -0
- data/lib/new_relic/agent/instrumentation/merb/dispatcher.rb +13 -0
- data/lib/new_relic/agent/instrumentation/merb/errors.rb +8 -0
- data/lib/new_relic/agent/instrumentation/net.rb +23 -0
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +20 -0
- data/lib/new_relic/agent/instrumentation/rack.rb +108 -0
- data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +59 -0
- data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +27 -0
- data/lib/new_relic/agent/instrumentation/rails/dispatcher.rb +41 -0
- data/lib/new_relic/agent/instrumentation/rails/errors.rb +27 -0
- data/lib/new_relic/agent/instrumentation/sinatra.rb +39 -0
- data/lib/new_relic/agent/method_tracer.rb +349 -0
- data/lib/new_relic/agent/patch_const_missing.rb +125 -0
- data/lib/new_relic/agent/sampler.rb +12 -0
- data/lib/new_relic/agent/samplers/cpu_sampler.rb +49 -0
- data/lib/new_relic/agent/samplers/memory_sampler.rb +138 -0
- data/lib/new_relic/agent/samplers/mongrel_sampler.rb +22 -0
- data/lib/new_relic/agent/shim_agent.rb +21 -0
- data/lib/new_relic/agent/stats_engine.rb +22 -0
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +111 -0
- data/lib/new_relic/agent/stats_engine/samplers.rb +71 -0
- data/lib/new_relic/agent/stats_engine/transactions.rb +152 -0
- data/lib/new_relic/agent/transaction_sampler.rb +310 -0
- data/lib/new_relic/agent/worker_loop.rb +118 -0
- data/lib/new_relic/commands/deployments.rb +145 -0
- data/lib/new_relic/commands/new_relic_commands.rb +30 -0
- data/lib/new_relic/control.rb +473 -0
- data/lib/new_relic/control/external.rb +13 -0
- data/lib/new_relic/control/merb.rb +22 -0
- data/lib/new_relic/control/rails.rb +145 -0
- data/lib/new_relic/control/ruby.rb +36 -0
- data/lib/new_relic/control/sinatra.rb +14 -0
- data/lib/new_relic/histogram.rb +89 -0
- data/lib/new_relic/local_environment.rb +328 -0
- data/lib/new_relic/merbtasks.rb +6 -0
- data/lib/new_relic/metric_data.rb +42 -0
- data/lib/new_relic/metric_parser.rb +124 -0
- data/lib/new_relic/metric_parser/action_mailer.rb +9 -0
- data/lib/new_relic/metric_parser/active_merchant.rb +26 -0
- data/lib/new_relic/metric_parser/active_record.rb +25 -0
- data/lib/new_relic/metric_parser/controller.rb +54 -0
- data/lib/new_relic/metric_parser/controller_cpu.rb +38 -0
- data/lib/new_relic/metric_parser/errors.rb +6 -0
- data/lib/new_relic/metric_parser/external.rb +50 -0
- data/lib/new_relic/metric_parser/mem_cache.rb +12 -0
- data/lib/new_relic/metric_parser/view.rb +61 -0
- data/lib/new_relic/metric_parser/web_frontend.rb +14 -0
- data/lib/new_relic/metric_parser/web_service.rb +9 -0
- data/lib/new_relic/metric_spec.rb +52 -0
- data/lib/new_relic/metrics.rb +7 -0
- data/lib/new_relic/noticed_error.rb +23 -0
- data/lib/new_relic/rack/metric_app.rb +56 -0
- data/lib/new_relic/rack/newrelic.ru +25 -0
- data/lib/new_relic/rack/newrelic.yml +25 -0
- data/lib/new_relic/rack_app.rb +5 -0
- data/lib/new_relic/recipes.rb +82 -0
- data/lib/new_relic/stats.rb +361 -0
- data/lib/new_relic/transaction_analysis.rb +121 -0
- data/lib/new_relic/transaction_sample.rb +666 -0
- data/lib/new_relic/version.rb +54 -0
- data/lib/new_relic_api.rb +313 -0
- data/lib/newrelic_rpm.rb +40 -0
- data/lib/tasks/all.rb +4 -0
- data/lib/tasks/install.rake +7 -0
- data/lib/tasks/tests.rake +13 -0
- data/newrelic.yml +227 -0
- data/recipes/newrelic.rb +6 -0
- data/techarch-newrelic_rpm.gemspec +32 -0
- data/test/active_record_fixtures.rb +55 -0
- data/test/config/newrelic.yml +46 -0
- data/test/config/test_control.rb +39 -0
- data/test/new_relic/agent/active_record_instrumentation_test.rb +264 -0
- data/test/new_relic/agent/agent_controller_test.rb +107 -0
- data/test/new_relic/agent/agent_test.rb +119 -0
- data/test/new_relic/agent/agent_test_controller.rb +44 -0
- data/test/new_relic/agent/classloader_patch_test.rb +56 -0
- data/test/new_relic/agent/collection_helper_test.rb +125 -0
- data/test/new_relic/agent/dispatcher_instrumentation_test.rb +76 -0
- data/test/new_relic/agent/error_collector_test.rb +172 -0
- data/test/new_relic/agent/method_tracer_test.rb +340 -0
- data/test/new_relic/agent/metric_data_test.rb +56 -0
- data/test/new_relic/agent/mock_ar_connection.rb +40 -0
- data/test/new_relic/agent/mock_scope_listener.rb +23 -0
- data/test/new_relic/agent/net_instrumentation_test.rb +63 -0
- data/test/new_relic/agent/stats_engine/metric_stats_test.rb +79 -0
- data/test/new_relic/agent/stats_engine/samplers_test.rb +81 -0
- data/test/new_relic/agent/stats_engine/stats_engine_test.rb +184 -0
- data/test/new_relic/agent/task_instrumentation_test.rb +126 -0
- data/test/new_relic/agent/testable_agent.rb +13 -0
- data/test/new_relic/agent/transaction_sample_builder_test.rb +195 -0
- data/test/new_relic/agent/transaction_sample_test.rb +186 -0
- data/test/new_relic/agent/transaction_sampler_test.rb +385 -0
- data/test/new_relic/agent/worker_loop_test.rb +103 -0
- data/test/new_relic/control_test.rb +113 -0
- data/test/new_relic/deployments_api_test.rb +68 -0
- data/test/new_relic/environment_test.rb +75 -0
- data/test/new_relic/metric_parser_test.rb +172 -0
- data/test/new_relic/metric_spec_test.rb +177 -0
- data/test/new_relic/shim_agent_test.rb +9 -0
- data/test/new_relic/stats_test.rb +291 -0
- data/test/new_relic/version_number_test.rb +74 -0
- data/test/test_helper.rb +38 -0
- data/test/ui/newrelic_controller_test.rb +14 -0
- data/test/ui/newrelic_helper_test.rb +53 -0
- data/ui/controllers/newrelic_controller.rb +220 -0
- data/ui/helpers/google_pie_chart.rb +55 -0
- data/ui/helpers/newrelic_helper.rb +317 -0
- data/ui/views/layouts/newrelic_default.rhtml +47 -0
- data/ui/views/newrelic/_explain_plans.rhtml +27 -0
- data/ui/views/newrelic/_sample.rhtml +19 -0
- data/ui/views/newrelic/_segment.rhtml +28 -0
- data/ui/views/newrelic/_segment_limit_message.rhtml +1 -0
- data/ui/views/newrelic/_segment_row.rhtml +14 -0
- data/ui/views/newrelic/_show_sample_detail.rhtml +24 -0
- data/ui/views/newrelic/_show_sample_sql.rhtml +20 -0
- data/ui/views/newrelic/_show_sample_summary.rhtml +3 -0
- data/ui/views/newrelic/_sql_row.rhtml +11 -0
- data/ui/views/newrelic/_stack_trace.rhtml +30 -0
- data/ui/views/newrelic/_table.rhtml +12 -0
- data/ui/views/newrelic/explain_sql.rhtml +42 -0
- data/ui/views/newrelic/images/arrow-close.png +0 -0
- data/ui/views/newrelic/images/arrow-open.png +0 -0
- data/ui/views/newrelic/images/blue_bar.gif +0 -0
- data/ui/views/newrelic/images/file_icon.png +0 -0
- data/ui/views/newrelic/images/gray_bar.gif +0 -0
- data/ui/views/newrelic/images/new_relic_rpm_desktop.gif +0 -0
- data/ui/views/newrelic/images/textmate.png +0 -0
- data/ui/views/newrelic/index.rhtml +57 -0
- data/ui/views/newrelic/javascript/prototype-scriptaculous.js +7288 -0
- data/ui/views/newrelic/javascript/transaction_sample.js +107 -0
- data/ui/views/newrelic/sample_not_found.rhtml +2 -0
- data/ui/views/newrelic/show_sample.rhtml +80 -0
- data/ui/views/newrelic/show_source.rhtml +3 -0
- data/ui/views/newrelic/stylesheets/style.css +484 -0
- data/ui/views/newrelic/threads.rhtml +52 -0
- metadata +330 -0
data/recipes/newrelic.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{techarch-newrelic_rpm}
|
5
|
+
s.version = "2.10.2"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Bill Kayser" , "Philippe F. Monnet"]
|
9
|
+
s.email = ["bkayser@newrelic.com", "pfmonnet@gmail.com"]
|
10
|
+
s.date = %q{2009-11-04}
|
11
|
+
s.description = %q{New Relic Ruby Performance Monitoring Agent}
|
12
|
+
s.executables = ["mongrel_rpm", "newrelic_cmd"]
|
13
|
+
s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.md", "bin/mongrel_rpm", "bin/newrelic_cmd", "lib/new_relic/agent.rb", "lib/new_relic/agent/agent.rb", "lib/new_relic/agent/chained_call.rb", "lib/new_relic/agent/collection_helper.rb", "lib/new_relic/agent/error_collector.rb", "lib/new_relic/agent/instrumentation/active_merchant.rb", "lib/new_relic/agent/instrumentation/active_record_instrumentation.rb", "lib/new_relic/agent/instrumentation/authlogic.rb", "lib/new_relic/agent/instrumentation/controller_instrumentation.rb", "lib/new_relic/agent/instrumentation/data_mapper.rb", "lib/new_relic/agent/instrumentation/dispatcher_instrumentation.rb", "lib/new_relic/agent/instrumentation/memcache.rb", "lib/new_relic/agent/instrumentation/merb/controller.rb", "lib/new_relic/agent/instrumentation/merb/dispatcher.rb", "lib/new_relic/agent/instrumentation/merb/errors.rb", "lib/new_relic/agent/instrumentation/net.rb", "lib/new_relic/agent/instrumentation/passenger_instrumentation.rb", "lib/new_relic/agent/instrumentation/rack.rb", "lib/new_relic/agent/instrumentation/rails/action_controller.rb", "lib/new_relic/agent/instrumentation/rails/action_web_service.rb", "lib/new_relic/agent/instrumentation/rails/dispatcher.rb", "lib/new_relic/agent/instrumentation/rails/errors.rb", "lib/new_relic/agent/instrumentation/sinatra.rb", "lib/new_relic/agent/method_tracer.rb", "lib/new_relic/agent/patch_const_missing.rb", "lib/new_relic/agent/sampler.rb", "lib/new_relic/agent/samplers/cpu_sampler.rb", "lib/new_relic/agent/samplers/memory_sampler.rb", "lib/new_relic/agent/samplers/mongrel_sampler.rb", "lib/new_relic/agent/shim_agent.rb", "lib/new_relic/agent/stats_engine.rb", "lib/new_relic/agent/stats_engine/metric_stats.rb", "lib/new_relic/agent/stats_engine/samplers.rb", "lib/new_relic/agent/stats_engine/transactions.rb", "lib/new_relic/agent/transaction_sampler.rb", "lib/new_relic/agent/worker_loop.rb", "lib/new_relic/commands/deployments.rb", "lib/new_relic/commands/new_relic_commands.rb", "lib/new_relic/control.rb", "lib/new_relic/control/external.rb", "lib/new_relic/control/merb.rb", "lib/new_relic/control/rails.rb", "lib/new_relic/control/ruby.rb", "lib/new_relic/control/sinatra.rb", "lib/new_relic/histogram.rb", "lib/new_relic/local_environment.rb", "lib/new_relic/merbtasks.rb", "lib/new_relic/metric_data.rb", "lib/new_relic/metric_parser.rb", "lib/new_relic/metric_parser/action_mailer.rb", "lib/new_relic/metric_parser/active_merchant.rb", "lib/new_relic/metric_parser/active_record.rb", "lib/new_relic/metric_parser/controller.rb", "lib/new_relic/metric_parser/controller_cpu.rb", "lib/new_relic/metric_parser/errors.rb", "lib/new_relic/metric_parser/external.rb", "lib/new_relic/metric_parser/mem_cache.rb", "lib/new_relic/metric_parser/view.rb", "lib/new_relic/metric_parser/web_frontend.rb", "lib/new_relic/metric_parser/web_service.rb", "lib/new_relic/metric_spec.rb", "lib/new_relic/metrics.rb", "lib/new_relic/noticed_error.rb", "lib/new_relic/rack/metric_app.rb", "lib/new_relic/rack/newrelic.ru", "lib/new_relic/rack/newrelic.yml", "lib/new_relic/rack_app.rb", "lib/new_relic/recipes.rb", "lib/new_relic/stats.rb", "lib/new_relic/transaction_analysis.rb", "lib/new_relic/transaction_sample.rb", "lib/new_relic/version.rb", "lib/new_relic_api.rb", "lib/newrelic_rpm.rb", "lib/tasks/all.rb", "lib/tasks/install.rake", "lib/tasks/tests.rake"]
|
14
|
+
s.files = ["CHANGELOG", "LICENSE", "README.md", "Rakefile", "bin/mongrel_rpm", "bin/newrelic_cmd", "cert/cacert.pem", "init.rb", "install.rb", "lib/new_relic/agent.rb", "lib/new_relic/agent/agent.rb", "lib/new_relic/agent/chained_call.rb", "lib/new_relic/agent/collection_helper.rb", "lib/new_relic/agent/error_collector.rb", "lib/new_relic/agent/instrumentation/active_merchant.rb", "lib/new_relic/agent/instrumentation/active_record_instrumentation.rb", "lib/new_relic/agent/instrumentation/authlogic.rb", "lib/new_relic/agent/instrumentation/controller_instrumentation.rb", "lib/new_relic/agent/instrumentation/data_mapper.rb", "lib/new_relic/agent/instrumentation/dispatcher_instrumentation.rb", "lib/new_relic/agent/instrumentation/memcache.rb", "lib/new_relic/agent/instrumentation/merb/controller.rb", "lib/new_relic/agent/instrumentation/merb/dispatcher.rb", "lib/new_relic/agent/instrumentation/merb/errors.rb", "lib/new_relic/agent/instrumentation/net.rb", "lib/new_relic/agent/instrumentation/passenger_instrumentation.rb", "lib/new_relic/agent/instrumentation/rack.rb", "lib/new_relic/agent/instrumentation/rails/action_controller.rb", "lib/new_relic/agent/instrumentation/rails/action_web_service.rb", "lib/new_relic/agent/instrumentation/rails/dispatcher.rb", "lib/new_relic/agent/instrumentation/rails/errors.rb", "lib/new_relic/agent/instrumentation/sinatra.rb", "lib/new_relic/agent/method_tracer.rb", "lib/new_relic/agent/patch_const_missing.rb", "lib/new_relic/agent/sampler.rb", "lib/new_relic/agent/samplers/cpu_sampler.rb", "lib/new_relic/agent/samplers/memory_sampler.rb", "lib/new_relic/agent/samplers/mongrel_sampler.rb", "lib/new_relic/agent/shim_agent.rb", "lib/new_relic/agent/stats_engine.rb", "lib/new_relic/agent/stats_engine/metric_stats.rb", "lib/new_relic/agent/stats_engine/samplers.rb", "lib/new_relic/agent/stats_engine/transactions.rb", "lib/new_relic/agent/transaction_sampler.rb", "lib/new_relic/agent/worker_loop.rb", "lib/new_relic/commands/deployments.rb", "lib/new_relic/commands/new_relic_commands.rb", "lib/new_relic/control.rb", "lib/new_relic/control/external.rb", "lib/new_relic/control/merb.rb", "lib/new_relic/control/rails.rb", "lib/new_relic/control/ruby.rb", "lib/new_relic/control/sinatra.rb", "lib/new_relic/histogram.rb", "lib/new_relic/local_environment.rb", "lib/new_relic/merbtasks.rb", "lib/new_relic/metric_data.rb", "lib/new_relic/metric_parser.rb", "lib/new_relic/metric_parser/action_mailer.rb", "lib/new_relic/metric_parser/active_merchant.rb", "lib/new_relic/metric_parser/active_record.rb", "lib/new_relic/metric_parser/controller.rb", "lib/new_relic/metric_parser/controller_cpu.rb", "lib/new_relic/metric_parser/errors.rb", "lib/new_relic/metric_parser/external.rb", "lib/new_relic/metric_parser/mem_cache.rb", "lib/new_relic/metric_parser/view.rb", "lib/new_relic/metric_parser/web_frontend.rb", "lib/new_relic/metric_parser/web_service.rb", "lib/new_relic/metric_spec.rb", "lib/new_relic/metrics.rb", "lib/new_relic/noticed_error.rb", "lib/new_relic/rack/metric_app.rb", "lib/new_relic/rack/newrelic.ru", "lib/new_relic/rack/newrelic.yml", "lib/new_relic/rack_app.rb", "lib/new_relic/recipes.rb", "lib/new_relic/stats.rb", "lib/new_relic/transaction_analysis.rb", "lib/new_relic/transaction_sample.rb", "lib/new_relic/version.rb", "lib/new_relic_api.rb", "lib/newrelic_rpm.rb", "lib/tasks/all.rb", "lib/tasks/install.rake", "lib/tasks/tests.rake", "newrelic.yml", "recipes/newrelic.rb", "test/active_record_fixtures.rb", "test/config/newrelic.yml", "test/config/test_control.rb", "test/new_relic/agent/active_record_instrumentation_test.rb", "test/new_relic/agent/agent_controller_test.rb", "test/new_relic/agent/agent_test.rb", "test/new_relic/agent/agent_test_controller.rb", "test/new_relic/agent/classloader_patch_test.rb", "test/new_relic/agent/collection_helper_test.rb", "test/new_relic/agent/dispatcher_instrumentation_test.rb", "test/new_relic/agent/error_collector_test.rb", "test/new_relic/agent/method_tracer_test.rb", "test/new_relic/agent/metric_data_test.rb", "test/new_relic/agent/mock_ar_connection.rb", "test/new_relic/agent/mock_scope_listener.rb", "test/new_relic/agent/net_instrumentation_test.rb", "test/new_relic/agent/stats_engine/metric_stats_test.rb", "test/new_relic/agent/stats_engine/samplers_test.rb", "test/new_relic/agent/stats_engine/stats_engine_test.rb", "test/new_relic/agent/task_instrumentation_test.rb", "test/new_relic/agent/testable_agent.rb", "test/new_relic/agent/transaction_sample_builder_test.rb", "test/new_relic/agent/transaction_sample_test.rb", "test/new_relic/agent/transaction_sampler_test.rb", "test/new_relic/agent/worker_loop_test.rb", "test/new_relic/control_test.rb", "test/new_relic/deployments_api_test.rb", "test/new_relic/environment_test.rb", "test/new_relic/metric_parser_test.rb", "test/new_relic/metric_spec_test.rb", "test/new_relic/shim_agent_test.rb", "test/new_relic/stats_test.rb", "test/new_relic/version_number_test.rb", "test/test_helper.rb", "test/ui/newrelic_controller_test.rb", "test/ui/newrelic_helper_test.rb", "ui/controllers/newrelic_controller.rb", "ui/helpers/google_pie_chart.rb", "ui/helpers/newrelic_helper.rb", "ui/views/layouts/newrelic_default.rhtml", "ui/views/newrelic/_explain_plans.rhtml", "ui/views/newrelic/_sample.rhtml", "ui/views/newrelic/_segment.rhtml", "ui/views/newrelic/_segment_limit_message.rhtml", "ui/views/newrelic/_segment_row.rhtml", "ui/views/newrelic/_show_sample_detail.rhtml", "ui/views/newrelic/_show_sample_sql.rhtml", "ui/views/newrelic/_show_sample_summary.rhtml", "ui/views/newrelic/_sql_row.rhtml", "ui/views/newrelic/_stack_trace.rhtml", "ui/views/newrelic/_table.rhtml", "ui/views/newrelic/explain_sql.rhtml", "ui/views/newrelic/images/arrow-close.png", "ui/views/newrelic/images/arrow-open.png", "ui/views/newrelic/images/blue_bar.gif", "ui/views/newrelic/images/file_icon.png", "ui/views/newrelic/images/gray_bar.gif", "ui/views/newrelic/images/new_relic_rpm_desktop.gif", "ui/views/newrelic/images/textmate.png", "ui/views/newrelic/index.rhtml", "ui/views/newrelic/javascript/prototype-scriptaculous.js", "ui/views/newrelic/javascript/transaction_sample.js", "ui/views/newrelic/sample_not_found.rhtml", "ui/views/newrelic/show_sample.rhtml", "ui/views/newrelic/show_source.rhtml", "ui/views/newrelic/stylesheets/style.css", "ui/views/newrelic/threads.rhtml", "Manifest", "techarch-newrelic_rpm.gemspec"]
|
15
|
+
s.homepage = %q{http://www.newrelic.com}
|
16
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "techarch-newrelic_rpm", "--main", "README.md"]
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
s.rubyforge_project = %q{newrelic}
|
19
|
+
s.rubygems_version = %q{1.3.5}
|
20
|
+
s.summary = %q{New Relic Ruby Performance Monitoring Agent}
|
21
|
+
s.test_files = ["test/config/test_control.rb", "test/new_relic/agent/active_record_instrumentation_test.rb", "test/new_relic/agent/agent_controller_test.rb", "test/new_relic/agent/agent_test.rb", "test/new_relic/agent/classloader_patch_test.rb", "test/new_relic/agent/collection_helper_test.rb", "test/new_relic/agent/dispatcher_instrumentation_test.rb", "test/new_relic/agent/error_collector_test.rb", "test/new_relic/agent/method_tracer_test.rb", "test/new_relic/agent/metric_data_test.rb", "test/new_relic/agent/net_instrumentation_test.rb", "test/new_relic/agent/stats_engine/metric_stats_test.rb", "test/new_relic/agent/stats_engine/samplers_test.rb", "test/new_relic/agent/stats_engine/stats_engine_test.rb", "test/new_relic/agent/task_instrumentation_test.rb", "test/new_relic/agent/transaction_sample_builder_test.rb", "test/new_relic/agent/transaction_sample_test.rb", "test/new_relic/agent/transaction_sampler_test.rb", "test/new_relic/agent/worker_loop_test.rb", "test/new_relic/control_test.rb", "test/new_relic/deployments_api_test.rb", "test/new_relic/environment_test.rb", "test/new_relic/metric_parser_test.rb", "test/new_relic/metric_spec_test.rb", "test/new_relic/shim_agent_test.rb", "test/new_relic/stats_test.rb", "test/new_relic/version_number_test.rb", "test/test_helper.rb", "test/ui/newrelic_controller_test.rb", "test/ui/newrelic_helper_test.rb"]
|
22
|
+
|
23
|
+
if s.respond_to? :specification_version then
|
24
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
25
|
+
s.specification_version = 3
|
26
|
+
|
27
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
28
|
+
else
|
29
|
+
end
|
30
|
+
else
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# Some test models
|
2
|
+
# These will get created and dropped during the active record tests
|
3
|
+
# Be sure and call setup and teardown
|
4
|
+
module ActiveRecordFixtures
|
5
|
+
extend self
|
6
|
+
def setup
|
7
|
+
ActiveRecordFixtures::Order.setup
|
8
|
+
ActiveRecordFixtures::Shipment.setup
|
9
|
+
end
|
10
|
+
def teardown
|
11
|
+
ActiveRecordFixtures::Shipment.teardown
|
12
|
+
ActiveRecordFixtures::Order.teardown
|
13
|
+
end
|
14
|
+
class Order < ActiveRecord::Base
|
15
|
+
self.table_name = 'newrelic_test_orders'
|
16
|
+
has_and_belongs_to_many :shipments, :class_name => 'ActiveRecordFixtures::Shipment'
|
17
|
+
def self.setup
|
18
|
+
connection.create_table self.table_name, :force => true do |t|
|
19
|
+
t.column :name, :string
|
20
|
+
end
|
21
|
+
end
|
22
|
+
def self.add_delay
|
23
|
+
# Introduce a 500 ms delay into db operations on Orders
|
24
|
+
def connection.log_info *args
|
25
|
+
sleep 0.5
|
26
|
+
super *args
|
27
|
+
end
|
28
|
+
end
|
29
|
+
def self.teardown
|
30
|
+
connection.drop_table table_name
|
31
|
+
def connection.log_info *args
|
32
|
+
super *args
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class Shipment < ActiveRecord::Base
|
38
|
+
self.table_name = 'newrelic_test_shipment'
|
39
|
+
has_and_belongs_to_many :orders, :class_name => 'ActiveRecordFixtures::Order'
|
40
|
+
def self.setup
|
41
|
+
connection.create_table self.table_name, :force => true do |t|
|
42
|
+
# no other columns
|
43
|
+
end
|
44
|
+
connection.create_table 'orders_shipments', :force => true, :id => false do |t|
|
45
|
+
t.column :order_id, :integer
|
46
|
+
t.column :shipment_id, :integer
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.teardown
|
51
|
+
connection.drop_table 'orders_shipments'
|
52
|
+
connection.drop_table self.table_name
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# This is the config file loaded when running unit tests locally.
|
2
|
+
common: &default_settings
|
3
|
+
transaction_tracer:
|
4
|
+
enabled: true
|
5
|
+
record_sql: raw
|
6
|
+
|
7
|
+
test:
|
8
|
+
<<: *default_settings
|
9
|
+
host: localhost
|
10
|
+
port: 3000
|
11
|
+
log_level: info
|
12
|
+
capture_params: true
|
13
|
+
enabled: false
|
14
|
+
developer: true
|
15
|
+
monitor_daemons: false
|
16
|
+
disable_samplers: true
|
17
|
+
api_host: 127.0.0.1
|
18
|
+
api_port: 443
|
19
|
+
message: '<%= generated_for_user %>'
|
20
|
+
license_key: '<%= license_key %>'
|
21
|
+
agent_enabled: auto
|
22
|
+
apdex_t: 1.1
|
23
|
+
|
24
|
+
# Some fixtures for newrelic.yml parsing tests
|
25
|
+
erb_value: <%= 'hey'*3 %>
|
26
|
+
tval: true
|
27
|
+
tstring: 'true'
|
28
|
+
fval: false
|
29
|
+
yval: yes
|
30
|
+
sval: sure
|
31
|
+
|
32
|
+
# checks for loading classes on the background thread
|
33
|
+
check_bg_loading: true
|
34
|
+
|
35
|
+
transaction_tracer:
|
36
|
+
record_sql: raw
|
37
|
+
transaction_threshold: Apdex_f # case insensitive
|
38
|
+
explain_threshold: 0.1
|
39
|
+
explain_enabled: true
|
40
|
+
stack_trace_threshold: 0.1
|
41
|
+
|
42
|
+
error_collector:
|
43
|
+
enabled: true
|
44
|
+
capture_source: true
|
45
|
+
|
46
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'new_relic/control/rails'
|
2
|
+
require 'new_relic/agent/agent_test_controller'
|
3
|
+
|
4
|
+
class NewRelic::Control::Test < NewRelic::Control::Rails #:nodoc:
|
5
|
+
def env
|
6
|
+
'test'
|
7
|
+
end
|
8
|
+
def app
|
9
|
+
:rails
|
10
|
+
end
|
11
|
+
def config_file
|
12
|
+
File.join(File.dirname(__FILE__), "newrelic.yml")
|
13
|
+
end
|
14
|
+
def initialize local_env
|
15
|
+
super local_env
|
16
|
+
setup_log
|
17
|
+
end
|
18
|
+
# when running tests, don't write out stderr
|
19
|
+
def log!(msg, level=:info)
|
20
|
+
log.send level, msg if log
|
21
|
+
end
|
22
|
+
|
23
|
+
# Add the default route in case it's missing. Need it for testing.
|
24
|
+
def install_devmode_route
|
25
|
+
super
|
26
|
+
ActionController::Routing::RouteSet.class_eval do
|
27
|
+
return if defined? draw_without_test_route
|
28
|
+
def draw_with_test_route
|
29
|
+
draw_without_test_route do | map |
|
30
|
+
map.connect ':controller/:action/:id'
|
31
|
+
yield map
|
32
|
+
end
|
33
|
+
end
|
34
|
+
alias_method_chain :draw, :test_route
|
35
|
+
end
|
36
|
+
# Force the routes to be reloaded
|
37
|
+
ActionController::Routing::Routes.reload!
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,264 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
|
2
|
+
require 'active_record_fixtures'
|
3
|
+
|
4
|
+
class ActiveRecordInstrumentationTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
super
|
8
|
+
NewRelic::Agent.manual_start
|
9
|
+
ActiveRecordFixtures.setup
|
10
|
+
NewRelic::Agent.instance.transaction_sampler.harvest
|
11
|
+
# ActiveRecordFixtures::Order.execute "show tables" # this warms up the connection - which can issue sql statements
|
12
|
+
NewRelic::Agent.instance.stats_engine.clear_stats
|
13
|
+
rescue
|
14
|
+
puts e
|
15
|
+
puts e.backtrace.join("\n")
|
16
|
+
end
|
17
|
+
|
18
|
+
def teardown
|
19
|
+
super
|
20
|
+
ActiveRecordFixtures.teardown
|
21
|
+
end
|
22
|
+
def test_agent_setup
|
23
|
+
assert NewRelic::Agent.instance.class == NewRelic::Agent::Agent
|
24
|
+
end
|
25
|
+
def test_finder
|
26
|
+
ActiveRecordFixtures::Order.create :id => 0, :name => 'jeff'
|
27
|
+
ActiveRecordFixtures::Order.find(:all)
|
28
|
+
s = NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find")
|
29
|
+
assert_equal 1, s.call_count
|
30
|
+
ActiveRecordFixtures::Order.find_all_by_name "jeff"
|
31
|
+
s = NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find")
|
32
|
+
assert_equal 2, s.call_count
|
33
|
+
end
|
34
|
+
|
35
|
+
# multiple duplicate find calls should only cause metric trigger on the first
|
36
|
+
# call. the others are ignored.
|
37
|
+
def test_query_cache
|
38
|
+
ActiveRecordFixtures::Order.cache do
|
39
|
+
m = ActiveRecordFixtures::Order.create :id => 0, :name => 'jeff'
|
40
|
+
ActiveRecordFixtures::Order.find(:all)
|
41
|
+
s = NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find")
|
42
|
+
assert_equal 1, s.call_count
|
43
|
+
|
44
|
+
10.times { ActiveRecordFixtures::Order.find m.id }
|
45
|
+
end
|
46
|
+
s = NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find")
|
47
|
+
assert_equal 2, s.call_count
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_metric_names
|
51
|
+
m = ActiveRecordFixtures::Order.create :id => 0, :name => 'jeff'
|
52
|
+
m = ActiveRecordFixtures::Order.find(m.id)
|
53
|
+
m.id = 999
|
54
|
+
m.save!
|
55
|
+
|
56
|
+
metrics = NewRelic::Agent.instance.stats_engine.metrics
|
57
|
+
# This doesn't work on hudson because the sampler metrics creep in.
|
58
|
+
# metrics = NewRelic::Agent.instance.stats_engine.metrics.select { |mname| mname =~ /ActiveRecord\/ActiveRecordFixtures::Order\// }.sort
|
59
|
+
expected = %W[
|
60
|
+
ActiveRecord/all
|
61
|
+
ActiveRecord/find
|
62
|
+
ActiveRecord/ActiveRecordFixtures::Order/find
|
63
|
+
]
|
64
|
+
expected += %W[Database/SQL/insert] if defined?(JRuby)
|
65
|
+
expected += %W[ActiveRecord/create Database/SQL/other ActiveRecord/ActiveRecordFixtures::Order/create] unless defined?(JRuby)
|
66
|
+
expected += %W[ActiveRecord/save ActiveRecord/ActiveRecordFixtures::Order/save] if NewRelic::Control.instance.rails_version < '2.1.0'
|
67
|
+
compare_metrics expected, metrics
|
68
|
+
assert_equal 1, NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find").call_count
|
69
|
+
assert_equal (defined?(JRuby) ? 0 : 1), NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/create").call_count
|
70
|
+
end
|
71
|
+
def test_join_metrics
|
72
|
+
m = ActiveRecordFixtures::Order.create :name => 'jeff'
|
73
|
+
m = ActiveRecordFixtures::Order.find(m.id)
|
74
|
+
s = m.shipments.create
|
75
|
+
m.shipments.to_a
|
76
|
+
m.destroy
|
77
|
+
|
78
|
+
metrics = NewRelic::Agent.instance.stats_engine.metrics
|
79
|
+
# This doesn't work on hudson because the sampler metrics creep in.
|
80
|
+
# metrics = NewRelic::Agent.instance.stats_engine.metrics.select { |mname| mname =~ /ActiveRecord\/ActiveRecordFixtures::Order\// }.sort
|
81
|
+
expected_metrics = %W[
|
82
|
+
ActiveRecord/all
|
83
|
+
ActiveRecord/destroy
|
84
|
+
ActiveRecord/ActiveRecordFixtures::Order/destroy
|
85
|
+
Database/SQL/insert
|
86
|
+
Database/SQL/delete
|
87
|
+
ActiveRecord/find
|
88
|
+
ActiveRecord/ActiveRecordFixtures::Order/find
|
89
|
+
ActiveRecord/ActiveRecordFixtures::Shipment/find
|
90
|
+
]
|
91
|
+
|
92
|
+
expected_metrics += %W[Database/SQL/other Database/SQL/show ActiveRecord/create
|
93
|
+
ActiveRecord/ActiveRecordFixtures::Shipment/create
|
94
|
+
ActiveRecord/ActiveRecordFixtures::Order/create
|
95
|
+
] unless defined? JRuby
|
96
|
+
|
97
|
+
compare_metrics expected_metrics, metrics
|
98
|
+
# This number may be different with different db adapters, not sure
|
99
|
+
# assert_equal 17, NewRelic::Agent.get_stats("ActiveRecord/all").call_count
|
100
|
+
assert_equal NewRelic::Agent.get_stats("ActiveRecord/all").total_exclusive_time, NewRelic::Agent.get_stats("ActiveRecord/all").total_call_time unless defined?(RUBY_DESCRIPTION) && RUBY_DESCRIPTION =~ /Enterprise Edition/
|
101
|
+
assert_equal 1, NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find").call_count
|
102
|
+
assert_equal 1, NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Shipment/find").call_count
|
103
|
+
assert_equal 1, NewRelic::Agent.get_stats("Database/SQL/insert").call_count unless defined? JRuby
|
104
|
+
assert_equal 3, NewRelic::Agent.get_stats("Database/SQL/insert").call_count if defined? JRuby
|
105
|
+
assert_equal 1, NewRelic::Agent.get_stats("Database/SQL/delete").call_count
|
106
|
+
end
|
107
|
+
def test_direct_sql
|
108
|
+
list = ActiveRecordFixtures::Order.connection.select_rows "select * from #{ActiveRecordFixtures::Order.table_name}"
|
109
|
+
metrics = NewRelic::Agent.instance.stats_engine.metrics
|
110
|
+
compare_metrics %W[
|
111
|
+
ActiveRecord/all
|
112
|
+
Database/SQL/select
|
113
|
+
], metrics
|
114
|
+
assert_equal 1, NewRelic::Agent.get_stats("Database/SQL/select").call_count
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_other_sql
|
118
|
+
list = ActiveRecordFixtures::Order.connection.execute "begin"
|
119
|
+
metrics = NewRelic::Agent.instance.stats_engine.metrics
|
120
|
+
compare_metrics %W[
|
121
|
+
ActiveRecord/all
|
122
|
+
Database/SQL/other
|
123
|
+
], metrics
|
124
|
+
assert_equal 1, NewRelic::Agent.get_stats("Database/SQL/other").call_count
|
125
|
+
end
|
126
|
+
|
127
|
+
def test_show_sql
|
128
|
+
list = ActiveRecordFixtures::Order.connection.execute "show tables"
|
129
|
+
metrics = NewRelic::Agent.instance.stats_engine.metrics
|
130
|
+
compare_metrics %W[
|
131
|
+
ActiveRecord/all
|
132
|
+
Database/SQL/show
|
133
|
+
], metrics
|
134
|
+
assert_equal 1, NewRelic::Agent.get_stats("Database/SQL/show").call_count
|
135
|
+
end
|
136
|
+
|
137
|
+
def test_blocked_instrumentation
|
138
|
+
ActiveRecordFixtures::Order.add_delay
|
139
|
+
NewRelic::Agent.disable_all_tracing do
|
140
|
+
ActiveRecordFixtures::Order.find(:all)
|
141
|
+
end
|
142
|
+
assert_nil NewRelic::Agent.instance.transaction_sampler.last_sample
|
143
|
+
metrics = NewRelic::Agent.instance.stats_engine.metrics
|
144
|
+
compare_metrics [], metrics
|
145
|
+
end
|
146
|
+
def test_run_explains
|
147
|
+
ActiveRecordFixtures::Order.add_delay
|
148
|
+
ActiveRecordFixtures::Order.find(:all)
|
149
|
+
|
150
|
+
sample = NewRelic::Agent.instance.transaction_sampler.last_sample
|
151
|
+
|
152
|
+
segment = sample.root_segment.called_segments.first.called_segments.first
|
153
|
+
assert_match /^SELECT \* FROM ["`]?#{ActiveRecordFixtures::Order.table_name}["`]?$/i, segment.params[:sql].strip
|
154
|
+
NewRelic::TransactionSample::Segment.any_instance.expects(:explain_sql).returns([])
|
155
|
+
sample = sample.prepare_to_send(:obfuscate_sql => true, :explain_enabled => true, :explain_sql => 0.0)
|
156
|
+
segment = sample.root_segment.called_segments.first.called_segments.first
|
157
|
+
end
|
158
|
+
def test_prepare_to_send
|
159
|
+
ActiveRecordFixtures::Order.add_delay
|
160
|
+
ActiveRecordFixtures::Order.find(:all)
|
161
|
+
|
162
|
+
sample = NewRelic::Agent.instance.transaction_sampler.last_sample
|
163
|
+
#
|
164
|
+
sql_segment = sample.root_segment.called_segments.first.called_segments.first
|
165
|
+
assert_match /^SELECT /, sql_segment.params[:sql]
|
166
|
+
assert sql_segment.duration > 0.0, "Segment duration must be greater than zero."
|
167
|
+
sample = sample.prepare_to_send(:record_sql => :raw, :explain_enabled => true, :explain_sql => 0.0)
|
168
|
+
sql_segment = sample.root_segment.called_segments.first.called_segments.first
|
169
|
+
assert_match /^SELECT /, sql_segment.params[:sql]
|
170
|
+
explanations = sql_segment.params[:explanation]
|
171
|
+
if isMysql? || isPostgres?
|
172
|
+
assert_not_nil explanations, "No explains in segment: #{sql_segment}"
|
173
|
+
assert_equal 1, explanations.size,"No explains in segment: #{sql_segment}"
|
174
|
+
assert_equal 1, explanations.first.size
|
175
|
+
end
|
176
|
+
end
|
177
|
+
def test_transaction
|
178
|
+
ActiveRecordFixtures::Order.add_delay
|
179
|
+
ActiveRecordFixtures::Order.find(:all)
|
180
|
+
|
181
|
+
sample = NewRelic::Agent.instance.transaction_sampler.last_sample
|
182
|
+
|
183
|
+
sample = sample.prepare_to_send(:obfuscate_sql => true, :explain_enabled => true, :explain_sql => 0.0)
|
184
|
+
segment = sample.root_segment.called_segments.first.called_segments.first
|
185
|
+
assert_nil segment.params[:sql], "SQL should have been removed."
|
186
|
+
explanations = segment.params[:explanation]
|
187
|
+
if isMysql? || isPostgres?
|
188
|
+
assert_not_nil explanations, "No explains in segment: #{segment}"
|
189
|
+
assert_equal 1, explanations.size,"No explains in segment: #{segment}"
|
190
|
+
assert_equal 1, explanations.first.size
|
191
|
+
end
|
192
|
+
if isPostgres?
|
193
|
+
assert_equal Array, explanations.class
|
194
|
+
assert_equal Array, explanations[0].class
|
195
|
+
assert_equal Array, explanations[0][0].class
|
196
|
+
assert_match /Seq Scan on test_data/, explanations[0][0].join(";")
|
197
|
+
elsif isMysql?
|
198
|
+
assert_equal "1;SIMPLE;#{ActiveRecordFixtures::Order.table_name};ALL;;;;;1;", explanations.first.first.join(";")
|
199
|
+
end
|
200
|
+
|
201
|
+
s = NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find")
|
202
|
+
assert_equal 1, s.call_count
|
203
|
+
end
|
204
|
+
# These are only valid for rails 2.1 and later
|
205
|
+
if NewRelic::Control.instance.rails_version >= NewRelic::VersionNumber.new("2.1.0")
|
206
|
+
ActiveRecordFixtures::Order.class_eval do
|
207
|
+
named_scope :jeffs, :conditions => { :name => 'Jeff' }
|
208
|
+
end
|
209
|
+
def test_named_scope
|
210
|
+
ActiveRecordFixtures::Order.create :name => 'Jeff'
|
211
|
+
s = NewRelic::Agent.get_stats("ActiveRecord/ActiveRecordFixtures::Order/find")
|
212
|
+
before_count = s.call_count
|
213
|
+
x = ActiveRecordFixtures::Order.jeffs.find(:all)
|
214
|
+
assert_equal 1, x.size
|
215
|
+
se = NewRelic::Agent.instance.stats_engine
|
216
|
+
assert_equal before_count+1, s.call_count
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
# This is to make sure the all metric is recorded for exceptional cases
|
221
|
+
def test_error_handling
|
222
|
+
# have the AR select throw an error
|
223
|
+
ActiveRecordFixtures::Order.connection.stubs(:log_info).with do | sql, x, y |
|
224
|
+
raise "Error" if sql =~ /select/
|
225
|
+
true
|
226
|
+
end
|
227
|
+
ActiveRecordFixtures::Order.connection.select_rows "select * from #{ActiveRecordFixtures::Order.table_name}" rescue nil
|
228
|
+
metrics = NewRelic::Agent.instance.stats_engine.metrics
|
229
|
+
compare_metrics %W[
|
230
|
+
ActiveRecord/all
|
231
|
+
Database/SQL/select
|
232
|
+
], metrics
|
233
|
+
assert_equal 1, NewRelic::Agent.get_stats("Database/SQL/select").call_count
|
234
|
+
assert_equal 1, NewRelic::Agent.get_stats("ActiveRecord/all").call_count
|
235
|
+
end
|
236
|
+
|
237
|
+
def test_rescue_handling
|
238
|
+
begin
|
239
|
+
ActiveRecordFixtures::Order.transaction do
|
240
|
+
raise ActiveRecord::ActiveRecordError.new('preserve-me!')
|
241
|
+
end
|
242
|
+
rescue ActiveRecord::ActiveRecordError => e
|
243
|
+
assert_equal 'preserve-me!', e.message
|
244
|
+
rescue
|
245
|
+
fail "Rescue2: Got something COMPLETELY unexpected: $!:#{$!.inspect}"
|
246
|
+
end
|
247
|
+
|
248
|
+
end
|
249
|
+
|
250
|
+
private
|
251
|
+
|
252
|
+
def compare_metrics expected_list, actual_list
|
253
|
+
actual = Set.new actual_list
|
254
|
+
actual.delete('GC/cumulative') # in case we are in REE
|
255
|
+
expected = Set.new expected_list
|
256
|
+
assert_equal expected.to_a.sort, actual.to_a.sort, "extra: #{(actual - expected).to_a.join(", ")}; missing: #{(expected - actual).to_a.join(", ")}"
|
257
|
+
end
|
258
|
+
def isPostgres?
|
259
|
+
ActiveRecordFixtures::Order.configurations[RAILS_ENV]['adapter'] =~ /postgres/
|
260
|
+
end
|
261
|
+
def isMysql?
|
262
|
+
ActiveRecordFixtures::Order.connection.class.name =~ /mysql/i
|
263
|
+
end
|
264
|
+
end
|