sundawg_newrelic_rpm 3.5.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +22 -0
- data/.project +23 -0
- data/.travis.yml +9 -0
- data/CHANGELOG +969 -0
- data/GUIDELINES_FOR_CONTRIBUTING.md +76 -0
- data/Gemfile +20 -0
- data/LICENSE +87 -0
- data/README.md +195 -0
- data/Rakefile +58 -0
- data/bin/mongrel_rpm +33 -0
- data/bin/newrelic +13 -0
- data/bin/newrelic_cmd +5 -0
- data/cert/cacert.pem +118 -0
- data/cert/oldsite.pem +28 -0
- data/cert/site.pem +27 -0
- data/config.dot +290 -0
- data/config/database.yml +5 -0
- data/gem-public_cert.pem +20 -0
- data/init.rb +31 -0
- data/install.rb +9 -0
- data/lib/conditional_vendored_dependency_detection.rb +3 -0
- data/lib/conditional_vendored_metric_parser.rb +5 -0
- data/lib/new_relic/agent.rb +488 -0
- data/lib/new_relic/agent/agent.rb +1069 -0
- data/lib/new_relic/agent/agent_logger.rb +173 -0
- data/lib/new_relic/agent/audit_logger.rb +72 -0
- data/lib/new_relic/agent/beacon_configuration.rb +107 -0
- data/lib/new_relic/agent/browser_monitoring.rb +195 -0
- data/lib/new_relic/agent/busy_calculator.rb +112 -0
- data/lib/new_relic/agent/chained_call.rb +13 -0
- data/lib/new_relic/agent/configuration.rb +74 -0
- data/lib/new_relic/agent/configuration/defaults.rb +132 -0
- data/lib/new_relic/agent/configuration/environment_source.rb +49 -0
- data/lib/new_relic/agent/configuration/manager.rb +148 -0
- data/lib/new_relic/agent/configuration/mask_defaults.rb +11 -0
- data/lib/new_relic/agent/configuration/server_source.rb +31 -0
- data/lib/new_relic/agent/configuration/yaml_source.rb +67 -0
- data/lib/new_relic/agent/cross_app_monitor.rb +239 -0
- data/lib/new_relic/agent/cross_app_tracing.rb +281 -0
- data/lib/new_relic/agent/database.rb +254 -0
- data/lib/new_relic/agent/error_collector.rb +266 -0
- data/lib/new_relic/agent/event_listener.rb +43 -0
- data/lib/new_relic/agent/instrumentation.rb +9 -0
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +29 -0
- data/lib/new_relic/agent/instrumentation/active_record.rb +134 -0
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +68 -0
- data/lib/new_relic/agent/instrumentation/authlogic.rb +19 -0
- data/lib/new_relic/agent/instrumentation/browser_monitoring_timings.rb +51 -0
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +485 -0
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +230 -0
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +52 -0
- data/lib/new_relic/agent/instrumentation/memcache.rb +80 -0
- data/lib/new_relic/agent/instrumentation/merb/controller.rb +41 -0
- data/lib/new_relic/agent/instrumentation/merb/errors.rb +29 -0
- data/lib/new_relic/agent/instrumentation/metric_frame.rb +356 -0
- data/lib/new_relic/agent/instrumentation/metric_frame/pop.rb +80 -0
- data/lib/new_relic/agent/instrumentation/net.rb +31 -0
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +23 -0
- data/lib/new_relic/agent/instrumentation/queue_time.rb +68 -0
- data/lib/new_relic/agent/instrumentation/rack.rb +98 -0
- data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +114 -0
- data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +42 -0
- data/lib/new_relic/agent/instrumentation/rails/errors.rb +42 -0
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +180 -0
- data/lib/new_relic/agent/instrumentation/rails3/errors.rb +41 -0
- data/lib/new_relic/agent/instrumentation/rails4/action_controller.rb +145 -0
- data/lib/new_relic/agent/instrumentation/rails4/errors.rb +45 -0
- data/lib/new_relic/agent/instrumentation/resque.rb +81 -0
- data/lib/new_relic/agent/instrumentation/sinatra.rb +107 -0
- data/lib/new_relic/agent/instrumentation/sunspot.rb +29 -0
- data/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb +22 -0
- data/lib/new_relic/agent/method_tracer.rb +530 -0
- data/lib/new_relic/agent/new_relic_service.rb +513 -0
- data/lib/new_relic/agent/pipe_channel_manager.rb +175 -0
- data/lib/new_relic/agent/pipe_service.rb +63 -0
- data/lib/new_relic/agent/rules_engine.rb +72 -0
- data/lib/new_relic/agent/sampler.rb +50 -0
- data/lib/new_relic/agent/samplers/cpu_sampler.rb +58 -0
- data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +86 -0
- data/lib/new_relic/agent/samplers/memory_sampler.rb +141 -0
- data/lib/new_relic/agent/samplers/object_sampler.rb +26 -0
- data/lib/new_relic/agent/shim_agent.rb +28 -0
- data/lib/new_relic/agent/sql_sampler.rb +251 -0
- data/lib/new_relic/agent/stats.rb +149 -0
- data/lib/new_relic/agent/stats_engine.rb +30 -0
- data/lib/new_relic/agent/stats_engine/gc_profiler.rb +116 -0
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +161 -0
- data/lib/new_relic/agent/stats_engine/samplers.rb +97 -0
- data/lib/new_relic/agent/stats_engine/stats_hash.rb +58 -0
- data/lib/new_relic/agent/stats_engine/transactions.rb +145 -0
- data/lib/new_relic/agent/thread.rb +32 -0
- data/lib/new_relic/agent/thread_profiler.rb +319 -0
- data/lib/new_relic/agent/transaction_info.rb +119 -0
- data/lib/new_relic/agent/transaction_sample_builder.rb +126 -0
- data/lib/new_relic/agent/transaction_sampler.rb +459 -0
- data/lib/new_relic/agent/worker_loop.rb +96 -0
- data/lib/new_relic/coerce.rb +37 -0
- data/lib/new_relic/collection_helper.rb +77 -0
- data/lib/new_relic/command.rb +85 -0
- data/lib/new_relic/commands/deployments.rb +114 -0
- data/lib/new_relic/commands/install.rb +80 -0
- data/lib/new_relic/control.rb +44 -0
- data/lib/new_relic/control/class_methods.rb +58 -0
- data/lib/new_relic/control/frameworks.rb +10 -0
- data/lib/new_relic/control/frameworks/external.rb +16 -0
- data/lib/new_relic/control/frameworks/merb.rb +25 -0
- data/lib/new_relic/control/frameworks/rails.rb +173 -0
- data/lib/new_relic/control/frameworks/rails3.rb +71 -0
- data/lib/new_relic/control/frameworks/rails4.rb +23 -0
- data/lib/new_relic/control/frameworks/ruby.rb +21 -0
- data/lib/new_relic/control/frameworks/sinatra.rb +20 -0
- data/lib/new_relic/control/instance_methods.rb +145 -0
- data/lib/new_relic/control/instrumentation.rb +95 -0
- data/lib/new_relic/control/profiling.rb +25 -0
- data/lib/new_relic/control/server_methods.rb +80 -0
- data/lib/new_relic/delayed_job_injection.rb +51 -0
- data/lib/new_relic/helper.rb +66 -0
- data/lib/new_relic/language_support.rb +92 -0
- data/lib/new_relic/latest_changes.rb +31 -0
- data/lib/new_relic/local_environment.rb +385 -0
- data/lib/new_relic/merbtasks.rb +6 -0
- data/lib/new_relic/metric_data.rb +70 -0
- data/lib/new_relic/metric_spec.rb +80 -0
- data/lib/new_relic/metrics.rb +9 -0
- data/lib/new_relic/noticed_error.rb +59 -0
- data/lib/new_relic/okjson.rb +599 -0
- data/lib/new_relic/rack.rb +4 -0
- data/lib/new_relic/rack/agent_hooks.rb +20 -0
- data/lib/new_relic/rack/browser_monitoring.rb +85 -0
- data/lib/new_relic/rack/developer_mode.rb +271 -0
- data/lib/new_relic/rack/error_collector.rb +66 -0
- data/lib/new_relic/recipes.rb +99 -0
- data/lib/new_relic/timer_lib.rb +27 -0
- data/lib/new_relic/transaction_analysis.rb +77 -0
- data/lib/new_relic/transaction_analysis/segment_summary.rb +49 -0
- data/lib/new_relic/transaction_sample.rb +272 -0
- data/lib/new_relic/transaction_sample/composite_segment.rb +27 -0
- data/lib/new_relic/transaction_sample/fake_segment.rb +9 -0
- data/lib/new_relic/transaction_sample/segment.rb +205 -0
- data/lib/new_relic/transaction_sample/summary_segment.rb +21 -0
- data/lib/new_relic/url_rule.rb +14 -0
- data/lib/new_relic/version.rb +66 -0
- data/lib/newrelic_rpm.rb +49 -0
- data/lib/tasks/all.rb +4 -0
- data/lib/tasks/install.rake +7 -0
- data/lib/tasks/tests.rake +17 -0
- data/newrelic.yml +227 -0
- data/newrelic_rpm.gemspec +50 -0
- data/recipes/newrelic.rb +6 -0
- data/test/active_record_fixtures.rb +77 -0
- data/test/config/newrelic.yml +49 -0
- data/test/config/test_control.rb +48 -0
- data/test/fixtures/proc_cpuinfo.txt +575 -0
- data/test/intentional_fail.rb +10 -0
- data/test/multiverse/.gitignore +11 -0
- data/test/multiverse/README.md +85 -0
- data/test/multiverse/lib/multiverse/color.rb +13 -0
- data/test/multiverse/lib/multiverse/envfile.rb +66 -0
- data/test/multiverse/lib/multiverse/environment.rb +16 -0
- data/test/multiverse/lib/multiverse/output_collector.rb +29 -0
- data/test/multiverse/lib/multiverse/runner.rb +44 -0
- data/test/multiverse/lib/multiverse/suite.rb +164 -0
- data/test/multiverse/script/run_one +3 -0
- data/test/multiverse/script/runner +9 -0
- data/test/multiverse/suites/active_record/Envfile +13 -0
- data/test/multiverse/suites/active_record/ar_method_aliasing.rb +94 -0
- data/test/multiverse/suites/active_record/config/newrelic.yml +22 -0
- data/test/multiverse/suites/active_record/encoding_test.rb +26 -0
- data/test/multiverse/suites/agent_only/Envfile +9 -0
- data/test/multiverse/suites/agent_only/audit_log_test.rb +97 -0
- data/test/multiverse/suites/agent_only/config/newrelic.yml +23 -0
- data/test/multiverse/suites/agent_only/cross_application_tracing_test.rb +56 -0
- data/test/multiverse/suites/agent_only/http_response_code_test.rb +53 -0
- data/test/multiverse/suites/agent_only/key_transactions_test.rb +66 -0
- data/test/multiverse/suites/agent_only/logging_test.rb +163 -0
- data/test/multiverse/suites/agent_only/marshaling_test.rb +96 -0
- data/test/multiverse/suites/agent_only/method_visibility_test.rb +98 -0
- data/test/multiverse/suites/agent_only/no_dns_resolv.rb +17 -0
- data/test/multiverse/suites/agent_only/pipe_manager_test.rb +33 -0
- data/test/multiverse/suites/agent_only/rename_rule_test.rb +57 -0
- data/test/multiverse/suites/agent_only/rum_instrumentation_test.rb +81 -0
- data/test/multiverse/suites/agent_only/service_timeout_test.rb +32 -0
- data/test/multiverse/suites/agent_only/ssl_test.rb +22 -0
- data/test/multiverse/suites/agent_only/start_up_test.rb +21 -0
- data/test/multiverse/suites/agent_only/test_trace_method_with_punctuation.rb +30 -0
- data/test/multiverse/suites/agent_only/test_trace_transaction_with_punctuation.rb +32 -0
- data/test/multiverse/suites/agent_only/testing_app.rb +17 -0
- data/test/multiverse/suites/agent_only/thread_profiling_test.rb +92 -0
- data/test/multiverse/suites/config_file_loading/Envfile +7 -0
- data/test/multiverse/suites/config_file_loading/config_file_loading_test.rb +106 -0
- data/test/multiverse/suites/datamapper/Envfile +8 -0
- data/test/multiverse/suites/datamapper/config/newrelic.yml +22 -0
- data/test/multiverse/suites/datamapper/encoding_test.rb +36 -0
- data/test/multiverse/suites/rails/Envfile +18 -0
- data/test/multiverse/suites/rails/app.rb +49 -0
- data/test/multiverse/suites/rails/app/views/foos/_foo.html.haml +1 -0
- data/test/multiverse/suites/rails/app/views/views/_a_partial.html.erb +1 -0
- data/test/multiverse/suites/rails/app/views/views/_mid_partial.html.erb +1 -0
- data/test/multiverse/suites/rails/app/views/views/_top_partial.html.erb +3 -0
- data/test/multiverse/suites/rails/app/views/views/deep_partial.html.erb +3 -0
- data/test/multiverse/suites/rails/app/views/views/haml_view.html.haml +6 -0
- data/test/multiverse/suites/rails/app/views/views/index.html.erb +4 -0
- data/test/multiverse/suites/rails/config/newrelic.yml +32 -0
- data/test/multiverse/suites/rails/error_tracing_test.rb +211 -0
- data/test/multiverse/suites/rails/gc_instrumentation_test.rb +79 -0
- data/test/multiverse/suites/rails/queue_time_test.rb +55 -0
- data/test/multiverse/suites/rails/view_instrumentation_test.rb +205 -0
- data/test/multiverse/suites/resque/Envfile +24 -0
- data/test/multiverse/suites/resque/Rakefile +8 -0
- data/test/multiverse/suites/resque/config/newrelic.yml +22 -0
- data/test/multiverse/suites/resque/instrumentation_test.rb +151 -0
- data/test/multiverse/suites/resque/resque_setup.rb +15 -0
- data/test/multiverse/suites/sinatra/Envfile +15 -0
- data/test/multiverse/suites/sinatra/config/newrelic.yml +24 -0
- data/test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb +38 -0
- data/test/multiverse/suites/sinatra/sinatra_metric_explosion_test.rb +77 -0
- data/test/multiverse/suites/sinatra/sinatra_routes_test.rb +46 -0
- data/test/multiverse/suites/sinatra/sinatra_test.rb +139 -0
- data/test/multiverse/test/multiverse_test.rb +55 -0
- data/test/multiverse/test/suite_examples/one/a/Envfile +3 -0
- data/test/multiverse/test/suite_examples/one/a/a_test.rb +11 -0
- data/test/multiverse/test/suite_examples/one/a/config/newrelic.yml +24 -0
- data/test/multiverse/test/suite_examples/one/b/Envfile +3 -0
- data/test/multiverse/test/suite_examples/one/b/b_test.rb +11 -0
- data/test/multiverse/test/suite_examples/one/b/config/newrelic.yml +24 -0
- data/test/multiverse/test/suite_examples/three/a/Envfile +2 -0
- data/test/multiverse/test/suite_examples/three/a/fail_test.rb +6 -0
- data/test/multiverse/test/suite_examples/three/b/Envfile +2 -0
- data/test/multiverse/test/suite_examples/three/b/win_test.rb +6 -0
- data/test/multiverse/test/suite_examples/two/a/Envfile +1 -0
- data/test/multiverse/test/suite_examples/two/a/fail_test.rb +6 -0
- data/test/new_relic/agent/agent/connect_test.rb +295 -0
- data/test/new_relic/agent/agent/start_test.rb +205 -0
- data/test/new_relic/agent/agent/start_worker_thread_test.rb +88 -0
- data/test/new_relic/agent/agent_logger_test.rb +153 -0
- data/test/new_relic/agent/agent_test.rb +301 -0
- data/test/new_relic/agent/agent_test_controller.rb +77 -0
- data/test/new_relic/agent/agent_test_controller_test.rb +381 -0
- data/test/new_relic/agent/apdex_from_server_test.rb +9 -0
- data/test/new_relic/agent/audit_logger_test.rb +105 -0
- data/test/new_relic/agent/beacon_configuration_test.rb +107 -0
- data/test/new_relic/agent/browser_monitoring_test.rb +395 -0
- data/test/new_relic/agent/busy_calculator_test.rb +96 -0
- data/test/new_relic/agent/configuration/environment_source_test.rb +79 -0
- data/test/new_relic/agent/configuration/manager_test.rb +232 -0
- data/test/new_relic/agent/configuration/server_source_test.rb +50 -0
- data/test/new_relic/agent/configuration/yaml_source_test.rb +85 -0
- data/test/new_relic/agent/cross_app_monitor_test.rb +237 -0
- data/test/new_relic/agent/database_test.rb +194 -0
- data/test/new_relic/agent/error_collector/notice_error_test.rb +268 -0
- data/test/new_relic/agent/error_collector_test.rb +246 -0
- data/test/new_relic/agent/event_listener_test.rb +67 -0
- data/test/new_relic/agent/instrumentation/active_record_instrumentation_test.rb +606 -0
- data/test/new_relic/agent/instrumentation/browser_monitoring_timings_test.rb +66 -0
- data/test/new_relic/agent/instrumentation/controller_instrumentation_test.rb +107 -0
- data/test/new_relic/agent/instrumentation/instrumentation_test.rb +11 -0
- data/test/new_relic/agent/instrumentation/metric_frame/pop_test.rb +171 -0
- data/test/new_relic/agent/instrumentation/metric_frame_test.rb +151 -0
- data/test/new_relic/agent/instrumentation/net_instrumentation_test.rb +461 -0
- data/test/new_relic/agent/instrumentation/queue_time_test.rb +97 -0
- data/test/new_relic/agent/instrumentation/rack_test.rb +35 -0
- data/test/new_relic/agent/instrumentation/sinatra_test.rb +25 -0
- data/test/new_relic/agent/instrumentation/task_instrumentation_test.rb +182 -0
- data/test/new_relic/agent/memcache_instrumentation_test.rb +143 -0
- data/test/new_relic/agent/method_tracer/class_methods/add_method_tracer_test.rb +158 -0
- data/test/new_relic/agent/method_tracer/instance_methods/trace_execution_scoped_test.rb +222 -0
- data/test/new_relic/agent/method_tracer_test.rb +389 -0
- data/test/new_relic/agent/mock_scope_listener.rb +26 -0
- data/test/new_relic/agent/new_relic_service_test.rb +571 -0
- data/test/new_relic/agent/pipe_channel_manager_test.rb +131 -0
- data/test/new_relic/agent/pipe_service_test.rb +133 -0
- data/test/new_relic/agent/rpm_agent_test.rb +115 -0
- data/test/new_relic/agent/rules_engine_test.rb +82 -0
- data/test/new_relic/agent/sampler_test.rb +19 -0
- data/test/new_relic/agent/shim_agent_test.rb +16 -0
- data/test/new_relic/agent/sql_sampler_test.rb +244 -0
- data/test/new_relic/agent/stats_engine/gc_profiler_test.rb +85 -0
- data/test/new_relic/agent/stats_engine/metric_stats_test.rb +180 -0
- data/test/new_relic/agent/stats_engine/samplers_test.rb +99 -0
- data/test/new_relic/agent/stats_engine_test.rb +184 -0
- data/test/new_relic/agent/stats_hash_test.rb +93 -0
- data/test/new_relic/agent/stats_test.rb +197 -0
- data/test/new_relic/agent/thread_profiler_test.rb +582 -0
- data/test/new_relic/agent/thread_test.rb +89 -0
- data/test/new_relic/agent/threaded_test.rb +65 -0
- data/test/new_relic/agent/transaction_info_test.rb +106 -0
- data/test/new_relic/agent/transaction_sample_builder_test.rb +227 -0
- data/test/new_relic/agent/transaction_sampler_test.rb +968 -0
- data/test/new_relic/agent/worker_loop_test.rb +84 -0
- data/test/new_relic/agent_test.rb +296 -0
- data/test/new_relic/coerce_test.rb +65 -0
- data/test/new_relic/collection_helper_test.rb +148 -0
- data/test/new_relic/command/deployments_test.rb +84 -0
- data/test/new_relic/control/class_methods_test.rb +44 -0
- data/test/new_relic/control/frameworks/rails_test.rb +26 -0
- data/test/new_relic/control_test.rb +194 -0
- data/test/new_relic/delayed_job_injection_test.rb +21 -0
- data/test/new_relic/dispatcher_test.rb +54 -0
- data/test/new_relic/fake_collector.rb +389 -0
- data/test/new_relic/framework_test.rb +53 -0
- data/test/new_relic/helper_test.rb +24 -0
- data/test/new_relic/load_test.rb +13 -0
- data/test/new_relic/local_environment_test.rb +85 -0
- data/test/new_relic/metric_data_test.rb +183 -0
- data/test/new_relic/metric_parser/metric_parser_test.rb +11 -0
- data/test/new_relic/metric_spec_test.rb +95 -0
- data/test/new_relic/noticed_error_test.rb +32 -0
- data/test/new_relic/rack/agent_hooks_test.rb +30 -0
- data/test/new_relic/rack/all_test.rb +11 -0
- data/test/new_relic/rack/browser_monitoring_test.rb +152 -0
- data/test/new_relic/rack/developer_mode_helper_test.rb +141 -0
- data/test/new_relic/rack/developer_mode_test.rb +80 -0
- data/test/new_relic/rack/error_collector_test.rb +90 -0
- data/test/new_relic/transaction_analysis/segment_summary_test.rb +91 -0
- data/test/new_relic/transaction_analysis_test.rb +121 -0
- data/test/new_relic/transaction_sample/composite_segment_test.rb +35 -0
- data/test/new_relic/transaction_sample/fake_segment_test.rb +17 -0
- data/test/new_relic/transaction_sample/segment_test.rb +415 -0
- data/test/new_relic/transaction_sample/summary_segment_test.rb +31 -0
- data/test/new_relic/transaction_sample_subtest_test.rb +56 -0
- data/test/new_relic/transaction_sample_test.rb +250 -0
- data/test/new_relic/version_number_test.rb +97 -0
- data/test/script/build_test_gem.sh +57 -0
- data/test/script/ci.sh +168 -0
- data/test/script/ci_agent-tests_runner.sh +82 -0
- data/test/script/ci_bench.sh +52 -0
- data/test/script/ci_multiverse_runner.sh +63 -0
- data/test/test_contexts.rb +30 -0
- data/test/test_helper.rb +240 -0
- data/ui/helpers/developer_mode_helper.rb +367 -0
- data/ui/helpers/google_pie_chart.rb +49 -0
- data/ui/views/layouts/newrelic_default.rhtml +48 -0
- data/ui/views/newrelic/_explain_plans.rhtml +27 -0
- data/ui/views/newrelic/_sample.rhtml +20 -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 +12 -0
- data/ui/views/newrelic/_show_sample_detail.rhtml +24 -0
- data/ui/views/newrelic/_show_sample_sql.rhtml +24 -0
- data/ui/views/newrelic/_show_sample_summary.rhtml +3 -0
- data/ui/views/newrelic/_sql_row.rhtml +16 -0
- data/ui/views/newrelic/_stack_trace.rhtml +15 -0
- data/ui/views/newrelic/_table.rhtml +12 -0
- data/ui/views/newrelic/explain_sql.rhtml +43 -0
- data/ui/views/newrelic/file/images/arrow-close.png +0 -0
- data/ui/views/newrelic/file/images/arrow-open.png +0 -0
- data/ui/views/newrelic/file/images/blue_bar.gif +0 -0
- data/ui/views/newrelic/file/images/file_icon.png +0 -0
- data/ui/views/newrelic/file/images/gray_bar.gif +0 -0
- data/ui/views/newrelic/file/images/new-relic-rpm-desktop.gif +0 -0
- data/ui/views/newrelic/file/images/new_relic_rpm_desktop.gif +0 -0
- data/ui/views/newrelic/file/images/textmate.png +0 -0
- data/ui/views/newrelic/file/javascript/jquery-1.4.2.js +6240 -0
- data/ui/views/newrelic/file/javascript/transaction_sample.js +120 -0
- data/ui/views/newrelic/file/stylesheets/style.css +490 -0
- data/ui/views/newrelic/index.rhtml +71 -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/threads.rhtml +45 -0
- data/vendor/gems/dependency_detection-0.0.1.build/LICENSE +5 -0
- data/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb +67 -0
- data/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection/version.rb +3 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/.specification +116 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/metric_parser.rb +1 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser.rb +64 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/action_mailer.rb +14 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/active_merchant.rb +31 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/active_record.rb +33 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/apdex.rb +89 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/background_transaction.rb +7 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/client.rb +46 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb +67 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller_cpu.rb +43 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller_ext.rb +17 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/database.rb +48 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/database_pool.rb +24 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/dot_net.rb +28 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/dot_net_parser.rb +17 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/errors.rb +11 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/external.rb +55 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/frontend.rb +40 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/gc.rb +20 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/hibernate_session.rb +7 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/java.rb +31 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/java_parser.rb +17 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/jsp.rb +34 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/jsp_tag.rb +7 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/mem_cache.rb +55 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/metric_parser.rb +135 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/orm.rb +27 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/other_transaction.rb +40 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet.rb +7 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet_context_listener.rb +7 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet_filter.rb +7 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet_init.rb +7 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/solr.rb +27 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/solr_request_handler.rb +15 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/spring.rb +54 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/spring_controller.rb +6 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/spring_view.rb +6 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/struts_action.rb +20 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/struts_result.rb +20 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/version.rb +5 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb +70 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_frontend.rb +18 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_service.rb +14 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_transaction.rb +133 -0
- metadata +494 -0
data/test/script/ci.sh
ADDED
@@ -0,0 +1,168 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# Script to run test suites in CI or in development mode. This script handles
|
4
|
+
# checking out test dependencies (currently rpm_test_app and its dependencies)
|
5
|
+
# and executing them.
|
6
|
+
#
|
7
|
+
# It relies on 2 environment variables:
|
8
|
+
#
|
9
|
+
# RUBY - The rbenv ruby you want to use (e.g. 1.8.7, ree, jruby)
|
10
|
+
#
|
11
|
+
# BRANCH - The rpm_test_app branch you want to use (e.g. rails20, rails31)
|
12
|
+
#
|
13
|
+
# Example usage:
|
14
|
+
# RUBY=ree BRANCH=rails20 test/script/ci.sh
|
15
|
+
#
|
16
|
+
# RUBY=ree BRANCH=rails20 test/script/ci.sh
|
17
|
+
#
|
18
|
+
# RUBY=jruby BRANCH=rails22 test/script/ci.sh
|
19
|
+
|
20
|
+
echo "Executing $0"
|
21
|
+
echo "Running in $(pwd)"
|
22
|
+
|
23
|
+
# print commands in this script as they're invoked
|
24
|
+
#set -x
|
25
|
+
# fail if any command fails
|
26
|
+
set -e
|
27
|
+
|
28
|
+
# check for require environment variables
|
29
|
+
if [ "x$RUBY" == "x" ]; then
|
30
|
+
echo '$RUBY is undefined'
|
31
|
+
echo 'defaulting to 1.9.3'
|
32
|
+
export RUBY=1.9.3-p374
|
33
|
+
fi
|
34
|
+
if [ "x$BRANCH" == "x" ]; then
|
35
|
+
echo '$BRANCH is undefined'
|
36
|
+
echo 'defaulting to rails31'
|
37
|
+
export BRANCH=rails31
|
38
|
+
fi
|
39
|
+
|
40
|
+
if [ "x$JOB_NAME" == "x" ]; then
|
41
|
+
echo '$JOB_NAME is undefined'
|
42
|
+
echo 'defaulting to clrun'
|
43
|
+
export PROJECT_NAME=clrun
|
44
|
+
else
|
45
|
+
CLEANSED_NAME=`echo $JOB_NAME | sed "s/label//" | sed "s/Portland//" | sed "s/BRANCH//" | sed "s/RUBY//" | sed "s/[=\/,\._]//g" | sed "s/ReleaseCandidate/RC/"`
|
46
|
+
echo "setting PROJECT_NAME to $CLEANSED_NAME"
|
47
|
+
export PROJECT_NAME="$CLEANSED_NAME"
|
48
|
+
fi
|
49
|
+
|
50
|
+
eval "$(rbenv init -)" || true
|
51
|
+
rbenv shell $RUBY
|
52
|
+
if [ "x$(rbenv version-name)" = "x$RUBY" ]; then
|
53
|
+
echo "switched to ruby $RUBY"
|
54
|
+
else
|
55
|
+
rbenv install $RUBY
|
56
|
+
rbenv shell $RUBY
|
57
|
+
if [ "x$(rbenv version-name)" = "x$RUBY" ]; then
|
58
|
+
echo "switched to ruby $RUBY"
|
59
|
+
else
|
60
|
+
echo "failed to install ruby $RUBY"
|
61
|
+
exit 1
|
62
|
+
fi
|
63
|
+
fi
|
64
|
+
|
65
|
+
echo `which ruby`
|
66
|
+
ruby -v
|
67
|
+
gem --version
|
68
|
+
|
69
|
+
rake -h > /dev/null || gem install rake
|
70
|
+
|
71
|
+
# make sure that we're in the project root
|
72
|
+
script_dirname=`dirname $0`
|
73
|
+
cd "$script_dirname/../../"
|
74
|
+
pwd
|
75
|
+
|
76
|
+
rm -rf tmp
|
77
|
+
mkdir -p tmp
|
78
|
+
cd tmp
|
79
|
+
|
80
|
+
|
81
|
+
#rpm_test_app_cache=~/.rpm_test_app_cache
|
82
|
+
rpm_test_app_cache=~/workspace/.rpm_test_app_cache
|
83
|
+
(
|
84
|
+
echo "updating local cache of rpm_test_app in $rpm_test_app_cache"
|
85
|
+
git clone --mirror git://github.com/newrelic/rpm_test_app.git $rpm_test_app_cache || true
|
86
|
+
cd $rpm_test_app_cache
|
87
|
+
git fetch || true
|
88
|
+
)
|
89
|
+
|
90
|
+
git clone $rpm_test_app_cache rpm_test_app
|
91
|
+
cd rpm_test_app
|
92
|
+
|
93
|
+
git fetch || true
|
94
|
+
git checkout -t origin/$BRANCH || git checkout $BRANCH
|
95
|
+
if [ -x $HOME/.rbenv/plugins/rbenv-gemsets ]; then
|
96
|
+
echo "$RUBY-$BRANCH" > .rbenv-gemsets
|
97
|
+
fi
|
98
|
+
|
99
|
+
# Re-write database.yml to this here doc
|
100
|
+
( cat << "YAML" ) > config/database.yml
|
101
|
+
# Shared properties for mysql db
|
102
|
+
mysql: &mysql
|
103
|
+
adapter: mysql
|
104
|
+
socket: <%= (`uname -s` =~ /Linux/ ) ? "" :"/tmp/mysql.sock" %>
|
105
|
+
username: root
|
106
|
+
host: localhost
|
107
|
+
database: <%= ENV['PROJECT_NAME'] %>
|
108
|
+
|
109
|
+
# Shared properties for postgres. This won't work with our schema but
|
110
|
+
# Does work with agent tests
|
111
|
+
sqlite3: &sqlite3
|
112
|
+
<% if defined?(JRuby) %>
|
113
|
+
adapter: jdbcsqlite3
|
114
|
+
<% else %>
|
115
|
+
adapter: sqlite3
|
116
|
+
<% end %>
|
117
|
+
database: db/all.sqlite3
|
118
|
+
pool: 5
|
119
|
+
timeout: 5000
|
120
|
+
host: localhost
|
121
|
+
|
122
|
+
# SQLite version 3.x
|
123
|
+
# gem install sqlite3-ruby (not necessary on OS X Leopard)
|
124
|
+
development:
|
125
|
+
<<: *sqlite3
|
126
|
+
|
127
|
+
test:
|
128
|
+
<<: *mysql
|
129
|
+
|
130
|
+
production:
|
131
|
+
<<: *mysql
|
132
|
+
YAML
|
133
|
+
|
134
|
+
|
135
|
+
mkdir -p log
|
136
|
+
mkdir -p tmp
|
137
|
+
if [ "x$BRANCH" == "xrails20" ]; then
|
138
|
+
echo "Warning: Rails 2.0 support in progress. This probably only works in CI"
|
139
|
+
mkdir -p vendor/plugins
|
140
|
+
GEM=`ls ../../../*.gem | tail -n1`
|
141
|
+
(cd vendor/plugins && gem unpack ../../$GEM)
|
142
|
+
mv vendor/plugins/newrelic_rpm* vendor/plugins/newrelic_rpm
|
143
|
+
else
|
144
|
+
perl -p -i'.bak' -e 's#gem .newrelic_rpm.*$#gem "newrelic_rpm", :path => "\.\.\/\.\.\/"#' Gemfile
|
145
|
+
fi
|
146
|
+
|
147
|
+
if [ "x$RUBY" == "x1.8.6" ]; then
|
148
|
+
# Bundler 1.1 dropped support for ruby 1.8.6
|
149
|
+
bundle -h > /dev/null || gem install bundler -v'~>1.0.0' --no-rdoc --no-ri
|
150
|
+
else
|
151
|
+
bundle -h > /dev/null || gem install bundler --no-rdoc --no-ri
|
152
|
+
fi
|
153
|
+
|
154
|
+
|
155
|
+
export RAILS_ENV=test
|
156
|
+
bundle --local || bundle
|
157
|
+
|
158
|
+
# FIXME: Here we actually trigger the tests. Since the agent deals so heavily
|
159
|
+
# in units of time we have many tests that assert that durations are measured
|
160
|
+
# correctly. These almost always pass, but as the CI machine has come under
|
161
|
+
# heavier load there tend to be discrepencies between the duration measured in
|
162
|
+
# the test and the duration the agent measures. This is due to lags in CPU
|
163
|
+
# scheduling since many processes are running on the box simultaneously.
|
164
|
+
# To reduce the noise from these sporardic failures we rerun the test suite if
|
165
|
+
# there are failures to see if they are transient (instead of re-running it by
|
166
|
+
# hand). Ultimately we'll move towards a more elegant solution.
|
167
|
+
|
168
|
+
bundle exec rake --trace db:create:all test:newrelic || bundle exec rake --trace test:newrelic
|
@@ -0,0 +1,82 @@
|
|
1
|
+
#!/bin/bash -e
|
2
|
+
|
3
|
+
SCRATH_DIR=./agent-tests_tmp
|
4
|
+
#git pull git@github.com:newrelic/ruby_agent-tests.git
|
5
|
+
|
6
|
+
#echo $PWD
|
7
|
+
script_dirname=`dirname $0`
|
8
|
+
#echo $script_dirname
|
9
|
+
#echo $0
|
10
|
+
|
11
|
+
# make sure that we're in the project root
|
12
|
+
script_dirname=`dirname $0`
|
13
|
+
cd "$script_dirname/../../"
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
if [ -x $SCRATH_DIR ] ; then
|
18
|
+
echo "found tmp, deleting"
|
19
|
+
rm -fr $SCRATH_DIR
|
20
|
+
fi
|
21
|
+
|
22
|
+
mkdir $SCRATH_DIR
|
23
|
+
cd $SCRATH_DIR
|
24
|
+
|
25
|
+
git clone --depth=1 git@github.com:newrelic/ruby_agent-tests.git ruby_agent-tests
|
26
|
+
git clone --depth=1 git@github.com:newrelic/rpm_contrib.git rpm_contrib
|
27
|
+
|
28
|
+
if [ -x ../../Ruby_Agent ] ; then
|
29
|
+
ln -s ../../Ruby_Agent ./ruby_agent
|
30
|
+
else
|
31
|
+
echo "*********** Ruby_Agent can't be found ***********"
|
32
|
+
exit 1
|
33
|
+
fi
|
34
|
+
|
35
|
+
#exit 0
|
36
|
+
|
37
|
+
cd ruby_agent-tests
|
38
|
+
./ci_run.sh
|
39
|
+
|
40
|
+
#echo "creating tmp dir"
|
41
|
+
#mkdir tmp
|
42
|
+
#echo "cd'ing to tmp"
|
43
|
+
# cd tmp
|
44
|
+
# echo $PWD
|
45
|
+
|
46
|
+
|
47
|
+
# exit 0
|
48
|
+
#env
|
49
|
+
#ls -al /home/hudson/.rvm/bin
|
50
|
+
# source ~/.rvm/scripts/rvm
|
51
|
+
#rvm 1.9.2
|
52
|
+
#ruby -v
|
53
|
+
|
54
|
+
# rvm --force gemset delete ruby_agent-tests
|
55
|
+
|
56
|
+
# rvm gemset create ruby_agent-tests
|
57
|
+
|
58
|
+
# rvm gemset use ruby_agent-tests
|
59
|
+
# gem install bundler
|
60
|
+
# bundle update
|
61
|
+
# bundle
|
62
|
+
|
63
|
+
##
|
64
|
+
# bundle exec ruby fake_collector.rb
|
65
|
+
# bundle exec ruby sinatra_metric_explosion_test.rb
|
66
|
+
|
67
|
+
########
|
68
|
+
# clear out gemset for next test set
|
69
|
+
#
|
70
|
+
|
71
|
+
# cd rails3viewfedex
|
72
|
+
# rvm --force gemset delete ruby_agent-tests
|
73
|
+
|
74
|
+
# rvm gemset create ruby_agent-tests
|
75
|
+
|
76
|
+
# rvm gemset use ruby_agent-tests
|
77
|
+
|
78
|
+
# gem install bundler
|
79
|
+
# bundle update
|
80
|
+
# bundle
|
81
|
+
# bundle exec ruby view_instrumentation_test.rb
|
82
|
+
#exit 0
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# Script to benchmark the ruby agent under various versions of ruby in ci.
|
4
|
+
|
5
|
+
echo "Executing $0"
|
6
|
+
echo "Running in $(pwd)"
|
7
|
+
|
8
|
+
# print commands in this script as they're invoked
|
9
|
+
# set -x
|
10
|
+
# fail if any command fails
|
11
|
+
set -e
|
12
|
+
|
13
|
+
# check for require environment variables
|
14
|
+
if [ "x$RUBY" == "x" ]; then
|
15
|
+
echo '$RUBY is undefined'
|
16
|
+
exit 1
|
17
|
+
fi
|
18
|
+
|
19
|
+
|
20
|
+
. "$HOME/.rvm/scripts/rvm"
|
21
|
+
rvm use $RUBY || rvm install $RUBY
|
22
|
+
echo `which ruby`
|
23
|
+
|
24
|
+
# make sure that we're in the project root
|
25
|
+
script_dirname=`dirname $0`
|
26
|
+
cd "$script_dirname/../../"
|
27
|
+
pwd
|
28
|
+
|
29
|
+
rm -rf tmp
|
30
|
+
mkdir -p tmp
|
31
|
+
cd tmp
|
32
|
+
git clone --depth=1 git@github.com:newrelic/agent_prof.git agent_prof
|
33
|
+
cd agent_prof
|
34
|
+
|
35
|
+
perl -p -i'.bak' -e 's#gem +.newrelic_rpm.*$#gem "newrelic_rpm", :path => "\.\.\/\.\.\/"#' Gemfile
|
36
|
+
|
37
|
+
rvm --force gemset delete ruby_bench_$RUBY
|
38
|
+
rvm gemset create ruby_bench_$RUBY
|
39
|
+
rvm gemset use ruby_bench_$RUBY
|
40
|
+
|
41
|
+
if [ "x$RUBY" == "x1.8.6" ]; then
|
42
|
+
# Bundler 1.1 dropped support for ruby 1.8.6
|
43
|
+
gem install bundler -v'~>1.0.0' --no-rdoc --no-ri
|
44
|
+
else
|
45
|
+
gem install bundler --no-rdoc --no-ri
|
46
|
+
fi
|
47
|
+
|
48
|
+
bundle
|
49
|
+
script/run
|
50
|
+
bundle exec script/post_log_to_dashboard
|
51
|
+
|
52
|
+
|
@@ -0,0 +1,63 @@
|
|
1
|
+
#!/bin/bash -e
|
2
|
+
|
3
|
+
export PATH=$PATH:$HOME/bin
|
4
|
+
|
5
|
+
echo $HOME
|
6
|
+
echo $PATH
|
7
|
+
#ls $HOME/bin
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
if [ "x$RUBY" == "x" ] ; then
|
12
|
+
export RUBY=1.9.3
|
13
|
+
fi
|
14
|
+
|
15
|
+
echo "Tests will be run using $RUBY"
|
16
|
+
#uname -a
|
17
|
+
|
18
|
+
SCRATH_DIR=./multiverse_tmp
|
19
|
+
script_dirname=`dirname $0`
|
20
|
+
|
21
|
+
# make sure that we're in the project root
|
22
|
+
cd "$script_dirname/../../"
|
23
|
+
|
24
|
+
#pwd
|
25
|
+
|
26
|
+
if [ -x $SCRATH_DIR ] ; then
|
27
|
+
echo "found tmp, deleting"
|
28
|
+
rm -fr $SCRATH_DIR
|
29
|
+
fi
|
30
|
+
|
31
|
+
mkdir $SCRATH_DIR
|
32
|
+
cd $SCRATH_DIR
|
33
|
+
|
34
|
+
#pwd
|
35
|
+
if [[ $JOB_NAME =~ "Pangalactic" ]] ; then
|
36
|
+
AGENT_LOCATION="../../../../../../Ruby_Agent"
|
37
|
+
else
|
38
|
+
AGENT_LOCATION="../../Ruby_Agent"
|
39
|
+
fi
|
40
|
+
|
41
|
+
git clone --depth=1 git@github.com:newrelic/multiverse.git multiverse
|
42
|
+
git clone --depth=1 git@github.com:newrelic/rpm_contrib.git rpm_contrib
|
43
|
+
|
44
|
+
echo "Looking for Ruby Agent at $AGENT_LOCATION"
|
45
|
+
#ls -l ../../../../../../
|
46
|
+
#ls -l /home/hudson/workspace/
|
47
|
+
|
48
|
+
if [ -x $AGENT_LOCATION ] ; then
|
49
|
+
ln -s $AGENT_LOCATION ./ruby_agent
|
50
|
+
else
|
51
|
+
echo "*********** Ruby_Agent not found ***********"
|
52
|
+
exit 1
|
53
|
+
fi
|
54
|
+
|
55
|
+
cd multiverse
|
56
|
+
#./ci_run.sh
|
57
|
+
|
58
|
+
#pwd
|
59
|
+
#ls -l ../
|
60
|
+
|
61
|
+
eval "$(rbenv init -)" || true
|
62
|
+
rbenv shell $RUBY
|
63
|
+
script/runner
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
module TestContexts
|
3
|
+
def with_running_agent
|
4
|
+
|
5
|
+
context 'with running agent' do # this is needed for the nested setups
|
6
|
+
|
7
|
+
setup do
|
8
|
+
@log_data = StringIO.new
|
9
|
+
@log = Logger.new(@log_data)
|
10
|
+
NewRelic::Agent::Agent.instance.service = default_service
|
11
|
+
NewRelic::Agent.manual_start :log => @log
|
12
|
+
@agent = NewRelic::Agent.instance
|
13
|
+
@agent.transaction_sampler.send :clear_builder
|
14
|
+
@agent.transaction_sampler.reset!
|
15
|
+
@agent.stats_engine.clear_stats
|
16
|
+
end
|
17
|
+
|
18
|
+
yield
|
19
|
+
|
20
|
+
def teardown
|
21
|
+
super
|
22
|
+
NewRelic::Agent.shutdown
|
23
|
+
@log_data.reset
|
24
|
+
NewRelic::Control.instance['dispatcher']=nil
|
25
|
+
NewRelic::Control.instance['dispatcher_instance_id']=nil
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,240 @@
|
|
1
|
+
module NewRelic; TEST = true; end unless defined? NewRelic::TEST
|
2
|
+
ENV['RAILS_ENV'] = 'test'
|
3
|
+
NEWRELIC_PLUGIN_DIR = File.expand_path(File.join(File.dirname(__FILE__),".."))
|
4
|
+
$LOAD_PATH << '.'
|
5
|
+
$LOAD_PATH << '../../..'
|
6
|
+
$LOAD_PATH << File.join(NEWRELIC_PLUGIN_DIR,"lib")
|
7
|
+
$LOAD_PATH << File.join(NEWRELIC_PLUGIN_DIR,"test")
|
8
|
+
$LOAD_PATH << File.join(NEWRELIC_PLUGIN_DIR,"ui/helpers")
|
9
|
+
$LOAD_PATH.uniq!
|
10
|
+
|
11
|
+
require 'rubygems'
|
12
|
+
require 'rake'
|
13
|
+
# We can speed things up in tests that don't need to load rails.
|
14
|
+
# You can also run the tests in a mode without rails. Many tests
|
15
|
+
# will be skipped.
|
16
|
+
|
17
|
+
begin
|
18
|
+
require 'config/environment'
|
19
|
+
# require File.join(File.dirname(__FILE__),'..','..','rpm_test_app','config','environment')
|
20
|
+
begin
|
21
|
+
require 'test_help'
|
22
|
+
rescue LoadError
|
23
|
+
# ignore load problems on test help - it doesn't exist in rails 3
|
24
|
+
end
|
25
|
+
require 'newrelic_rpm'
|
26
|
+
rescue LoadError => e
|
27
|
+
puts "Running tests in standalone mode."
|
28
|
+
require 'bundler'
|
29
|
+
Bundler.require
|
30
|
+
require 'rails/all'
|
31
|
+
require 'newrelic_rpm'
|
32
|
+
|
33
|
+
# Bootstrap a basic rails environment for the agent to run in.
|
34
|
+
class MyApp < Rails::Application
|
35
|
+
config.active_support.deprecation = :log
|
36
|
+
config.secret_token = "49837489qkuweoiuoqwehisuakshdjksadhaisdy78o34y138974xyqp9rmye8yrpiokeuioqwzyoiuxftoyqiuxrhm3iou1hrzmjk"
|
37
|
+
config.after_initialize do
|
38
|
+
NewRelic::Agent.manual_start
|
39
|
+
end
|
40
|
+
end
|
41
|
+
MyApp.initialize!
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
require 'test/unit'
|
46
|
+
require 'shoulda'
|
47
|
+
require 'mocha'
|
48
|
+
|
49
|
+
begin # 1.8.6
|
50
|
+
require 'mocha/integration/test_unit'
|
51
|
+
require 'mocha/integration/test_unit/assertion_counter'
|
52
|
+
rescue LoadError
|
53
|
+
end
|
54
|
+
|
55
|
+
def default_service(stubbed_method_overrides = {})
|
56
|
+
service = stub
|
57
|
+
stubbed_method_defaults = {
|
58
|
+
:connect => {},
|
59
|
+
:shutdown => nil,
|
60
|
+
:agent_id= => nil,
|
61
|
+
:agent_id => nil,
|
62
|
+
:collector => stub_everything,
|
63
|
+
:request_timeout= => nil,
|
64
|
+
:metric_data => nil,
|
65
|
+
:error_data => nil,
|
66
|
+
:transaction_sample_data => nil,
|
67
|
+
:get_agent_commands => []
|
68
|
+
}
|
69
|
+
|
70
|
+
service.stubs(stubbed_method_defaults.merge(stubbed_method_overrides))
|
71
|
+
|
72
|
+
# When session gets called yield to the given block.
|
73
|
+
service.stubs(:session).yields
|
74
|
+
service
|
75
|
+
end
|
76
|
+
|
77
|
+
class Test::Unit::TestCase
|
78
|
+
include Mocha::API
|
79
|
+
|
80
|
+
# we can delete this trick when we stop supporting rails2.0.x
|
81
|
+
if ENV['BRANCH'] != 'rails20'
|
82
|
+
# a hack because rails2.0.2 does not like double teardowns
|
83
|
+
def teardown
|
84
|
+
mocha_teardown
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def assert_between(floor, ceiling, value, message="expected #{floor} <= #{value} <= #{ceiling}")
|
90
|
+
assert((floor <= value && value <= ceiling), message)
|
91
|
+
end
|
92
|
+
|
93
|
+
def check_metric_time(metric, value, delta)
|
94
|
+
time = NewRelic::Agent.get_stats(metric).total_call_time
|
95
|
+
assert_between((value - delta), (value + delta), time)
|
96
|
+
end
|
97
|
+
|
98
|
+
def check_metric_count(metric, value)
|
99
|
+
count = NewRelic::Agent.get_stats(metric).call_count
|
100
|
+
assert_equal(value, count, "should have the correct number of calls")
|
101
|
+
end
|
102
|
+
|
103
|
+
def check_unscoped_metric_count(metric, value)
|
104
|
+
count = NewRelic::Agent.get_stats_unscoped(metric).call_count
|
105
|
+
assert_equal(value, count, "should have the correct number of calls")
|
106
|
+
end
|
107
|
+
|
108
|
+
def generate_unscoped_metric_counts(*metrics)
|
109
|
+
metrics.inject({}) do |sum, metric|
|
110
|
+
sum[metric] = NewRelic::Agent.get_stats_no_scope(metric).call_count
|
111
|
+
sum
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def generate_metric_counts(*metrics)
|
116
|
+
metrics.inject({}) do |sum, metric|
|
117
|
+
sum[metric] = NewRelic::Agent.get_stats(metric).call_count
|
118
|
+
sum
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def assert_does_not_call_metrics(*metrics)
|
123
|
+
first_metrics = generate_metric_counts(*metrics)
|
124
|
+
yield
|
125
|
+
last_metrics = generate_metric_counts(*metrics)
|
126
|
+
assert_equal first_metrics, last_metrics, "should not have changed these metrics"
|
127
|
+
end
|
128
|
+
|
129
|
+
def assert_calls_metrics(*metrics)
|
130
|
+
first_metrics = generate_metric_counts(*metrics)
|
131
|
+
yield
|
132
|
+
last_metrics = generate_metric_counts(*metrics)
|
133
|
+
assert_not_equal first_metrics, last_metrics, "should have changed these metrics"
|
134
|
+
end
|
135
|
+
|
136
|
+
def assert_calls_unscoped_metrics(*metrics)
|
137
|
+
first_metrics = generate_unscoped_metric_counts(*metrics)
|
138
|
+
yield
|
139
|
+
last_metrics = generate_unscoped_metric_counts(*metrics)
|
140
|
+
assert_not_equal first_metrics, last_metrics, "should have changed these metrics"
|
141
|
+
end
|
142
|
+
|
143
|
+
unless defined?( assert_includes )
|
144
|
+
def assert_includes( collection, member, msg=nil )
|
145
|
+
msg = build_message( msg, "Expected ? to include ?", collection, member )
|
146
|
+
assert_block( msg ) { collection.include?(member) }
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
unless defined?( assert_not_includes )
|
151
|
+
def assert_not_includes( collection, member, msg=nil )
|
152
|
+
msg = build_message( msg, "Expected ? not to include ?", collection, member )
|
153
|
+
assert_block( msg ) { !collection.include?(member) }
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
def compare_metrics(expected, actual)
|
158
|
+
actual.delete_if {|a| a.include?('GC/cumulative') } # in case we are in REE
|
159
|
+
assert_equal(expected.to_a.sort, actual.to_a.sort, "extra: #{(actual - expected).to_a.inspect}; missing: #{(expected - actual).to_a.inspect}")
|
160
|
+
end
|
161
|
+
|
162
|
+
def with_config(config_hash, opts={})
|
163
|
+
opts = { :level => 0, :do_not_cast => false }.merge(opts)
|
164
|
+
if opts[:do_not_cast]
|
165
|
+
config = config_hash
|
166
|
+
else
|
167
|
+
config = NewRelic::Agent::Configuration::DottedHash.new(config_hash)
|
168
|
+
end
|
169
|
+
NewRelic::Agent.config.apply_config(config, opts[:level])
|
170
|
+
begin
|
171
|
+
yield
|
172
|
+
ensure
|
173
|
+
NewRelic::Agent.config.remove_config(config)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
# Need to be a bit sloppy when testing against the logging--let everything
|
178
|
+
# through, but check we (at least) get our particular message we care about
|
179
|
+
def expects_logging(level, *with_params)
|
180
|
+
::NewRelic::Agent.logger.stubs(level)
|
181
|
+
::NewRelic::Agent.logger.expects(level).with(*with_params).once
|
182
|
+
end
|
183
|
+
|
184
|
+
def expects_no_logging(level)
|
185
|
+
::NewRelic::Agent.logger.expects(level).never
|
186
|
+
end
|
187
|
+
|
188
|
+
# Sometimes need to test cases where we muddle with the global logger
|
189
|
+
# If so, use this method to ensure it gets restored after we're done
|
190
|
+
def without_logger
|
191
|
+
logger = ::NewRelic::Agent.logger
|
192
|
+
::NewRelic::Agent.logger = nil
|
193
|
+
yield
|
194
|
+
ensure
|
195
|
+
::NewRelic::Agent.logger = logger
|
196
|
+
end
|
197
|
+
|
198
|
+
module NewRelic
|
199
|
+
def self.fixture_path(name)
|
200
|
+
File.join(File.dirname(__FILE__), 'fixtures', name)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
module TransactionSampleTestHelper
|
205
|
+
module_function
|
206
|
+
def make_sql_transaction(*sql)
|
207
|
+
sampler = NewRelic::Agent::TransactionSampler.new
|
208
|
+
sampler.notice_first_scope_push Time.now.to_f
|
209
|
+
sampler.notice_transaction '/path', nil, :jim => "cool"
|
210
|
+
sampler.notice_push_scope "a"
|
211
|
+
|
212
|
+
sampler.notice_transaction '/path/2', nil, :jim => "cool"
|
213
|
+
|
214
|
+
sql.each {|sql_statement| sampler.notice_sql(sql_statement, {:adapter => "test"}, 0 ) }
|
215
|
+
|
216
|
+
sleep 0.02
|
217
|
+
yield if block_given?
|
218
|
+
sampler.notice_pop_scope "a"
|
219
|
+
sampler.notice_scope_empty
|
220
|
+
|
221
|
+
sampler.samples[0]
|
222
|
+
end
|
223
|
+
|
224
|
+
def run_sample_trace_on(sampler, path='/path')
|
225
|
+
sampler.notice_first_scope_push Time.now.to_f
|
226
|
+
sampler.notice_transaction path, path, {}
|
227
|
+
sampler.notice_push_scope "Controller/sandwiches/index"
|
228
|
+
sampler.notice_sql("SELECT * FROM sandwiches WHERE bread = 'wheat'", nil, 0)
|
229
|
+
sampler.notice_push_scope "ab"
|
230
|
+
sampler.notice_sql("SELECT * FROM sandwiches WHERE bread = 'white'", nil, 0)
|
231
|
+
yield sampler if block_given?
|
232
|
+
sampler.notice_pop_scope "ab"
|
233
|
+
sampler.notice_push_scope "lew"
|
234
|
+
sampler.notice_sql("SELECT * FROM sandwiches WHERE bread = 'french'", nil, 0)
|
235
|
+
sampler.notice_pop_scope "lew"
|
236
|
+
sampler.notice_pop_scope "Controller/sandwiches/index"
|
237
|
+
sampler.notice_scope_empty
|
238
|
+
sampler.samples[0]
|
239
|
+
end
|
240
|
+
end
|