newrelic_rpm 3.7.2.195 → 3.7.3.199
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +25 -1
- data/Rakefile +7 -0
- data/lib/new_relic/agent/agent.rb +19 -13
- data/lib/new_relic/agent/configuration/default_source.rb +23 -0
- data/lib/new_relic/agent/cross_app_tracing.rb +2 -0
- data/lib/new_relic/agent/database.rb +123 -94
- data/lib/new_relic/agent/database/obfuscation_helpers.rb +37 -0
- data/lib/new_relic/agent/database/obfuscator.rb +65 -0
- data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +49 -0
- data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +2 -1
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +9 -8
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +1 -38
- data/lib/new_relic/agent/instrumentation/rubyprof.rb +26 -0
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +3 -2
- data/lib/new_relic/agent/pipe_channel_manager.rb +45 -12
- data/lib/new_relic/agent/pipe_service.rb +14 -8
- data/lib/new_relic/agent/request_sampler.rb +63 -6
- data/lib/new_relic/agent/sampler_collection.rb +5 -2
- data/lib/new_relic/agent/shim_agent.rb +1 -1
- data/lib/new_relic/agent/transaction.rb +41 -22
- data/lib/new_relic/agent/transaction_sample_builder.rb +0 -4
- data/lib/new_relic/agent/transaction_sampler.rb +2 -5
- data/lib/new_relic/agent/transaction_state.rb +43 -11
- data/lib/new_relic/agent/vm.rb +32 -0
- data/lib/new_relic/agent/vm/jruby_vm.rb +40 -0
- data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +36 -0
- data/lib/new_relic/agent/vm/mri_vm.rb +86 -0
- data/lib/new_relic/agent/vm/rubinius_vm.rb +40 -0
- data/lib/new_relic/agent/vm/snapshot.rb +16 -0
- data/lib/new_relic/control.rb +0 -6
- data/lib/new_relic/language_support.rb +20 -0
- data/lib/new_relic/latest_changes.rb +41 -12
- data/lib/new_relic/rack/developer_mode.rb +8 -1
- data/lib/new_relic/rack/transaction_reset.rb +1 -1
- data/lib/new_relic/transaction_sample.rb +0 -13
- data/lib/new_relic/version.rb +1 -1
- data/lib/tasks/install.rake +5 -0
- data/newrelic_rpm.gemspec +2 -1
- data/test/active_record_fixtures.rb +7 -9
- data/test/agent_helper.rb +11 -50
- data/test/environments/lib/environments/runner.rb +3 -5
- data/test/environments/rails40/Gemfile +12 -3
- data/test/environments/rails41/Gemfile +34 -0
- data/test/environments/rails41/Rakefile +11 -0
- data/test/environments/rails41/config/application.rb +18 -0
- data/test/environments/rails41/config/boot.rb +10 -0
- data/test/environments/rails41/config/database.yml +26 -0
- data/test/environments/rails41/config/environment.rb +6 -0
- data/test/environments/rails41/db/schema.rb +5 -0
- data/test/fixtures/cross_agent_tests/README.md +12 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/basic_where.colon_obfuscated.txt +3 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/basic_where.explain.txt +3 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/basic_where.obfuscated.txt +3 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/basic_where.query.txt +1 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/current_date.colon_obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/current_date.explain.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/current_date.obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/current_date.query.txt +1 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/date.colon_obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/date.explain.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/date.obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/date.query.txt +1 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/embedded_newline.colon_obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/embedded_newline.explain.txt +3 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/embedded_newline.obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/embedded_newline.query.txt +1 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/embedded_quote.colon_obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/embedded_quote.explain.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/embedded_quote.obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/embedded_quote.query.txt +1 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/floating_point.colon_obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/floating_point.explain.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/floating_point.obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/floating_point.query.txt +1 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/function_with_strings.colon_obfuscated.txt +5 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/function_with_strings.explain.txt +5 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/function_with_strings.obfuscated.txt +5 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/function_with_strings.query.txt +1 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/quote_in_table_name.colon_obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/quote_in_table_name.explain.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/quote_in_table_name.obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/quote_in_table_name.query.txt +1 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/subplan.colon_obfuscated.txt +5 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/subplan.explain.txt +5 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/subplan.obfuscated.txt +5 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/subplan.query.txt +1 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/where_with_integer.colon_obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/where_with_integer.explain.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/where_with_integer.obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/where_with_integer.query.txt +1 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/where_with_regex_chars.colon_obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/where_with_regex_chars.explain.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/where_with_regex_chars.obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/where_with_regex_chars.query.txt +1 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/where_with_substring.colon_obfuscated.txt +3 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/where_with_substring.explain.txt +3 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/where_with_substring.obfuscated.txt +3 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/where_with_substring.query.txt +1 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case1.colon_obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case1.explain.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case1.obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case1.query.txt +1 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case2.colon_obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case2.explain.txt +3 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case2.obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case2.query.txt +1 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case3.colon_obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case3.explain.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case3.obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case3.query.txt +1 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case4.colon_obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case4.explain.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case4.obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case4.query.txt +1 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case5.colon_obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case5.explain.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case5.obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case5.query.txt +1 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case6.colon_obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case6.explain.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case6.obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case6.query.txt +1 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case7.colon_obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case7.explain.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case7.obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case7.query.txt +1 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case8.colon_obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case8.explain.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case8.obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case8.query.txt +1 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case9.colon_obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case9.explain.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case9.obfuscated.txt +2 -0
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/with_escape_case9.query.txt +1 -0
- data/test/fixtures/cross_agent_tests/rules.json +165 -0
- data/test/fixtures/cross_agent_tests/rum_client_config.json +142 -0
- data/test/fixtures/cross_agent_tests/rum_cookie.json +17 -0
- data/test/fixtures/cross_agent_tests/rum_footer_insertion_location/close-body-in-comment.html +10 -0
- data/test/fixtures/cross_agent_tests/rum_footer_insertion_location/dynamic-iframe.html +19 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/basic.html +10 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/body_with_attributes.html +3 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/charset_tag.html +11 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/charset_tag_after_x_ua_tag.html +11 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/charset_tag_before_x_ua_tag.html +11 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/charset_tag_with_spaces.html +11 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/comments1.html +24 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/comments2.html +24 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/content_type_charset_tag.html +11 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/content_type_charset_tag_after_x_ua_tag.html +11 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/content_type_charset_tag_before_x_ua_tag.html +11 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/gt_in_quotes1.html +27 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/gt_in_quotes2.html +24 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/gt_in_quotes_mismatch.html +24 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/gt_in_single_quotes1.html +25 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/gt_in_single_quotes_mismatch.html +25 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/head_with_attributes.html +10 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/incomplete_non_meta_tags.html +10 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/no_header.html +7 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/no_html_and_no_header.html +3 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/no_start_header.html +9 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/script1.html +19 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/script2.html +17 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/x_ua_meta_tag.html +10 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/x_ua_meta_tag_multiline.html +11 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/x_ua_meta_tag_spaces_around_equals.html +10 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/x_ua_meta_tag_with_others.html +11 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/x_ua_meta_tag_with_spaces.html +10 -0
- data/test/fixtures/cross_agent_tests/sql_parsing.json +55 -0
- data/test/fixtures/cross_agent_tests/url_clean.json +15 -0
- data/test/fixtures/cross_agent_tests/url_domain_extraction.json +35 -0
- data/test/flaky_proxy/README.md +91 -33
- data/test/flaky_proxy/lib/flaky_proxy.rb +1 -0
- data/test/flaky_proxy/lib/flaky_proxy/http_message.rb +2 -0
- data/test/flaky_proxy/lib/flaky_proxy/proxy.rb +19 -4
- data/test/flaky_proxy/lib/flaky_proxy/rule.rb +13 -16
- data/test/flaky_proxy/lib/flaky_proxy/rule_set.rb +10 -2
- data/test/flaky_proxy/lib/flaky_proxy/sequence.rb +14 -0
- data/test/helpers/file_searching.rb +1 -1
- data/test/intentional_fail.rb +1 -1
- data/test/multiverse/lib/multiverse/suite.rb +26 -3
- data/test/multiverse/suites/active_record/Envfile +1 -1
- data/test/multiverse/suites/active_record/ar_method_aliasing.rb +1 -1
- data/test/multiverse/suites/agent_only/audit_log_test.rb +1 -1
- data/test/multiverse/suites/agent_only/collector_exception_handling_test.rb +1 -1
- data/test/multiverse/suites/agent_only/cross_application_tracing_test.rb +1 -1
- data/test/multiverse/suites/agent_only/encoding_handling_test.rb +1 -1
- data/test/multiverse/suites/agent_only/harvest_timestamps_test.rb +1 -1
- data/test/multiverse/suites/agent_only/http_response_code_test.rb +1 -1
- data/test/multiverse/suites/agent_only/key_transactions_test.rb +1 -1
- data/test/multiverse/suites/agent_only/logging_test.rb +1 -1
- data/test/multiverse/suites/agent_only/marshaling_test.rb +1 -1
- data/test/multiverse/suites/agent_only/pipe_manager_test.rb +1 -1
- data/test/multiverse/suites/agent_only/rename_rule_test.rb +1 -1
- data/test/multiverse/suites/agent_only/rum_instrumentation_test.rb +1 -1
- data/test/multiverse/suites/agent_only/service_timeout_test.rb +1 -1
- data/test/multiverse/suites/agent_only/set_transaction_name_test.rb +1 -1
- data/test/multiverse/suites/agent_only/ssl_test.rb +1 -1
- data/test/multiverse/suites/agent_only/start_up_test.rb +1 -1
- data/test/multiverse/suites/agent_only/thread_profiling_test.rb +1 -1
- data/test/multiverse/suites/agent_only/xray_sessions_test.rb +1 -1
- data/test/multiverse/suites/bare/standalone_instrumentation_test.rb +1 -1
- data/test/multiverse/suites/config_file_loading/config_file_loading_test.rb +1 -1
- data/test/multiverse/suites/curb/curb_test.rb +1 -1
- data/test/multiverse/suites/datamapper/datamapper_test.rb +1 -1
- data/test/multiverse/suites/deferred_instrumentation/sinatra_test.rb +1 -1
- data/test/multiverse/suites/excon/excon_test.rb +1 -1
- data/test/multiverse/suites/httpclient/httpclient_test.rb +1 -1
- data/test/multiverse/suites/mongo/helpers/mongo_operation_tests.rb +7 -3
- data/test/multiverse/suites/mongo/mongo_instrumentation_test.rb +1 -1
- data/test/multiverse/suites/mongo/mongo_unsupported_version_test.rb +2 -2
- data/test/multiverse/suites/net_http/net_http_test.rb +1 -1
- data/test/multiverse/suites/padrino/Envfile +1 -1
- data/test/multiverse/suites/padrino/padrino_test.rb +1 -1
- data/test/multiverse/suites/rails/Envfile +10 -0
- data/test/multiverse/suites/rails/request_statistics_test.rb +59 -6
- data/test/multiverse/suites/rails/view_instrumentation_test.rb +1 -0
- data/test/multiverse/suites/resque/instrumentation_test.rb +1 -1
- data/test/multiverse/suites/sequel/sequel_instrumentation_test.rb +5 -18
- data/test/multiverse/suites/sequel/sequel_safety_test.rb +1 -1
- data/test/multiverse/suites/sidekiq/sidekiq_instrumentation_test.rb +1 -1
- data/test/multiverse/suites/sinatra/ignoring_test.rb +1 -1
- data/test/multiverse/suites/sinatra/sinatra_classic_test.rb +1 -1
- data/test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb +1 -1
- data/test/multiverse/suites/sinatra/sinatra_metric_explosion_test.rb +1 -1
- data/test/multiverse/suites/sinatra/sinatra_modular_test.rb +1 -1
- data/test/multiverse/suites/sinatra/sinatra_routes_test.rb +1 -1
- data/test/multiverse/suites/typhoeus/typhoeus_test.rb +36 -2
- data/test/new_relic/FAKECHANGELOG +21 -0
- data/test/new_relic/agent/agent/connect_test.rb +1 -1
- data/test/new_relic/agent/agent/start_test.rb +1 -1
- data/test/new_relic/agent/agent/start_worker_thread_test.rb +1 -1
- data/test/new_relic/agent/agent_logger_test.rb +1 -1
- data/test/new_relic/agent/agent_test.rb +14 -8
- data/test/new_relic/agent/apdex_from_server_test.rb +1 -1
- data/test/new_relic/agent/audit_logger_test.rb +1 -1
- data/test/new_relic/agent/autostart_test.rb +1 -1
- data/test/new_relic/agent/browser_token_test.rb +1 -1
- data/test/new_relic/agent/busy_calculator_test.rb +1 -1
- data/test/new_relic/agent/commands/agent_command_router_test.rb +1 -1
- data/test/new_relic/agent/commands/agent_command_test.rb +1 -1
- data/test/new_relic/agent/commands/thread_profiler_session_test.rb +2 -2
- data/test/new_relic/agent/commands/xray_session_collection_test.rb +1 -1
- data/test/new_relic/agent/commands/xray_session_test.rb +1 -1
- data/test/new_relic/agent/configuration/default_source_test.rb +1 -1
- data/test/new_relic/agent/configuration/environment_source_test.rb +1 -1
- data/test/new_relic/agent/configuration/manager_test.rb +1 -1
- data/test/new_relic/agent/configuration/orphan_configuration_test.rb +1 -1
- data/test/new_relic/agent/configuration/server_source_test.rb +1 -1
- data/test/new_relic/agent/configuration/yaml_source_test.rb +1 -1
- data/test/new_relic/agent/cpu_sampler_test.rb +1 -1
- data/test/new_relic/agent/cross_app_monitor_test.rb +3 -3
- data/test/new_relic/agent/cross_app_tracing_test.rb +1 -1
- data/test/new_relic/agent/database/postgres_explain_obfuscator_test.rb +34 -0
- data/test/new_relic/agent/database_test.rb +192 -5
- data/test/new_relic/agent/datastores/mongo/metric_generator_test.rb +1 -1
- data/test/new_relic/agent/datastores/mongo/metric_translator_test.rb +11 -1
- data/test/new_relic/agent/datastores/mongo/obfuscator_test.rb +1 -1
- data/test/new_relic/agent/datastores/mongo/statement_formatter_test.rb +1 -1
- data/test/new_relic/agent/error_collector/notice_error_test.rb +1 -1
- data/test/new_relic/agent/error_collector_test.rb +1 -1
- data/test/new_relic/agent/event_listener_test.rb +1 -1
- data/test/new_relic/agent/harvester_test.rb +1 -1
- data/test/new_relic/agent/http_clients/uri_util_test.rb +1 -1
- data/test/new_relic/agent/instrumentation/action_controller_subscriber_test.rb +1 -1
- data/test/new_relic/agent/instrumentation/action_view_subscriber_test.rb +1 -1
- data/test/new_relic/agent/instrumentation/active_record_helper_test.rb +4 -4
- data/test/new_relic/agent/instrumentation/active_record_subscriber_test.rb +2 -2
- data/test/new_relic/agent/instrumentation/active_record_test.rb +385 -0
- data/test/new_relic/agent/instrumentation/controller_instrumentation_test.rb +1 -1
- data/test/new_relic/agent/instrumentation/instrumentation_test.rb +1 -1
- data/test/new_relic/agent/instrumentation/metric_frame_test.rb +1 -1
- data/test/new_relic/agent/instrumentation/net_instrumentation_test.rb +1 -1
- data/test/new_relic/agent/instrumentation/queue_time_test.rb +1 -1
- data/test/new_relic/agent/instrumentation/rack_test.rb +1 -1
- data/test/new_relic/agent/instrumentation/sinatra/transaction_namer_test.rb +1 -1
- data/test/new_relic/agent/instrumentation/sinatra_test.rb +1 -1
- data/test/new_relic/agent/instrumentation/task_instrumentation_test.rb +1 -1
- data/test/new_relic/agent/javascript_instrumentor_test.rb +3 -3
- data/test/new_relic/agent/memcache_instrumentation_test.rb +1 -1
- data/test/new_relic/agent/memory_logger_test.rb +1 -1
- data/test/new_relic/agent/method_interrobang_test.rb +1 -1
- data/test/new_relic/agent/method_tracer/class_methods/add_method_tracer_test.rb +1 -1
- data/test/new_relic/agent/method_tracer/instance_methods/trace_execution_scoped_test.rb +1 -1
- data/test/new_relic/agent/method_tracer_test.rb +1 -1
- data/test/new_relic/agent/method_visibility_test.rb +1 -1
- data/test/new_relic/agent/new_relic_service_test.rb +2 -2
- data/test/new_relic/agent/obfuscator_test.rb +1 -1
- data/test/new_relic/agent/pipe_channel_manager_test.rb +216 -143
- data/test/new_relic/agent/pipe_service_test.rb +26 -15
- data/test/new_relic/agent/request_sampler_test.rb +65 -18
- data/test/new_relic/agent/rpm_agent_test.rb +1 -1
- data/test/new_relic/agent/rules_engine_test.rb +1 -1
- data/test/new_relic/agent/sampled_buffer_test.rb +1 -1
- data/test/new_relic/agent/sampler_collection_test.rb +8 -1
- data/test/new_relic/agent/sampler_test.rb +1 -1
- data/test/new_relic/agent/shim_agent_test.rb +3 -3
- data/test/new_relic/agent/sql_sampler_test.rb +7 -6
- data/test/new_relic/agent/stats_engine/gc_profiler_test.rb +1 -1
- data/test/new_relic/agent/stats_engine/metric_stats_test.rb +1 -1
- data/test/new_relic/agent/stats_engine/samplers_test.rb +1 -1
- data/test/new_relic/agent/stats_engine_test.rb +1 -1
- data/test/new_relic/agent/stats_hash_test.rb +1 -1
- data/test/new_relic/agent/stats_test.rb +1 -1
- data/test/new_relic/agent/threading/agent_thread_test.rb +1 -1
- data/test/new_relic/agent/threading/backtrace_node_test.rb +1 -1
- data/test/new_relic/agent/threading/backtrace_service_test.rb +3 -3
- data/test/new_relic/agent/threading/thread_profile_test.rb +1 -1
- data/test/new_relic/agent/transaction/developer_mode_sample_buffer_test.rb +1 -1
- data/test/new_relic/agent/transaction/force_persist_sample_buffer_test.rb +1 -1
- data/test/new_relic/agent/transaction/pop_test.rb +1 -1
- data/test/new_relic/agent/transaction/slowest_sample_buffer_test.rb +1 -1
- data/test/new_relic/agent/transaction/xray_sample_buffer_test.rb +1 -1
- data/test/new_relic/agent/transaction_interrobang_test.rb +1 -1
- data/test/new_relic/agent/transaction_sample_builder_test.rb +1 -1
- data/test/new_relic/agent/transaction_sampler_test.rb +17 -17
- data/test/new_relic/agent/transaction_state_test.rb +61 -6
- data/test/new_relic/agent/transaction_test.rb +60 -3
- data/test/new_relic/agent/transaction_timings_test.rb +1 -1
- data/test/new_relic/agent/vm/monotonic_gc_profiler_test.rb +42 -0
- data/test/new_relic/agent/vm/mri_vm_test.rb +35 -0
- data/test/new_relic/agent/vm/snapshot_test.rb +8 -0
- data/test/new_relic/agent/vm_test.rb +48 -0
- data/test/new_relic/agent/worker_loop_test.rb +1 -1
- data/test/new_relic/agent_test.rb +1 -1
- data/test/new_relic/cli/deployments_test.rb +1 -1
- data/test/new_relic/coerce_test.rb +1 -1
- data/test/new_relic/collection_helper_test.rb +1 -1
- data/test/new_relic/control/class_methods_test.rb +1 -1
- data/test/new_relic/control/frameworks/rails_test.rb +1 -1
- data/test/new_relic/control_test.rb +1 -1
- data/test/new_relic/dependency_detection_test.rb +1 -1
- data/test/new_relic/dispatcher_test.rb +1 -1
- data/test/new_relic/environment_report_test.rb +1 -1
- data/test/new_relic/framework_test.rb +1 -1
- data/test/new_relic/http_client_test_cases.rb +1 -1
- data/test/new_relic/json_wrapper_test.rb +1 -1
- data/test/new_relic/language_support_test.rb +42 -1
- data/test/new_relic/latest_changes_test.rb +45 -0
- data/test/new_relic/license_test.rb +2 -2
- data/test/new_relic/load_test.rb +1 -1
- data/test/new_relic/local_environment_test.rb +1 -1
- data/test/new_relic/metric_data_test.rb +1 -1
- data/test/new_relic/metric_parser/metric_parser_test.rb +1 -1
- data/test/new_relic/metric_spec_test.rb +1 -1
- data/test/new_relic/multiverse_helpers.rb +0 -27
- data/test/new_relic/noticed_error_test.rb +1 -1
- data/test/new_relic/rack/agent_hooks_test.rb +1 -1
- data/test/new_relic/rack/all_test.rb +1 -1
- data/test/new_relic/rack/browser_monitoring_test.rb +2 -2
- data/test/new_relic/rack/deferred_instrumentation_test.rb +1 -1
- data/test/new_relic/rack/developer_mode_helper_test.rb +1 -1
- data/test/new_relic/rack/developer_mode_test.rb +2 -19
- data/test/new_relic/rack/error_collector_test.rb +1 -1
- data/test/new_relic/rack/transaction_reset_test.rb +1 -1
- data/test/new_relic/transaction_analysis/segment_summary_test.rb +1 -1
- data/test/new_relic/transaction_analysis_test.rb +1 -1
- data/test/new_relic/transaction_sample/composite_segment_test.rb +1 -1
- data/test/new_relic/transaction_sample/fake_segment_test.rb +1 -1
- data/test/new_relic/transaction_sample/segment_test.rb +2 -2
- data/test/new_relic/transaction_sample/summary_segment_test.rb +1 -1
- data/test/new_relic/transaction_sample_subtest_test.rb +1 -1
- data/test/new_relic/transaction_sample_test.rb +3 -3
- data/test/new_relic/version_number_test.rb +1 -1
- data/test/performance/lib/performance/instrumentation/stackprof.rb +33 -0
- data/test/performance/lib/performance/platform.rb +1 -0
- data/test/performance/suites/marshalling.rb +2 -1
- data/test/test_helper.rb +33 -3
- data/ui/views/newrelic/index.rhtml +2 -2
- metadata +169 -31
- metadata.gz.sig +0 -0
- data/lib/new_relic/control/profiling.rb +0 -29
- data/test/new_relic/agent/instrumentation/active_record_instrumentation_test.rb +0 -648
@@ -6,7 +6,7 @@ require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','test_h
|
|
6
6
|
require 'new_relic/agent/configuration/server_source'
|
7
7
|
|
8
8
|
module NewRelic::Agent::Configuration
|
9
|
-
class ServerSourceTest <
|
9
|
+
class ServerSourceTest < Minitest::Test
|
10
10
|
def setup
|
11
11
|
config = {
|
12
12
|
'agent_config' => {
|
@@ -6,7 +6,7 @@ require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','test_h
|
|
6
6
|
require 'new_relic/agent/configuration/yaml_source'
|
7
7
|
|
8
8
|
module NewRelic::Agent::Configuration
|
9
|
-
class YamlSourceTest <
|
9
|
+
class YamlSourceTest < Minitest::Test
|
10
10
|
def setup
|
11
11
|
@test_yml_path = File.expand_path(File.join(File.dirname(__FILE__),
|
12
12
|
'..','..','..',
|
@@ -6,7 +6,7 @@
|
|
6
6
|
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
|
7
7
|
require 'new_relic/agent/samplers/cpu_sampler'
|
8
8
|
|
9
|
-
class NewRelic::Agent::Samplers::CpuSamplerTest <
|
9
|
+
class NewRelic::Agent::Samplers::CpuSamplerTest < Minitest::Test
|
10
10
|
|
11
11
|
def setup
|
12
12
|
@original_jruby_version = JRUBY_VERSION if defined?(JRuby)
|
@@ -5,7 +5,7 @@
|
|
5
5
|
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
|
6
6
|
|
7
7
|
module NewRelic::Agent
|
8
|
-
class CrossAppMonitorTest <
|
8
|
+
class CrossAppMonitorTest < Minitest::Test
|
9
9
|
NEWRELIC_ID_HEADER = NewRelic::Agent::CrossAppMonitor::NEWRELIC_ID_HEADER
|
10
10
|
NEWRELIC_TXN_HEADER = NewRelic::Agent::CrossAppMonitor::NEWRELIC_TXN_HEADER
|
11
11
|
|
@@ -195,9 +195,9 @@ module NewRelic::Agent
|
|
195
195
|
event_listener = NewRelic::Agent.instance.events
|
196
196
|
event_listener.notify(:before_call, request)
|
197
197
|
in_transaction('transaction') do
|
198
|
-
#
|
198
|
+
# Fake out our GUID for easier comparison in tests
|
199
|
+
NewRelic::Agent::Transaction.current.stubs(:guid).returns(TRANSACTION_GUID)
|
199
200
|
end
|
200
|
-
NewRelic::Agent::TransactionState.get.request_guid = TRANSACTION_GUID
|
201
201
|
event_listener.notify(:after_call, request, [200, @response, ''])
|
202
202
|
end
|
203
203
|
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# This file is distributed under New Relic's license terms.
|
3
|
+
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
|
+
|
5
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'test_helper'))
|
6
|
+
require 'new_relic/agent/database/postgres_explain_obfuscator'
|
7
|
+
|
8
|
+
module NewRelic::Agent::Database
|
9
|
+
class PostgresExplainObfuscatorTest < Minitest::Test
|
10
|
+
attr_reader :obfuscator
|
11
|
+
|
12
|
+
def self.input_files
|
13
|
+
fixture_dir = File.join(cross_agent_tests_dir, "postgres_explain_obfuscation")
|
14
|
+
Dir["#{fixture_dir}/*.explain.txt"]
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.name_for_input_file(input_file)
|
18
|
+
File.basename(input_file, ".explain.txt")
|
19
|
+
end
|
20
|
+
|
21
|
+
input_files.each do |input_file|
|
22
|
+
define_method("test_#{name_for_input_file(input_file)}_explain_plan_obfuscation") do
|
23
|
+
explain = File.read(input_file)
|
24
|
+
expected_obfuscated = File.read(obfuscated_filename(input_file))
|
25
|
+
actual_obfuscated = PostgresExplainObfuscator.obfuscate(explain)
|
26
|
+
assert_equal(expected_obfuscated, actual_obfuscated)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def obfuscated_filename(query_file)
|
31
|
+
query_file.gsub(".explain.", ".colon_obfuscated.")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -5,7 +5,7 @@
|
|
5
5
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..',
|
6
6
|
'test_helper'))
|
7
7
|
require 'new_relic/agent/database'
|
8
|
-
class NewRelic::Agent::DatabaseTest <
|
8
|
+
class NewRelic::Agent::DatabaseTest < Minitest::Test
|
9
9
|
def setup
|
10
10
|
@explainer = NewRelic::Agent::Instrumentation::ActiveRecord::EXPLAINER
|
11
11
|
end
|
@@ -14,10 +14,29 @@ class NewRelic::Agent::DatabaseTest < MiniTest::Unit::TestCase
|
|
14
14
|
NewRelic::Agent::Database::Obfuscator.instance.reset
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
18
|
-
|
19
|
-
assert_equal(
|
20
|
-
|
17
|
+
def test_adapter_from_config_string
|
18
|
+
config = { :adapter => 'mysql' }
|
19
|
+
assert_equal('mysql', NewRelic::Agent::Database.adapter_from_config(config))
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_adapter_from_config_symbol
|
23
|
+
config = { :adapter => :mysql }
|
24
|
+
assert_equal('mysql', NewRelic::Agent::Database.adapter_from_config(config))
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_adapter_from_config_uri_jdbc_postgresql
|
28
|
+
config = { :uri=>"jdbc:postgresql://host/database?user=posgres" }
|
29
|
+
assert_equal('postgresql', NewRelic::Agent::Database.adapter_from_config(config))
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_adapter_from_config_uri_jdbc_mysql
|
33
|
+
config = { :uri=>"jdbc:mysql://host/database" }
|
34
|
+
assert_equal('mysql', NewRelic::Agent::Database.adapter_from_config(config))
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_adapter_from_config_uri_jdbc_sqlite
|
38
|
+
config = { :uri => "jdbc:sqlite::memory" }
|
39
|
+
assert_equal('sqlite', NewRelic::Agent::Database.adapter_from_config(config))
|
21
40
|
end
|
22
41
|
|
23
42
|
def test_explain_sql_select_with_mysql_connection
|
@@ -40,6 +59,73 @@ class NewRelic::Agent::DatabaseTest < MiniTest::Unit::TestCase
|
|
40
59
|
assert_equal(plan.values.compact.sort, result[1][0].compact.sort)
|
41
60
|
end
|
42
61
|
|
62
|
+
def test_explain_sql_select_with_mysql2_connection_sequel
|
63
|
+
config = { :adapter => 'mysql2' }
|
64
|
+
config.default('val')
|
65
|
+
sql = 'SELECT * FROM items'
|
66
|
+
|
67
|
+
# Sequel returns explain plans to us as one giant preformatted string rather
|
68
|
+
# than individual rows.
|
69
|
+
plan_string = [
|
70
|
+
"+--+-----------+-----+----+-------------+---+-------+---+----+-----+",
|
71
|
+
"|id|select_type|table|type|possible_keys|key|key_len|ref|rows|Extra|",
|
72
|
+
"+--+-----------+-----+----+-------------+---+-------+---+----+-----+",
|
73
|
+
"| 1|SIMPLE |items|ALL | | | | | 3| |",
|
74
|
+
"+--+-----------+-----+----+-------------+---+-------+---+----+-----+"
|
75
|
+
].join("\n")
|
76
|
+
|
77
|
+
connection = mock('mysql connection')
|
78
|
+
connection.expects(:execute).with('EXPLAIN SELECT * FROM items').returns(plan_string)
|
79
|
+
NewRelic::Agent::Database.stubs(:get_connection).returns(connection)
|
80
|
+
result = NewRelic::Agent::Database.explain_sql(sql, config, &@explainer)
|
81
|
+
assert_nil(result[0])
|
82
|
+
assert_equal([plan_string], result[1])
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_explain_sql_select_with_mysql_connection_sequel
|
86
|
+
config = { :adapter => 'mysql' }
|
87
|
+
config.default('val')
|
88
|
+
sql = 'SELECT * FROM items'
|
89
|
+
|
90
|
+
# Sequel returns explain plans to us as one giant preformatted string rather
|
91
|
+
# than individual rows.
|
92
|
+
plan_string = [
|
93
|
+
"+--+-----------+-----+----+-------------+---+-------+---+----+-----+",
|
94
|
+
"|id|select_type|table|type|possible_keys|key|key_len|ref|rows|Extra|",
|
95
|
+
"+--+-----------+-----+----+-------------+---+-------+---+----+-----+",
|
96
|
+
"| 1|SIMPLE |items|ALL | | | | | 3| |",
|
97
|
+
"+--+-----------+-----+----+-------------+---+-------+---+----+-----+"
|
98
|
+
].join("\n")
|
99
|
+
|
100
|
+
connection = mock('mysql connection')
|
101
|
+
connection.expects(:execute).with('EXPLAIN SELECT * FROM items').returns(plan_string)
|
102
|
+
NewRelic::Agent::Database.stubs(:get_connection).returns(connection)
|
103
|
+
result = NewRelic::Agent::Database.explain_sql(sql, config, &@explainer)
|
104
|
+
assert_nil(result[0])
|
105
|
+
assert_equal([plan_string], result[1])
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_explain_sql_select_with_mysql2_connection
|
109
|
+
config = {:adapter => 'mysql2'}
|
110
|
+
config.default('val')
|
111
|
+
sql = 'SELECT foo'
|
112
|
+
connection = mock('mysql connection')
|
113
|
+
|
114
|
+
plan_fields = ["select_type", "key_len", "table", "id", "possible_keys", "type", "Extra", "rows", "ref", "key"]
|
115
|
+
plan_row = ["SIMPLE", nil, "blogs", "1", nil, "ALL", "", "2", nil, nil ]
|
116
|
+
|
117
|
+
result = mock('explain plan')
|
118
|
+
result.expects(:fields).returns(plan_fields)
|
119
|
+
result.expects(:each).yields(plan_row)
|
120
|
+
|
121
|
+
# two rows, two columns
|
122
|
+
connection.expects(:execute).with('EXPLAIN SELECT foo').returns(result)
|
123
|
+
NewRelic::Agent::Database.stubs(:get_connection).returns(connection)
|
124
|
+
result = NewRelic::Agent::Database.explain_sql(sql, config, &@explainer)
|
125
|
+
assert_equal(plan_fields.sort, result[0].sort)
|
126
|
+
assert_equal(plan_row.compact.sort, result[1][0].compact.sort)
|
127
|
+
end
|
128
|
+
|
43
129
|
def test_explain_sql_one_select_with_pg_connection
|
44
130
|
config = {:adapter => 'postgresql'}
|
45
131
|
config.default('val')
|
@@ -57,6 +143,88 @@ class NewRelic::Agent::DatabaseTest < MiniTest::Unit::TestCase
|
|
57
143
|
NewRelic::Agent::Database.explain_sql(sql, config, &@explainer))
|
58
144
|
end
|
59
145
|
|
146
|
+
def test_explain_sql_one_select_with_pg_connection_string
|
147
|
+
config = {:adapter => 'postgresql'}
|
148
|
+
config.default('val')
|
149
|
+
sql = 'select count(id) from blogs limit 1'
|
150
|
+
connection = stub('pg connection', :disconnect! => true)
|
151
|
+
plan = "Limit (cost=11.75..11.76 rows=1 width=4)
|
152
|
+
-> Aggregate (cost=11.75..11.76 rows=1 width=4)
|
153
|
+
-> Seq Scan on blogs (cost=0.00..11.40 rows=140 width=4)"
|
154
|
+
|
155
|
+
connection.expects(:execute).returns(plan)
|
156
|
+
NewRelic::Agent::Database.stubs(:get_connection).returns(connection)
|
157
|
+
assert_equal([['QUERY PLAN'],
|
158
|
+
[["Limit (cost=11.75..11.76 rows=1 width=4)"],
|
159
|
+
[" -> Aggregate (cost=11.75..11.76 rows=1 width=4)"],
|
160
|
+
[" -> Seq Scan on blogs (cost=0.00..11.40 rows=140 width=4)"]]],
|
161
|
+
NewRelic::Agent::Database.explain_sql(sql, config, &@explainer))
|
162
|
+
end
|
163
|
+
|
164
|
+
def test_explain_sql_obfuscates_for_postgres
|
165
|
+
config = {:adapter => 'postgresql'}
|
166
|
+
config.default('val')
|
167
|
+
sql = "SELECT * FROM blogs WHERE blogs.id=1234 AND blogs.title='sensitive text'"
|
168
|
+
connection = stub('pg connection', :disconnect! => true)
|
169
|
+
plan = [{"QUERY PLAN"=>" Index Scan using blogs_pkey on blogs (cost=0.00..8.27 rows=1 width=540)"},
|
170
|
+
{"QUERY PLAN"=>" Index Cond: (id = 1234)"},
|
171
|
+
{"QUERY PLAN"=>" Filter: ((title)::text = 'sensitive text'::text)"}]
|
172
|
+
connection.expects(:execute).returns(plan)
|
173
|
+
NewRelic::Agent::Database.stubs(:get_connection).returns(connection)
|
174
|
+
with_config(:'transaction_tracer.record_sql' => 'obfuscated') do
|
175
|
+
assert_equal([['QUERY PLAN'],
|
176
|
+
[[" Index Scan using blogs_pkey on blogs (cost=0.00..8.27 rows=1 width=540)"],
|
177
|
+
[" Index Cond: ?"],
|
178
|
+
[" Filter: ?"]]],
|
179
|
+
NewRelic::Agent::Database.explain_sql(sql, config, &@explainer))
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
def test_explain_sql_does_not_obfuscate_if_record_sql_raw
|
184
|
+
config = {:adapter => 'postgresql'}
|
185
|
+
config.default('val')
|
186
|
+
sql = "SELECT * FROM blogs WHERE blogs.id=1234 AND blogs.title='sensitive text'"
|
187
|
+
connection = stub('pg connection', :disconnect! => true)
|
188
|
+
plan = [{"QUERY PLAN"=>" Index Scan using blogs_pkey on blogs (cost=0.00..8.27 rows=1 width=540)"},
|
189
|
+
{"QUERY PLAN"=>" Index Cond: (id = 1234)"},
|
190
|
+
{"QUERY PLAN"=>" Filter: ((title)::text = 'sensitive text'::text)"}]
|
191
|
+
connection.expects(:execute).returns(plan)
|
192
|
+
NewRelic::Agent::Database.stubs(:get_connection).returns(connection)
|
193
|
+
with_config(:'transaction_tracer.record_sql' => 'raw') do
|
194
|
+
assert_equal([['QUERY PLAN'],
|
195
|
+
[[" Index Scan using blogs_pkey on blogs (cost=0.00..8.27 rows=1 width=540)"],
|
196
|
+
[" Index Cond: (id = 1234)"],
|
197
|
+
[" Filter: ((title)::text = 'sensitive text'::text)"]]],
|
198
|
+
NewRelic::Agent::Database.explain_sql(sql, config, &@explainer))
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
def test_explain_sql_select_with_sqlite_connection
|
203
|
+
config = {:adapter => 'sqlite'}
|
204
|
+
config.default('val')
|
205
|
+
sql = 'SELECT foo'
|
206
|
+
connection = mock('sqlite connection')
|
207
|
+
plan = [
|
208
|
+
{"addr"=>0, "opcode"=>"Trace", "p1"=>0, "p2"=>0, "p3"=>0, "p4"=>"", "p5"=>"00", "comment"=>nil, 0=>0, 1=>"Trace", 2=>0, 3=>0, 4=>0, 5=>"", 6=>"00", 7=>nil},
|
209
|
+
{"addr"=>1, "opcode"=>"Goto", "p1"=>0, "p2"=>5, "p3"=>0, "p4"=>"", "p5"=>"00", "comment"=>nil, 0=>1, 1=>"Goto", 2=>0, 3=>5, 4=>0, 5=>"", 6=>"00", 7=>nil},
|
210
|
+
{"addr"=>2, "opcode"=>"String8", "p1"=>0, "p2"=>1, "p3"=>0, "p4"=>"foo", "p5"=>"00", "comment"=>nil, 0=>2, 1=>"String8", 2=>0, 3=>1, 4=>0, 5=>"foo", 6=>"00", 7=>nil},
|
211
|
+
{"addr"=>3, "opcode"=>"ResultRow", "p1"=>1, "p2"=>1, "p3"=>0, "p4"=>"", "p5"=>"00", "comment"=>nil, 0=>3, 1=>"ResultRow", 2=>1, 3=>1, 4=>0, 5=>"", 6=>"00", 7=>nil},
|
212
|
+
{"addr"=>4, "opcode"=>"Halt", "p1"=>0, "p2"=>0, "p3"=>0, "p4"=>"", "p5"=>"00", "comment"=>nil, 0=>4, 1=>"Halt", 2=>0, 3=>0, 4=>0, 5=>"", 6=>"00", 7=>nil},
|
213
|
+
{"addr"=>5, "opcode"=>"Goto", "p1"=>0, "p2"=>2, "p3"=>0, "p4"=>"", "p5"=>"00", "comment"=>nil, 0=>5, 1=>"Goto", 2=>0, 3=>2, 4=>0, 5=>"", 6=>"00", 7=>nil}
|
214
|
+
]
|
215
|
+
connection.expects(:execute).with('EXPLAIN SELECT foo').returns(plan)
|
216
|
+
NewRelic::Agent::Database.stubs(:get_connection).returns(connection)
|
217
|
+
result = NewRelic::Agent::Database.explain_sql(sql, config, &@explainer)
|
218
|
+
|
219
|
+
expected_headers = %w[addr opcode p1 p2 p3 p4 p5 comment]
|
220
|
+
expected_values = plan.map do |row|
|
221
|
+
expected_headers.map { |h| row[h] }
|
222
|
+
end
|
223
|
+
|
224
|
+
assert_equal(expected_headers.sort, result[0].sort)
|
225
|
+
assert_equal(expected_values, result[1])
|
226
|
+
end
|
227
|
+
|
60
228
|
def test_dont_collect_explain_for_parameterized_query
|
61
229
|
config = {:adapter => 'postgresql'}
|
62
230
|
config.default('val')
|
@@ -92,7 +260,18 @@ class NewRelic::Agent::DatabaseTest < MiniTest::Unit::TestCase
|
|
92
260
|
|
93
261
|
sql = 'SELECT * FROM table WHERE id IN (1,2,3,4,5...'
|
94
262
|
assert_equal [], NewRelic::Agent::Database.explain_sql(sql, config)
|
263
|
+
end
|
264
|
+
|
265
|
+
def test_dont_collect_explain_if_adapter_not_recognized
|
266
|
+
config = {:adapter => 'dorkdb'}
|
267
|
+
config.default('val')
|
268
|
+
connection = mock('connection')
|
269
|
+
connection.expects(:execute).never
|
270
|
+
NewRelic::Agent::Database.stubs(:get_connection).with(config).returns(connection)
|
271
|
+
expects_logging(:debug, "Not collecting explain plan because an unknown connection adapter ('dorkdb') was used.")
|
95
272
|
|
273
|
+
sql = 'SELECT * FROM table WHERE id IN (1,2,3,4,5)'
|
274
|
+
assert_equal [], NewRelic::Agent::Database.explain_sql(sql, config)
|
96
275
|
end
|
97
276
|
|
98
277
|
def test_explain_sql_no_sql
|
@@ -238,6 +417,14 @@ class NewRelic::Agent::DatabaseTest < MiniTest::Unit::TestCase
|
|
238
417
|
assert_equal(expected_query, captured)
|
239
418
|
end
|
240
419
|
|
420
|
+
sql_parsing_tests = load_cross_agent_test('sql_parsing')
|
421
|
+
sql_parsing_tests.each_with_index do |test_case, i|
|
422
|
+
define_method("test_sql_parsing_#{i}") do
|
423
|
+
result = NewRelic::Agent::Database.parse_operation_from_query(test_case['input'])
|
424
|
+
assert_equal(test_case['operation'], result)
|
425
|
+
end
|
426
|
+
end
|
427
|
+
|
241
428
|
# Ruby 1.8 doesn't have String#encoding
|
242
429
|
def encoding_from_string(str)
|
243
430
|
if str.respond_to?(:encoding)
|
@@ -5,7 +5,7 @@
|
|
5
5
|
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','..','test_helper'))
|
6
6
|
require 'new_relic/agent/datastores/mongo/metric_generator'
|
7
7
|
|
8
|
-
class NewRelic::Agent::Datastores::Mongo::MetricGeneratorTest <
|
8
|
+
class NewRelic::Agent::Datastores::Mongo::MetricGeneratorTest < Minitest::Test
|
9
9
|
include ::NewRelic::TestHelpers::MongoMetricBuilder
|
10
10
|
|
11
11
|
def setup
|
@@ -5,7 +5,7 @@
|
|
5
5
|
require 'new_relic/agent/datastores/mongo/metric_translator'
|
6
6
|
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','..','test_helper'))
|
7
7
|
|
8
|
-
class NewRelic::Agent::Datastores::Mongo::MetricTranslatorTest <
|
8
|
+
class NewRelic::Agent::Datastores::Mongo::MetricTranslatorTest < Minitest::Test
|
9
9
|
include ::NewRelic::TestHelpers::MongoMetricBuilder
|
10
10
|
|
11
11
|
def setup
|
@@ -30,6 +30,16 @@ class NewRelic::Agent::Datastores::Mongo::MetricTranslatorTest < MiniTest::Unit:
|
|
30
30
|
assert_includes metrics, 'Datastore/allOther'
|
31
31
|
end
|
32
32
|
|
33
|
+
def test_build_metrics_includes_all_for_web
|
34
|
+
metrics = build_test_metrics('test')
|
35
|
+
assert_includes metrics, 'Datastore/all'
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_build_metrics_includes_all_for_other
|
39
|
+
metrics = build_test_metrics('test', :other)
|
40
|
+
assert_includes metrics, 'Datastore/all'
|
41
|
+
end
|
42
|
+
|
33
43
|
def test_build_metrics_includes_activerecord_all_on_web
|
34
44
|
metrics = build_test_metrics('test', :web)
|
35
45
|
assert_includes metrics, 'ActiveRecord/all'
|
@@ -9,7 +9,7 @@ module NewRelic
|
|
9
9
|
module Agent
|
10
10
|
module Datastores
|
11
11
|
module Mongo
|
12
|
-
class StatementFormatterTest <
|
12
|
+
class StatementFormatterTest < Minitest::Test
|
13
13
|
DOC_STATEMENT = { :database => "multiverse",
|
14
14
|
:collection => "tribbles",
|
15
15
|
:operation => :insert,
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
4
|
|
5
5
|
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','test_helper'))
|
6
|
-
class NewRelic::Agent::ErrorCollector::NoticeErrorTest <
|
6
|
+
class NewRelic::Agent::ErrorCollector::NoticeErrorTest < Minitest::Test
|
7
7
|
require 'new_relic/agent/error_collector'
|
8
8
|
include NewRelic::Agent::ErrorCollector::NoticeError
|
9
9
|
|
@@ -6,7 +6,7 @@ require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper
|
|
6
6
|
require File.expand_path(File.join(File.dirname(__FILE__),'..','data_container_tests'))
|
7
7
|
require 'new_relic/agent/internal_agent_error'
|
8
8
|
|
9
|
-
class NewRelic::Agent::ErrorCollectorTest <
|
9
|
+
class NewRelic::Agent::ErrorCollectorTest < Minitest::Test
|
10
10
|
def setup
|
11
11
|
@test_config = { :capture_params => true }
|
12
12
|
NewRelic::Agent.config.apply_config(@test_config)
|
@@ -5,7 +5,7 @@
|
|
5
5
|
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','test_helper'))
|
6
6
|
require 'new_relic/agent/http_clients/uri_util'
|
7
7
|
|
8
|
-
class URIUtilTest <
|
8
|
+
class URIUtilTest < Minitest::Test
|
9
9
|
|
10
10
|
def test_filter_uri
|
11
11
|
assert_filtered("http://foo.com/bar/baz",
|
@@ -7,7 +7,7 @@ if defined?(::Rails)
|
|
7
7
|
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','test_helper'))
|
8
8
|
require 'new_relic/agent/instrumentation/action_controller_subscriber'
|
9
9
|
|
10
|
-
class NewRelic::Agent::Instrumentation::ActionControllerSubscriberTest <
|
10
|
+
class NewRelic::Agent::Instrumentation::ActionControllerSubscriberTest < Minitest::Test
|
11
11
|
class TestController
|
12
12
|
include NewRelic::Agent::Instrumentation::ControllerInstrumentation
|
13
13
|
|
@@ -7,7 +7,7 @@ if defined?(::Rails)
|
|
7
7
|
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','test_helper'))
|
8
8
|
require 'new_relic/agent/instrumentation/action_view_subscriber'
|
9
9
|
|
10
|
-
class NewRelic::Agent::Instrumentation::ActionViewSubscriberTest <
|
10
|
+
class NewRelic::Agent::Instrumentation::ActionViewSubscriberTest < Minitest::Test
|
11
11
|
def setup
|
12
12
|
@subscriber = NewRelic::Agent::Instrumentation::ActionViewSubscriber.new
|
13
13
|
@stats_engine = NewRelic::Agent.instance.stats_engine
|