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,96 @@
|
|
1
|
+
# Run faster standalone
|
2
|
+
ENV['SKIP_RAILS'] = 'true'
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
|
4
|
+
class NewRelic::Agent::BusyCalculatorTest < Test::Unit::TestCase
|
5
|
+
attr_reader :now
|
6
|
+
def setup
|
7
|
+
@now = Time.now.to_f
|
8
|
+
NewRelic::Agent::BusyCalculator.reset
|
9
|
+
@instance_busy = NewRelic::Agent::Stats.new
|
10
|
+
NewRelic::Agent::BusyCalculator.stubs(:instance_busy_stats).returns(@instance_busy)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_normal
|
14
|
+
# start the timewindow 10 seconds ago
|
15
|
+
# start a request at 10 seconds, 5 seconds long
|
16
|
+
NewRelic::Agent::BusyCalculator.stubs(:harvest_start).returns(now - 10.0)
|
17
|
+
NewRelic::Agent::BusyCalculator.dispatcher_start(now - 10.0)
|
18
|
+
NewRelic::Agent::BusyCalculator.dispatcher_finish(now - 5.0)
|
19
|
+
assert_equal 5, NewRelic::Agent::BusyCalculator.accumulator
|
20
|
+
NewRelic::Agent::BusyCalculator.harvest_busy
|
21
|
+
|
22
|
+
assert_equal 1, @instance_busy.call_count
|
23
|
+
assert_in_delta 0.50, @instance_busy.total_call_time, 0.05
|
24
|
+
end
|
25
|
+
def test_split
|
26
|
+
# start the timewindow 10 seconds ago
|
27
|
+
# start a request at 5 seconds, don't finish
|
28
|
+
NewRelic::Agent::BusyCalculator.stubs(:harvest_start).returns(now - 10.0)
|
29
|
+
NewRelic::Agent::BusyCalculator.dispatcher_start(now - 5.0)
|
30
|
+
NewRelic::Agent::BusyCalculator.harvest_busy
|
31
|
+
|
32
|
+
assert_equal 1, @instance_busy.call_count, @instance_busy
|
33
|
+
assert_in_delta 0.50, @instance_busy.total_call_time, 0.05
|
34
|
+
end
|
35
|
+
def test_reentrancy
|
36
|
+
# start the timewindow 10 seconds ago
|
37
|
+
# start a request at 5 seconds, don't finish, but make two more
|
38
|
+
# complete calls, which should be ignored.
|
39
|
+
NewRelic::Agent::BusyCalculator.stubs(:harvest_start).returns(now - 10.0)
|
40
|
+
NewRelic::Agent::BusyCalculator.dispatcher_start(now - 5.0)
|
41
|
+
NewRelic::Agent::BusyCalculator.dispatcher_start(now - 4.5)
|
42
|
+
NewRelic::Agent::BusyCalculator.dispatcher_start(now - 4.0)
|
43
|
+
NewRelic::Agent::BusyCalculator.dispatcher_finish(now - 3.5)
|
44
|
+
NewRelic::Agent::BusyCalculator.dispatcher_finish(now - 3.0)
|
45
|
+
NewRelic::Agent::BusyCalculator.dispatcher_start(now - 2.0)
|
46
|
+
NewRelic::Agent::BusyCalculator.dispatcher_finish(now - 1.0)
|
47
|
+
NewRelic::Agent::BusyCalculator.harvest_busy
|
48
|
+
|
49
|
+
assert_equal 1, @instance_busy.call_count
|
50
|
+
assert_in_delta 0.50, @instance_busy.total_call_time, 0.05
|
51
|
+
end
|
52
|
+
def test_concurrency
|
53
|
+
# start the timewindow 10 seconds ago
|
54
|
+
# start a request at 10 seconds, 5 seconds long
|
55
|
+
NewRelic::Agent::BusyCalculator.stubs(:harvest_start).returns(now - 10.0)
|
56
|
+
NewRelic::Agent::BusyCalculator.dispatcher_start(now - 8.0)
|
57
|
+
worker = Thread.new do
|
58
|
+
# Get busy for 6 - 3 seconds
|
59
|
+
NewRelic::Agent::BusyCalculator.dispatcher_start(now - 6.0)
|
60
|
+
NewRelic::Agent::BusyCalculator.dispatcher_start(now - 5.0)
|
61
|
+
NewRelic::Agent::BusyCalculator.dispatcher_finish(now - 4.0)
|
62
|
+
NewRelic::Agent::BusyCalculator.dispatcher_finish(now - 3.0)
|
63
|
+
end
|
64
|
+
# Get busy for 8 - 2 seconds
|
65
|
+
NewRelic::Agent::BusyCalculator.dispatcher_finish(now - 2.0)
|
66
|
+
worker.join
|
67
|
+
NewRelic::Agent::BusyCalculator.harvest_busy
|
68
|
+
|
69
|
+
assert_equal 1, @instance_busy.call_count
|
70
|
+
# 3 + 6 = 9, or 90%
|
71
|
+
assert_in_delta 0.90, @instance_busy.total_call_time, 0.1
|
72
|
+
|
73
|
+
end
|
74
|
+
def test_dont_ignore_zero_counts
|
75
|
+
assert_equal 0, @instance_busy.call_count, "Problem with test--instance busy not starting off at zero."
|
76
|
+
NewRelic::Agent::BusyCalculator.harvest_busy
|
77
|
+
NewRelic::Agent::BusyCalculator.harvest_busy
|
78
|
+
NewRelic::Agent::BusyCalculator.harvest_busy
|
79
|
+
assert_equal 3, @instance_busy.call_count
|
80
|
+
end
|
81
|
+
def test_can_turn_off_recording
|
82
|
+
with_config(:report_instance_busy => false) do
|
83
|
+
assert_equal 0, @instance_busy.call_count, "Problem with test--instance busy not starting off at zero."
|
84
|
+
NewRelic::Agent::BusyCalculator.harvest_busy
|
85
|
+
assert_equal 0, @instance_busy.call_count
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_finishing_without_starting_doesnt_raise
|
90
|
+
Thread.current[:busy_entries] = nil
|
91
|
+
assert_nothing_raised do
|
92
|
+
NewRelic::Agent::BusyCalculator.dispatcher_finish
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','test_helper'))
|
2
|
+
require 'new_relic/agent/configuration/environment_source'
|
3
|
+
|
4
|
+
module NewRelic::Agent::Configuration
|
5
|
+
class EnvironmentSourceTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@original_env = {}
|
9
|
+
@original_env.replace(ENV)
|
10
|
+
end
|
11
|
+
|
12
|
+
def teardown
|
13
|
+
ENV.replace(@original_env)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_environment_strings_are_applied
|
17
|
+
assert_applied_string 'NRCONFIG', 'config_path'
|
18
|
+
assert_applied_string 'NEW_RELIC_LICENSE_KEY', 'license_key'
|
19
|
+
assert_applied_string 'NEWRELIC_LICENSE_KEY', 'license_key'
|
20
|
+
assert_applied_string 'NEW_RELIC_APP_NAME', 'app_name'
|
21
|
+
assert_applied_string 'NEWRELIC_APP_NAME', 'app_name'
|
22
|
+
assert_applied_string 'NEW_RELIC_HOST', 'host'
|
23
|
+
assert_applied_string 'NEW_RELIC_PORT', 'port'
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_environment_symbols_are_applied
|
27
|
+
assert_applied_symbol 'NEW_RELIC_DISPATCHER', 'dispatcher'
|
28
|
+
assert_applied_symbol 'NEWRELIC_DISPATCHER', 'dispatcher'
|
29
|
+
assert_applied_symbol 'NEW_RELIC_FRAMEWORK', 'framework'
|
30
|
+
assert_applied_symbol 'NEWRELIC_FRAMEWORK', 'framework'
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_environment_booleans_truths_are_applied
|
34
|
+
ENV['NEWRELIC_ENABLE'] = 'true'
|
35
|
+
assert EnvironmentSource.new[:agent_enabled]
|
36
|
+
ENV['NEWRELIC_ENABLE'] = 'on'
|
37
|
+
assert EnvironmentSource.new[:agent_enabled]
|
38
|
+
ENV['NEWRELIC_ENABLE'] = 'yes'
|
39
|
+
assert EnvironmentSource.new[:agent_enabled]
|
40
|
+
ENV.delete('NEWRELIC_ENABLE')
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_environment_booleans_falsehoods_are_applied
|
44
|
+
ENV['NEWRELIC_ENABLE'] = 'false'
|
45
|
+
assert !EnvironmentSource.new[:agent_enabled]
|
46
|
+
ENV['NEWRELIC_ENABLE'] = 'off'
|
47
|
+
assert !EnvironmentSource.new[:agent_enabled]
|
48
|
+
ENV['NEWRELIC_ENABLE'] = 'no'
|
49
|
+
assert !EnvironmentSource.new[:agent_enabled]
|
50
|
+
ENV.delete('NEWRELIC_ENABLE')
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_set_log_config_from_environment
|
54
|
+
ENV['NEW_RELIC_LOG'] = 'off/in/space.log'
|
55
|
+
source = EnvironmentSource.new
|
56
|
+
assert_equal 'off/in', source[:log_file_path]
|
57
|
+
assert_equal 'space.log', source[:log_file_name]
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_set_log_config_STDOUT_from_environment
|
61
|
+
ENV['NEW_RELIC_LOG'] = 'STDOUT'
|
62
|
+
source = EnvironmentSource.new
|
63
|
+
assert_equal 'STDOUT', source[:log_file_name]
|
64
|
+
assert_equal 'STDOUT', source[:log_file_path]
|
65
|
+
end
|
66
|
+
|
67
|
+
def assert_applied_string(env_var, config_var)
|
68
|
+
ENV[env_var] = 'test value'
|
69
|
+
assert_equal 'test value', EnvironmentSource.new[config_var.to_sym]
|
70
|
+
ENV.delete(env_var)
|
71
|
+
end
|
72
|
+
|
73
|
+
def assert_applied_symbol(env_var, config_var)
|
74
|
+
ENV[env_var] = 'test value'
|
75
|
+
assert_equal :'test value', EnvironmentSource.new[config_var.to_sym]
|
76
|
+
ENV.delete(env_var)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,232 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','test_helper'))
|
2
|
+
require 'new_relic/agent/configuration/manager'
|
3
|
+
require 'new_relic/agent/configuration/mask_defaults'
|
4
|
+
|
5
|
+
module NewRelic::Agent::Configuration
|
6
|
+
class ManagerTest < Test::Unit::TestCase
|
7
|
+
def setup
|
8
|
+
@manager = NewRelic::Agent::Configuration::Manager.new
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_should_use_indifferent_access
|
12
|
+
config = NewRelic::Agent::Configuration::DottedHash.new('string' => 'string', :symbol => 'symbol')
|
13
|
+
@manager.apply_config(config)
|
14
|
+
assert_equal 'string', @manager[:string]
|
15
|
+
assert_equal 'symbol', @manager['symbol']
|
16
|
+
@manager.remove_config(config)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_should_apply_config_sources_in_order
|
20
|
+
config0 = {
|
21
|
+
:foo => 'default foo',
|
22
|
+
:bar => 'default bar',
|
23
|
+
:baz => 'default baz'
|
24
|
+
}
|
25
|
+
@manager.apply_config(config0)
|
26
|
+
config1 = { :foo => 'real foo' }
|
27
|
+
@manager.apply_config(config1)
|
28
|
+
config2 = { :foo => 'wrong foo', :bar => 'real bar' }
|
29
|
+
@manager.apply_config(config2, 1)
|
30
|
+
|
31
|
+
assert_equal 'real foo', @manager['foo']
|
32
|
+
assert_equal 'real bar', @manager['bar']
|
33
|
+
assert_equal 'default baz', @manager['baz']
|
34
|
+
|
35
|
+
@manager.remove_config(config0)
|
36
|
+
@manager.remove_config(config1)
|
37
|
+
@manager.remove_config(config2)
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_identifying_config_source
|
41
|
+
hash_source = {:foo => 'foo', :bar => 'default'}
|
42
|
+
@manager.apply_config(hash_source)
|
43
|
+
test_source = TestSource.new
|
44
|
+
test_source[:bar] = 'bar'
|
45
|
+
test_source[:baz] = 'baz'
|
46
|
+
@manager.apply_config(test_source)
|
47
|
+
|
48
|
+
assert_not_equal test_source, @manager.source(:foo)
|
49
|
+
assert_equal test_source, @manager.source(:bar)
|
50
|
+
assert_equal test_source, @manager.source(:baz)
|
51
|
+
|
52
|
+
@manager.remove_config(hash_source)
|
53
|
+
@manager.remove_config(test_source)
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_callable_value_for_config_should_return_computed_value
|
57
|
+
source = {
|
58
|
+
:foo => 'bar',
|
59
|
+
:simple_value => Proc.new { '666' },
|
60
|
+
:reference => Proc.new { self['foo'] }
|
61
|
+
}
|
62
|
+
@manager.apply_config(source)
|
63
|
+
|
64
|
+
assert_equal 'bar', @manager[:foo]
|
65
|
+
assert_equal '666', @manager[:simple_value]
|
66
|
+
assert_equal 'bar', @manager[:reference]
|
67
|
+
|
68
|
+
@manager.remove_config(source)
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_should_not_apply_removed_sources
|
72
|
+
test_source = TestSource.new
|
73
|
+
@manager.apply_config(test_source)
|
74
|
+
@manager.remove_config(test_source)
|
75
|
+
|
76
|
+
assert_equal nil, @manager['test_config_accessor']
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_should_read_license_key_from_env
|
80
|
+
ENV['NEWRELIC_LICENSE_KEY'] = 'right'
|
81
|
+
manager = NewRelic::Agent::Configuration::Manager.new
|
82
|
+
manager.apply_config({:license_key => 'wrong'}, 1)
|
83
|
+
|
84
|
+
assert_equal 'right', manager['license_key']
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_config_values_should_be_memoized
|
88
|
+
@manager.apply_config(:setting => 'correct value')
|
89
|
+
assert_equal 'correct value', @manager[:setting]
|
90
|
+
|
91
|
+
@manager.config_stack.unshift(:setting => 'wrong value')
|
92
|
+
assert_equal 'correct value', @manager[:setting]
|
93
|
+
end
|
94
|
+
|
95
|
+
def test_dotted_hash_to_hash_is_plain_hash
|
96
|
+
dotted = NewRelic::Agent::Configuration::DottedHash.new({})
|
97
|
+
assert_equal(::Hash, dotted.to_hash.class)
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_to_collector_hash
|
101
|
+
@manager.instance_variable_set(:@config_stack, [])
|
102
|
+
@manager.apply_config(:eins => Proc.new { self[:one] })
|
103
|
+
@manager.apply_config(:one => 1)
|
104
|
+
@manager.apply_config(:two => 2)
|
105
|
+
@manager.apply_config(:nested => {:madness => 'test'})
|
106
|
+
@manager.apply_config(:'nested.madness' => 'test')
|
107
|
+
|
108
|
+
assert_equal({ :eins => 1, :one => 1, :two => 2, :'nested.madness' => 'test' },
|
109
|
+
@manager.to_collector_hash)
|
110
|
+
end
|
111
|
+
|
112
|
+
# Necessary to keep the pruby marshaller happy
|
113
|
+
def test_to_collector_hash_returns_bare_hash
|
114
|
+
@manager.instance_variable_set(:@config_stack, [])
|
115
|
+
@manager.apply_config(:eins => Proc.new { self[:one] })
|
116
|
+
|
117
|
+
assert_equal(::Hash, @manager.to_collector_hash.class)
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_config_masks
|
121
|
+
NewRelic::Agent::Configuration::MASK_DEFAULTS[:boo] = Proc.new { true }
|
122
|
+
|
123
|
+
@manager.apply_config(:boo => 1)
|
124
|
+
|
125
|
+
assert_equal false, @manager.to_collector_hash.has_key?(:boo)
|
126
|
+
end
|
127
|
+
|
128
|
+
def test_config_masks_conditionally
|
129
|
+
NewRelic::Agent::Configuration::MASK_DEFAULTS[:boo] = Proc.new { false }
|
130
|
+
|
131
|
+
@manager.apply_config(:boo => 1)
|
132
|
+
|
133
|
+
assert @manager.to_collector_hash.has_key?(:boo)
|
134
|
+
end
|
135
|
+
|
136
|
+
def test_config_masks_thread_profiler
|
137
|
+
supported = NewRelic::Agent::ThreadProfiler.is_supported?
|
138
|
+
reported_config = @manager.to_collector_hash
|
139
|
+
|
140
|
+
if supported
|
141
|
+
assert_not_nil reported_config[:'thread_profiler.enabled']
|
142
|
+
else
|
143
|
+
assert_equal nil, reported_config[:'thread_profiler.enabled']
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
def test_replacing_a_layer_by_class
|
148
|
+
old_config = NewRelic::Agent::Configuration::ManualSource.new(:test => 'wrong')
|
149
|
+
@manager.apply_config(old_config, 1)
|
150
|
+
new_config = NewRelic::Agent::Configuration::ManualSource.new(:test => 'right')
|
151
|
+
@manager.replace_or_add_config(new_config)
|
152
|
+
|
153
|
+
assert_equal 'right', @manager[:test]
|
154
|
+
assert_equal 3, @manager.config_stack.size
|
155
|
+
assert_equal 1, @manager.config_stack.map{|s| s.class} \
|
156
|
+
.index(NewRelic::Agent::Configuration::ManualSource)
|
157
|
+
end
|
158
|
+
|
159
|
+
def test_registering_a_callback
|
160
|
+
observed_value = 'old'
|
161
|
+
@manager.apply_config(:test => 'original')
|
162
|
+
|
163
|
+
@manager.register_callback(:test) do |value|
|
164
|
+
observed_value = value
|
165
|
+
end
|
166
|
+
assert_equal 'original', observed_value
|
167
|
+
|
168
|
+
@manager.apply_config(:test => 'new')
|
169
|
+
assert_equal 'new', observed_value
|
170
|
+
end
|
171
|
+
|
172
|
+
def test_callback_not_called_if_no_change
|
173
|
+
@manager.apply_config(:test => true, :other => false)
|
174
|
+
@manager.register_callback(:test) do |value|
|
175
|
+
state = 'wrong'
|
176
|
+
end
|
177
|
+
state = 'right'
|
178
|
+
config = {:test => true}
|
179
|
+
@manager.apply_config(config)
|
180
|
+
@manager.remove_config(config)
|
181
|
+
|
182
|
+
assert_equal 'right', state
|
183
|
+
end
|
184
|
+
|
185
|
+
def test_finished_configuring
|
186
|
+
@manager.apply_config(:layer => "yo")
|
187
|
+
assert_equal false, @manager.finished_configuring?
|
188
|
+
|
189
|
+
@manager.apply_config(ServerSource.new({}))
|
190
|
+
assert_equal true, @manager.finished_configuring?
|
191
|
+
end
|
192
|
+
|
193
|
+
def test_notifies_finished_configuring
|
194
|
+
called = false
|
195
|
+
NewRelic::Agent.instance.events.subscribe(:finished_configuring) { called = true }
|
196
|
+
@manager.apply_config(ServerSource.new({}))
|
197
|
+
|
198
|
+
assert_equal true, called
|
199
|
+
end
|
200
|
+
|
201
|
+
def test_doesnt_notify_unless_finished
|
202
|
+
called = false
|
203
|
+
NewRelic::Agent.instance.events.subscribe(:finished_configuring) { called = true }
|
204
|
+
|
205
|
+
@manager.apply_config(:fake => "config")
|
206
|
+
@manager.apply_config(ManualSource.new(:manual => true))
|
207
|
+
@manager.apply_config(YamlSource.new("", "test"))
|
208
|
+
|
209
|
+
assert_equal false, called
|
210
|
+
end
|
211
|
+
|
212
|
+
|
213
|
+
def test_should_log_when_applying
|
214
|
+
expects_logging(:debug, anything, includes("asdf"))
|
215
|
+
@manager.apply_config(:test => "asdf")
|
216
|
+
end
|
217
|
+
|
218
|
+
def test_should_log_when_removing
|
219
|
+
config = { :test => "asdf" }
|
220
|
+
@manager.apply_config(config)
|
221
|
+
|
222
|
+
expects_logging(:debug, anything, Not(includes("asdf")))
|
223
|
+
@manager.remove_config(config)
|
224
|
+
end
|
225
|
+
|
226
|
+
class TestSource < ::Hash
|
227
|
+
def test_config_accessor
|
228
|
+
'some value'
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','test_helper'))
|
2
|
+
require 'new_relic/agent/configuration/server_source'
|
3
|
+
|
4
|
+
module NewRelic::Agent::Configuration
|
5
|
+
class ServerSourceTest < Test::Unit::TestCase
|
6
|
+
def setup
|
7
|
+
config = {
|
8
|
+
'agent_config' => {
|
9
|
+
'slow_sql.enabled' => true,
|
10
|
+
'transaction_tracer.transaction_threshold' => 'apdex_f',
|
11
|
+
'transaction_tracer.record_sql' => 'raw',
|
12
|
+
'error_collector.enabled' => true
|
13
|
+
},
|
14
|
+
'apdex_t' => 1.0,
|
15
|
+
'collect_errors' => false,
|
16
|
+
'collect_traces' => true,
|
17
|
+
'web_transactions_apdex' => { 'Controller/some/txn' => 1.5 }
|
18
|
+
}
|
19
|
+
@source = ServerSource.new(config)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_should_set_apdex_t
|
23
|
+
assert_equal 1.0, @source[:apdex_t]
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_should_set_agent_config_values
|
27
|
+
assert_equal 'raw', @source[:'transaction_tracer.record_sql']
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_should_not_dot_the_agent_config_sub_hash
|
31
|
+
assert_nil @source[:'agent_config.slow_sql.enabled']
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_should_enable_tracer_as_configured
|
35
|
+
assert @source[:'slow_sql.enabled']
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_should_disable_tracer_as_configured
|
39
|
+
assert !@source[:'error_collector.enabled']
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_should_ignore_apdex_f_setting_for_transaction_threshold
|
43
|
+
assert_equal nil, @source[:'transaction_tracer.transaction_threshold']
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_should_not_dot_the_web_transactions_apdex_hash
|
47
|
+
assert_equal 1.5, @source[:web_transactions_apdex]['Controller/some/txn']
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|