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
@@ -0,0 +1,268 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','test_helper'))
|
2
|
+
class NewRelic::Agent::ErrorCollector::NoticeErrorTest < Test::Unit::TestCase
|
3
|
+
require 'new_relic/agent/error_collector'
|
4
|
+
include NewRelic::Agent::ErrorCollector::NoticeError
|
5
|
+
|
6
|
+
def test_error_params_from_options_mocked
|
7
|
+
options = {:initial => 'options'}
|
8
|
+
self.expects(:uri_ref_and_root).returns({:hi => 'there', :hello => 'bad'})
|
9
|
+
self.expects(:normalized_request_and_custom_params).with({:initial => 'options'}).returns({:hello => 'world'})
|
10
|
+
assert_equal({:hi => 'there', :hello => 'world'}, error_params_from_options(options))
|
11
|
+
end
|
12
|
+
|
13
|
+
module Winner
|
14
|
+
def winner
|
15
|
+
'yay'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_sense_method
|
20
|
+
object = Object.new
|
21
|
+
object.extend(Winner)
|
22
|
+
assert !sense_method(object, 'blab')
|
23
|
+
assert_equal 'yay', sense_method(object, 'winner')
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_fetch_from_options
|
27
|
+
options = {:hello => 'world'}
|
28
|
+
assert_equal 'world', fetch_from_options(options, :hello, '')
|
29
|
+
assert_equal '', fetch_from_options(options, :none, '')
|
30
|
+
assert_equal({}, options)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_uri_ref_and_root_default
|
34
|
+
fake_control = mocked_control
|
35
|
+
fake_control.expects(:root).returns('rootbeer')
|
36
|
+
options = {}
|
37
|
+
assert_equal({:request_referer => '', :rails_root => 'rootbeer', :request_uri => ''}, uri_ref_and_root(options))
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_uri_ref_and_root_values
|
41
|
+
fake_control = mocked_control
|
42
|
+
fake_control.expects(:root).returns('rootbeer')
|
43
|
+
options = {:uri => 'whee', :referer => 'bang'}
|
44
|
+
assert_equal({:request_referer => 'bang', :rails_root => 'rootbeer', :request_uri => 'whee'}, uri_ref_and_root(options))
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_custom_params_from_opts_base
|
48
|
+
assert_equal({}, custom_params_from_opts({}))
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_custom_params_from_opts_custom_params
|
52
|
+
assert_equal({:foo => 'bar'}, custom_params_from_opts({:custom_params => {:foo => 'bar'}}))
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_custom_params_from_opts_merged_params
|
56
|
+
assert_equal({:foo => 'baz'}, custom_params_from_opts({:custom_params => {:foo => 'bar'}, :foo => 'baz'}))
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_request_params_from_opts_positive
|
60
|
+
with_config(:capture_params => true) do
|
61
|
+
val = {:request_params => 'foo'}
|
62
|
+
assert_equal('foo', request_params_from_opts(val))
|
63
|
+
assert_equal({}, val, "should delete request_params key from hash")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_request_params_from_opts_negative
|
68
|
+
with_config(:capture_params => false) do
|
69
|
+
val = {:request_params => 'foo'}
|
70
|
+
assert_equal(nil, request_params_from_opts(val))
|
71
|
+
assert_equal({}, val, "should delete request_params key from hash")
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_normalized_request_and_custom_params_base
|
76
|
+
self.expects(:normalize_params).with(nil).returns(nil)
|
77
|
+
self.expects(:normalize_params).with({}).returns({})
|
78
|
+
with_config(:capture_params => true) do
|
79
|
+
assert_equal({:request_params => nil, :custom_params => {}},
|
80
|
+
normalized_request_and_custom_params({}))
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_extract_source_base
|
85
|
+
with_config(:'error_collector.capture_source' => true) do
|
86
|
+
error_collector = NewRelic::Agent::ErrorCollector.new
|
87
|
+
error_collector.expects(:sense_method).with(nil, 'source_extract')
|
88
|
+
assert_equal(nil, error_collector.extract_source(nil))
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_extract_source_disabled
|
93
|
+
with_config(:'error_collector.capture_source' => false) do
|
94
|
+
error_collector = NewRelic::Agent::ErrorCollector.new
|
95
|
+
assert_equal(nil, error_collector.extract_source(mock('exception')))
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_extract_source_with_source
|
100
|
+
with_config(:'error_collector.capture_source' => true) do
|
101
|
+
error_collector = NewRelic::Agent::ErrorCollector.new
|
102
|
+
error_collector.expects(:sense_method).with('happy', 'source_extract').returns('THE SOURCE')
|
103
|
+
assert_equal('THE SOURCE', error_collector.extract_source('happy'))
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_extract_stack_trace
|
108
|
+
exception = mock('exception')
|
109
|
+
self.expects(:sense_method).with(exception, 'original_exception')
|
110
|
+
self.expects(:sense_method).with(exception, 'backtrace')
|
111
|
+
assert_equal('<no stack trace>', extract_stack_trace(exception))
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_extract_stack_trace_positive
|
115
|
+
orig = mock('original')
|
116
|
+
exception = mock('exception')
|
117
|
+
self.expects(:sense_method).with(exception, 'original_exception').returns(orig)
|
118
|
+
self.expects(:sense_method).with(orig, 'backtrace').returns('STACK STACK STACK')
|
119
|
+
assert_equal('STACK STACK STACK', extract_stack_trace(exception))
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_over_queue_limit_negative
|
123
|
+
@errors = []
|
124
|
+
assert !over_queue_limit?(nil)
|
125
|
+
end
|
126
|
+
|
127
|
+
def test_over_queue_limit_positive
|
128
|
+
@errors = %w(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21)
|
129
|
+
expects_logging(:warn, includes('The error reporting queue has reached 20'))
|
130
|
+
assert over_queue_limit?('hooray')
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_exception_info
|
134
|
+
exception = mock('exception')
|
135
|
+
self.expects(:sense_method).with(exception, 'file_name').returns('file_name')
|
136
|
+
self.expects(:sense_method).with(exception, 'line_number').returns('line_number')
|
137
|
+
self.expects(:extract_source).with(exception).returns('source')
|
138
|
+
self.expects(:extract_stack_trace).with(exception).returns('stack_trace')
|
139
|
+
assert_equal({:file_name => 'file_name', :line_number => 'line_number', :source => 'source', :stack_trace => 'stack_trace'},
|
140
|
+
exception_info(exception))
|
141
|
+
end
|
142
|
+
|
143
|
+
def test_add_to_error_queue_positive
|
144
|
+
noticed_error = mock('noticed_error')
|
145
|
+
noticed_error.expects(:message).returns('a message')
|
146
|
+
@lock = Mutex.new
|
147
|
+
@errors = []
|
148
|
+
self.expects(:over_queue_limit?).with('a message').returns(false)
|
149
|
+
add_to_error_queue(noticed_error)
|
150
|
+
assert_equal([noticed_error], @errors)
|
151
|
+
end
|
152
|
+
|
153
|
+
def test_add_to_error_queue_negative
|
154
|
+
noticed_error = mock('noticed_error')
|
155
|
+
noticed_error.expects(:message).returns('a message')
|
156
|
+
@lock = Mutex.new
|
157
|
+
@errors = []
|
158
|
+
self.expects(:over_queue_limit?).with('a message').returns(true)
|
159
|
+
add_to_error_queue(noticed_error)
|
160
|
+
assert_equal([], @errors)
|
161
|
+
end
|
162
|
+
|
163
|
+
def test_should_exit_notice_error_disabled
|
164
|
+
error = mocked_error
|
165
|
+
with_error_collector_config(:'error_collector.enabled' => false) do |error_collector|
|
166
|
+
assert error_collector.should_exit_notice_error?(error)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
def test_should_exit_notice_error_nil
|
171
|
+
error = nil
|
172
|
+
with_error_collector_config(:'error_collector.enabled' => true) do |error_collector|
|
173
|
+
error_collector.expects(:error_is_ignored?).with(error).returns(false)
|
174
|
+
# we increment it for the case that someone calls
|
175
|
+
# NewRelic::Agent.notice_error(foo) # foo is nil
|
176
|
+
# (which is probably not a good idea but is the existing api)
|
177
|
+
error_collector.expects(:increment_error_count!)
|
178
|
+
assert error_collector.should_exit_notice_error?(error)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
def test_should_exit_notice_error_positive
|
183
|
+
error = mocked_error
|
184
|
+
with_error_collector_config(:'error_collector.enabled' => true) do |error_collector|
|
185
|
+
error_collector.expects(:error_is_ignored?).with(error).returns(true)
|
186
|
+
assert error_collector.should_exit_notice_error?(error)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
def test_should_exit_notice_error_negative
|
191
|
+
error = mocked_error
|
192
|
+
with_error_collector_config(:'error_collector.enabled' => true) do |error_collector|
|
193
|
+
error_collector.expects(:error_is_ignored?).with(error).returns(false)
|
194
|
+
error_collector.expects(:increment_error_count!)
|
195
|
+
assert !error_collector.should_exit_notice_error?(error)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
def test_filtered_error_positive
|
200
|
+
with_error_collector_config(:'error_collector.ignore_errors' => 'an_error') do |error_collector|
|
201
|
+
error = mocked_error
|
202
|
+
error_class = mock('error class')
|
203
|
+
error.expects(:class).returns(error_class)
|
204
|
+
error_class.expects(:name).returns('an_error')
|
205
|
+
assert error_collector.filtered_error?(error)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
def test_filtered_error_negative
|
210
|
+
error = mocked_error
|
211
|
+
error_class = mock('error class')
|
212
|
+
error.expects(:class).returns(error_class)
|
213
|
+
error_class.expects(:name).returns('an_error')
|
214
|
+
assert !NewRelic::Agent::ErrorCollector.new.filtered_error?(error)
|
215
|
+
end
|
216
|
+
|
217
|
+
def test_filtered_by_error_filter_empty
|
218
|
+
# should return right away when there's no filter
|
219
|
+
@ignore_filter = nil
|
220
|
+
assert !filtered_by_error_filter?(nil)
|
221
|
+
end
|
222
|
+
|
223
|
+
def test_filtered_by_error_filter_positive
|
224
|
+
error = mocked_error
|
225
|
+
@ignore_filter = lambda { |x| assert_equal error, x; false }
|
226
|
+
assert filtered_by_error_filter?(error)
|
227
|
+
end
|
228
|
+
|
229
|
+
def test_filtered_by_error_filter_negative
|
230
|
+
error = mocked_error
|
231
|
+
@ignore_filter = lambda { |x| assert_equal error, x; true }
|
232
|
+
assert !filtered_by_error_filter?(error)
|
233
|
+
end
|
234
|
+
|
235
|
+
def test_error_is_ignored_positive
|
236
|
+
error = mocked_error
|
237
|
+
self.expects(:filtered_error?).with(error).returns(true)
|
238
|
+
assert error_is_ignored?(error)
|
239
|
+
end
|
240
|
+
|
241
|
+
def test_error_is_ignored_negative
|
242
|
+
error = mocked_error
|
243
|
+
self.expects(:filtered_error?).with(error).returns(false)
|
244
|
+
assert !error_is_ignored?(error)
|
245
|
+
end
|
246
|
+
|
247
|
+
def test_error_is_ignored_no_error
|
248
|
+
assert !error_is_ignored?(nil), 'should not ignore nil'
|
249
|
+
end
|
250
|
+
|
251
|
+
private
|
252
|
+
|
253
|
+
def mocked_error
|
254
|
+
mock('error')
|
255
|
+
end
|
256
|
+
|
257
|
+
def mocked_control
|
258
|
+
fake_control = mock('control')
|
259
|
+
NewRelic::Control.stubs(:instance).returns(fake_control)
|
260
|
+
fake_control
|
261
|
+
end
|
262
|
+
|
263
|
+
def with_error_collector_config(config)
|
264
|
+
with_config(config) do
|
265
|
+
yield NewRelic::Agent::ErrorCollector.new
|
266
|
+
end
|
267
|
+
end
|
268
|
+
end
|
@@ -0,0 +1,246 @@
|
|
1
|
+
# Run faster standalone
|
2
|
+
ENV['SKIP_RAILS'] = 'true'
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
|
4
|
+
|
5
|
+
class NewRelic::Agent::ErrorCollectorTest < Test::Unit::TestCase
|
6
|
+
def setup
|
7
|
+
super
|
8
|
+
@test_config = { :capture_params => true }
|
9
|
+
NewRelic::Agent.config.apply_config(@test_config)
|
10
|
+
@error_collector = NewRelic::Agent::ErrorCollector.new
|
11
|
+
@error_collector.stubs(:enabled).returns(true)
|
12
|
+
end
|
13
|
+
|
14
|
+
def teardown
|
15
|
+
super
|
16
|
+
NewRelic::Agent.config.remove_config(@test_config)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_empty
|
20
|
+
@error_collector.harvest_errors([])
|
21
|
+
@error_collector.notice_error(nil, :metric=> 'path', :request_params => {:x => 'y'})
|
22
|
+
errors = @error_collector.harvest_errors([])
|
23
|
+
|
24
|
+
assert_equal 0, errors.length
|
25
|
+
|
26
|
+
@error_collector.notice_error('Some error message', :metric=> 'path', :request_params => {:x => 'y'})
|
27
|
+
errors = @error_collector.harvest_errors([])
|
28
|
+
|
29
|
+
err = errors.first
|
30
|
+
assert_equal 'Some error message', err.message
|
31
|
+
assert_equal 'y', err.params[:request_params][:x]
|
32
|
+
assert_equal '', err.params[:request_uri]
|
33
|
+
assert_equal '', err.params[:request_referer]
|
34
|
+
assert_equal 'path', err.path
|
35
|
+
assert_equal 'Error', err.exception_class
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_simple
|
39
|
+
@error_collector.notice_error(StandardError.new("message"), :uri => '/myurl/', :metric => 'path', :referer => 'test_referer', :request_params => {:x => 'y'})
|
40
|
+
|
41
|
+
old_errors = []
|
42
|
+
errors = @error_collector.harvest_errors(old_errors)
|
43
|
+
|
44
|
+
assert_equal errors.length, 1
|
45
|
+
|
46
|
+
err = errors.first
|
47
|
+
assert_equal 'message', err.message
|
48
|
+
assert_equal 'y', err.params[:request_params][:x]
|
49
|
+
assert err.params[:request_uri] == '/myurl/'
|
50
|
+
assert err.params[:request_referer] == "test_referer"
|
51
|
+
assert err.path == 'path'
|
52
|
+
assert err.exception_class == 'StandardError'
|
53
|
+
|
54
|
+
# the collector should now return an empty array since nothing
|
55
|
+
# has been added since its last harvest
|
56
|
+
errors = @error_collector.harvest_errors(nil)
|
57
|
+
assert errors.length == 0
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_long_message
|
61
|
+
#yes, times 500. it's a 5000 byte string. Assuming strings are
|
62
|
+
#still 1 byte / char.
|
63
|
+
@error_collector.notice_error(StandardError.new("1234567890" * 500), :uri => '/myurl/', :metric => 'path', :request_params => {:x => 'y'})
|
64
|
+
|
65
|
+
old_errors = []
|
66
|
+
errors = @error_collector.harvest_errors(old_errors)
|
67
|
+
|
68
|
+
assert_equal errors.length, 1
|
69
|
+
|
70
|
+
err = errors.first
|
71
|
+
assert_equal 4096, err.message.length
|
72
|
+
assert_equal ('1234567890' * 500)[0..4095], err.message
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_collect_failover
|
76
|
+
@error_collector.notice_error(StandardError.new("message"), :metric => 'first', :request_params => {:x => 'y'})
|
77
|
+
|
78
|
+
errors = @error_collector.harvest_errors([])
|
79
|
+
|
80
|
+
@error_collector.notice_error(StandardError.new("message"), :metric => 'second', :request_params => {:x => 'y'})
|
81
|
+
@error_collector.notice_error(StandardError.new("message"), :metric => 'path', :request_params => {:x => 'y'})
|
82
|
+
@error_collector.notice_error(StandardError.new("message"), :metric => 'last', :request_params => {:x => 'y'})
|
83
|
+
|
84
|
+
errors = @error_collector.harvest_errors(errors)
|
85
|
+
|
86
|
+
assert_equal 4, errors.length
|
87
|
+
assert_equal 'first', errors.first.path
|
88
|
+
assert_equal 'last', errors.last.path
|
89
|
+
|
90
|
+
@error_collector.notice_error(StandardError.new("message"), :metric => 'first', :request_params => {:x => 'y'})
|
91
|
+
@error_collector.notice_error(StandardError.new("message"), :metric => 'last', :request_params => {:x => 'y'})
|
92
|
+
|
93
|
+
errors = @error_collector.harvest_errors(nil)
|
94
|
+
assert_equal 2, errors.length
|
95
|
+
assert_equal 'first', errors.first.path
|
96
|
+
assert_equal 'last', errors.last.path
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_queue_overflow
|
100
|
+
|
101
|
+
max_q_length = 20 # for some reason I can't read the constant in ErrorCollector
|
102
|
+
|
103
|
+
silence_stream(::STDOUT) do
|
104
|
+
(max_q_length + 5).times do |n|
|
105
|
+
@error_collector.notice_error(StandardError.new("exception #{n}"), :metric => "path", :request_params => {:x => n})
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
errors = @error_collector.harvest_errors([])
|
110
|
+
assert errors.length == max_q_length
|
111
|
+
errors.each_index do |i|
|
112
|
+
err = errors.shift
|
113
|
+
assert_equal i.to_s, err.params[:request_params][:x], err.params.inspect
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
# Why would anyone undef these methods?
|
118
|
+
class TestClass
|
119
|
+
undef to_s
|
120
|
+
undef inspect
|
121
|
+
end
|
122
|
+
|
123
|
+
|
124
|
+
def test_supported_param_types
|
125
|
+
types = [[1, '1'],
|
126
|
+
[1.1, '1.1'],
|
127
|
+
['hi', 'hi'],
|
128
|
+
[:hi, :hi],
|
129
|
+
[StandardError.new("test"), "#<StandardError>"],
|
130
|
+
[TestClass.new, "#<NewRelic::Agent::ErrorCollectorTest::TestClass>"]
|
131
|
+
]
|
132
|
+
|
133
|
+
types.each do |test|
|
134
|
+
@error_collector.notice_error(StandardError.new("message"), :metric => 'path',
|
135
|
+
:request_params => {:x => test[0]})
|
136
|
+
assert_equal test[1], @error_collector.harvest_errors([])[0].params[:request_params][:x]
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
|
141
|
+
def test_exclude
|
142
|
+
@error_collector.ignore(["IOError"])
|
143
|
+
|
144
|
+
@error_collector.notice_error(IOError.new("message"), :metric => 'path', :request_params => {:x => 'y'})
|
145
|
+
|
146
|
+
errors = @error_collector.harvest_errors([])
|
147
|
+
|
148
|
+
assert_equal 0, errors.length
|
149
|
+
end
|
150
|
+
|
151
|
+
def test_exclude_later_config_changes
|
152
|
+
@error_collector.notice_error(IOError.new("message"))
|
153
|
+
|
154
|
+
NewRelic::Agent.config.apply_config(:'error_collector.ignore_errors' => "IOError")
|
155
|
+
@error_collector.notice_error(IOError.new("message"))
|
156
|
+
|
157
|
+
errors = @error_collector.harvest_errors([])
|
158
|
+
|
159
|
+
assert_equal 1, errors.length
|
160
|
+
|
161
|
+
end
|
162
|
+
|
163
|
+
def test_exclude_block
|
164
|
+
@error_collector.ignore_error_filter &wrapped_filter_proc
|
165
|
+
|
166
|
+
@error_collector.notice_error(IOError.new("message"), :metric => 'path', :request_params => {:x => 'y'})
|
167
|
+
@error_collector.notice_error(StandardError.new("message"), :metric => 'path', :request_params => {:x => 'y'})
|
168
|
+
|
169
|
+
errors = @error_collector.harvest_errors([])
|
170
|
+
|
171
|
+
assert_equal 1, errors.length
|
172
|
+
end
|
173
|
+
|
174
|
+
def test_obfuscates_error_messages_when_high_security_is_set
|
175
|
+
with_config(:high_security => true) do
|
176
|
+
@error_collector.notice_error(StandardError.new("YO SQL BAD: serect * flom test where foo = 'bar'"))
|
177
|
+
@error_collector.notice_error(StandardError.new("YO SQL BAD: serect * flom test where foo in (1,2,3,4,5)"))
|
178
|
+
|
179
|
+
old_errors = []
|
180
|
+
errors = @error_collector.harvest_errors([])
|
181
|
+
|
182
|
+
assert_equal('YO SQL BAD: serect * flom test where foo = ?',
|
183
|
+
errors[0].message)
|
184
|
+
assert_equal('YO SQL BAD: serect * flom test where foo in (?,?,?,?,?)',
|
185
|
+
errors[1].message)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
def test_increments_count_on_errors
|
190
|
+
expects_error_count_increase(1) do
|
191
|
+
@error_collector.notice_error(StandardError.new("Boo"))
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
def test_increment_error_count_record_summary_and_txn_metric
|
196
|
+
txn_info = NewRelic::Agent::TransactionInfo.new
|
197
|
+
txn_info.transaction_name = 'Controller/class/method'
|
198
|
+
NewRelic::Agent::TransactionInfo.stubs(:get).returns(txn_info)
|
199
|
+
|
200
|
+
stats_engine = NewRelic::Agent.instance.stats_engine
|
201
|
+
stats_engine.reset_stats
|
202
|
+
@error_collector.increment_error_count!(StandardError.new('Boo'))
|
203
|
+
assert_equal(1, stats_engine.get_stats('Errors/all').call_count,
|
204
|
+
'Missing Errors/all metric')
|
205
|
+
assert_equal(1, stats_engine.get_stats('Errors/Controller/class/method').call_count,
|
206
|
+
'Missing Errors/Controller/class/method metric')
|
207
|
+
end
|
208
|
+
|
209
|
+
def test_doesnt_increment_error_count_on_transaction_if_nameless
|
210
|
+
txn_info = NewRelic::Agent::TransactionInfo.new
|
211
|
+
NewRelic::Agent::TransactionInfo.stubs(:get).returns(txn_info)
|
212
|
+
|
213
|
+
stats_engine = NewRelic::Agent.instance.stats_engine
|
214
|
+
stats_engine.reset_stats
|
215
|
+
@error_collector.increment_error_count!(StandardError.new('Boo'))
|
216
|
+
assert_equal(0, stats_engine.get_stats('Errors/(unknown)').call_count)
|
217
|
+
end
|
218
|
+
|
219
|
+
private
|
220
|
+
|
221
|
+
def expects_error_count_increase(increase)
|
222
|
+
count = get_error_stats
|
223
|
+
yield
|
224
|
+
assert_equal increase, get_error_stats - count
|
225
|
+
end
|
226
|
+
|
227
|
+
def get_error_stats
|
228
|
+
NewRelic::Agent.get_stats("Errors/all").call_count
|
229
|
+
end
|
230
|
+
|
231
|
+
def wrapped_filter_proc
|
232
|
+
Proc.new do |e|
|
233
|
+
if e.is_a? IOError
|
234
|
+
return nil
|
235
|
+
else
|
236
|
+
return e
|
237
|
+
end
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
def silence_stream(*args)
|
242
|
+
super
|
243
|
+
rescue NoMethodError
|
244
|
+
yield
|
245
|
+
end
|
246
|
+
end
|