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
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','test_helper'))
|
6
6
|
|
7
|
-
class NewRelic::Agent::Instrumentation::MetricFrameTest <
|
7
|
+
class NewRelic::Agent::Instrumentation::MetricFrameTest < Minitest::Test
|
8
8
|
|
9
9
|
# These tests are just here to make sure that we're maintaining the required
|
10
10
|
# old interface for folks. Real testing of the underlying functionality
|
@@ -7,7 +7,7 @@ require 'net/http'
|
|
7
7
|
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','test_helper'))
|
8
8
|
require 'new_relic/agent/cross_app_tracing'
|
9
9
|
|
10
|
-
class NewRelic::Agent::Instrumentation::NetInstrumentationTest <
|
10
|
+
class NewRelic::Agent::Instrumentation::NetInstrumentationTest < Minitest::Test
|
11
11
|
def setup
|
12
12
|
NewRelic::Agent.manual_start(
|
13
13
|
:"cross_application_tracer.enabled" => false,
|
@@ -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::Instrumentation::QueueTimeTest <
|
6
|
+
class NewRelic::Agent::Instrumentation::QueueTimeTest < Minitest::Test
|
7
7
|
include NewRelic::Agent::Instrumentation
|
8
8
|
|
9
9
|
def setup
|
@@ -17,7 +17,7 @@ class MinimalRackApp
|
|
17
17
|
include NewRelic::Agent::Instrumentation::Rack
|
18
18
|
end
|
19
19
|
|
20
|
-
class NewRelic::Agent::Instrumentation::RackTest <
|
20
|
+
class NewRelic::Agent::Instrumentation::RackTest < Minitest::Test
|
21
21
|
|
22
22
|
def test_basic_rack_app
|
23
23
|
# should return what we send in, even when instrumented
|
@@ -10,7 +10,7 @@ module NewRelic
|
|
10
10
|
module Instrumentation
|
11
11
|
module Sinatra
|
12
12
|
|
13
|
-
class TransactionNamerTest <
|
13
|
+
class TransactionNamerTest < Minitest::Test
|
14
14
|
|
15
15
|
def test_transaction_name_for_route
|
16
16
|
env = { "newrelic.last_route" => /^\/the_route$/}
|
@@ -5,7 +5,7 @@
|
|
5
5
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'test_helper'))
|
6
6
|
require 'new_relic/agent/instrumentation/sinatra'
|
7
7
|
|
8
|
-
class NewRelic::Agent::Instrumentation::SinatraTest <
|
8
|
+
class NewRelic::Agent::Instrumentation::SinatraTest < Minitest::Test
|
9
9
|
|
10
10
|
# This fake app is not an actual Sinatra app to avoid having our unit tests
|
11
11
|
# take a dependency directly on it. If you need actual Sinatra classes, go
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'test_helper'))
|
6
6
|
|
7
|
-
class NewRelic::Agent::Instrumentation::TaskInstrumentationTest <
|
7
|
+
class NewRelic::Agent::Instrumentation::TaskInstrumentationTest < Minitest::Test
|
8
8
|
include NewRelic::Agent::Instrumentation::ControllerInstrumentation
|
9
9
|
|
10
10
|
def run_task_inner(n)
|
@@ -6,7 +6,7 @@ require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper
|
|
6
6
|
require "new_relic/agent/javascript_instrumentor"
|
7
7
|
require "base64"
|
8
8
|
|
9
|
-
class NewRelic::Agent::JavascriptInstrumentorTest <
|
9
|
+
class NewRelic::Agent::JavascriptInstrumentorTest < Minitest::Test
|
10
10
|
attr_reader :instrumentor
|
11
11
|
|
12
12
|
def setup
|
@@ -25,7 +25,7 @@ class NewRelic::Agent::JavascriptInstrumentorTest < MiniTest::Unit::TestCase
|
|
25
25
|
|
26
26
|
# By default we expect our transaction to have a start time
|
27
27
|
# All sorts of basics don't output without this setup initially
|
28
|
-
NewRelic::Agent::TransactionState.reset
|
28
|
+
NewRelic::Agent::TransactionState.reset
|
29
29
|
end
|
30
30
|
|
31
31
|
def teardown
|
@@ -175,11 +175,11 @@ class NewRelic::Agent::JavascriptInstrumentorTest < MiniTest::Unit::TestCase
|
|
175
175
|
txn = NewRelic::Agent::Transaction.current
|
176
176
|
txn.stubs(:queue_time).returns(0)
|
177
177
|
txn.stubs(:start_time).returns(Time.now - 10)
|
178
|
+
txn.stubs(:guid).returns('ABC')
|
178
179
|
txn.name = 'most recent transaction'
|
179
180
|
|
180
181
|
state = NewRelic::Agent::TransactionState.get
|
181
182
|
state.request_token = '0123456789ABCDEF'
|
182
|
-
state.request_guid = 'ABC'
|
183
183
|
|
184
184
|
data = instrumentor.data_for_js_agent
|
185
185
|
expected = {
|
@@ -28,7 +28,7 @@ rescue Errno::ETIMEDOUT
|
|
28
28
|
end
|
29
29
|
|
30
30
|
if memcached_ready
|
31
|
-
class NewRelic::Agent::MemcacheInstrumentationTest <
|
31
|
+
class NewRelic::Agent::MemcacheInstrumentationTest < Minitest::Test
|
32
32
|
include NewRelic::Agent::Instrumentation::ControllerInstrumentation
|
33
33
|
|
34
34
|
def setup
|
@@ -5,7 +5,7 @@
|
|
5
5
|
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
|
6
6
|
require 'new_relic/agent/memory_logger'
|
7
7
|
|
8
|
-
class MemoryLoggerTest <
|
8
|
+
class MemoryLoggerTest < Minitest::Test
|
9
9
|
LEVELS = [:fatal, :error, :warn, :info, :debug]
|
10
10
|
|
11
11
|
def setup
|
@@ -5,7 +5,7 @@
|
|
5
5
|
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
|
6
6
|
require 'new_relic/agent/method_tracer'
|
7
7
|
|
8
|
-
class MethodInterrobangTest <
|
8
|
+
class MethodInterrobangTest < Minitest::Test
|
9
9
|
include NewRelic::Agent::MethodTracer
|
10
10
|
|
11
11
|
def interrogate?
|
@@ -10,7 +10,7 @@ module NewRelic
|
|
10
10
|
class Agent
|
11
11
|
module MethodTracer
|
12
12
|
module ClassMethods
|
13
|
-
class AddMethodTracerTest <
|
13
|
+
class AddMethodTracerTest < Minitest::Test
|
14
14
|
# require 'new_relic/agent/method_tracer'
|
15
15
|
include NewRelic::Agent::MethodTracer::ClassMethods::AddMethodTracer
|
16
16
|
|
@@ -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::MethodTracer::TraceExecutionScopedTest <
|
6
|
+
class NewRelic::Agent::MethodTracer::TraceExecutionScopedTest < Minitest::Test
|
7
7
|
require 'new_relic/agent/method_tracer'
|
8
8
|
include NewRelic::Agent::MethodTracer
|
9
9
|
|
@@ -58,7 +58,7 @@ module TestModuleWithLog
|
|
58
58
|
add_method_tracer :other_method, 'Custom/foo/bar'
|
59
59
|
end
|
60
60
|
|
61
|
-
class NewRelic::Agent::MethodTracerTest <
|
61
|
+
class NewRelic::Agent::MethodTracerTest < Minitest::Test
|
62
62
|
attr_reader :stats_engine
|
63
63
|
|
64
64
|
def setup
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
3
|
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
4
|
|
5
|
-
class MethodVisibilityTest <
|
5
|
+
class MethodVisibilityTest < Minitest::Test
|
6
6
|
|
7
7
|
class InstrumentedClass
|
8
8
|
include NewRelic::Agent::MethodTracer
|
@@ -8,7 +8,7 @@ require 'new_relic/agent/commands/thread_profiler_session'
|
|
8
8
|
|
9
9
|
# Tests of HTTP Keep Alive implementation that require a different setup and
|
10
10
|
# set of mocks.
|
11
|
-
class NewRelicServiceKeepAliveTest <
|
11
|
+
class NewRelicServiceKeepAliveTest < Minitest::Test
|
12
12
|
def setup
|
13
13
|
@server = NewRelic::Control::Server.new('somewhere.example.com',
|
14
14
|
30303, '10.10.10.10')
|
@@ -80,7 +80,7 @@ class NewRelicServiceKeepAliveTest < MiniTest::Unit::TestCase
|
|
80
80
|
|
81
81
|
end
|
82
82
|
|
83
|
-
class NewRelicServiceTest <
|
83
|
+
class NewRelicServiceTest < Minitest::Test
|
84
84
|
def initialize(*_)
|
85
85
|
[ :HTTPSuccess,
|
86
86
|
:HTTPUnauthorized,
|
@@ -5,7 +5,7 @@
|
|
5
5
|
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
|
6
6
|
require "new_relic/agent/obfuscator"
|
7
7
|
|
8
|
-
class NewRelic::Agent::ObfuscatorTest <
|
8
|
+
class NewRelic::Agent::ObfuscatorTest < Minitest::Test
|
9
9
|
|
10
10
|
OBFUSCATION_KEY = (1..40).to_a.pack('c*')
|
11
11
|
RUM_KEY_LENGTH = 13
|
@@ -6,146 +6,219 @@ require 'timeout'
|
|
6
6
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'test_helper'))
|
7
7
|
require 'new_relic/agent/pipe_channel_manager'
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
9
|
+
class NewRelic::Agent::PipeChannelManagerTest < Minitest::Test
|
10
|
+
include TransactionSampleTestHelper
|
11
|
+
|
12
|
+
def setup
|
13
|
+
@test_config = { :developer_mode => true }
|
14
|
+
NewRelic::Agent.agent.drop_buffered_data
|
15
|
+
NewRelic::Agent.config.apply_config(@test_config)
|
16
|
+
NewRelic::Agent::PipeChannelManager.listener.close_all_pipes
|
17
|
+
NewRelic::Agent.manual_start
|
18
|
+
NewRelic::Agent::TransactionState.clear
|
19
|
+
end
|
20
|
+
|
21
|
+
def teardown
|
22
|
+
NewRelic::Agent::PipeChannelManager.listener.stop
|
23
|
+
NewRelic::Agent.shutdown
|
24
|
+
NewRelic::Agent.config.remove_config(@test_config)
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_registering_a_pipe
|
28
|
+
NewRelic::Agent::PipeChannelManager.listener.wake.in.expects(:<<).with('.')
|
29
|
+
NewRelic::Agent::PipeChannelManager.register_report_channel(1)
|
30
|
+
pipe = NewRelic::Agent::PipeChannelManager.channels[1]
|
31
|
+
|
32
|
+
assert pipe.out.kind_of?(IO)
|
33
|
+
assert pipe.in.kind_of?(IO)
|
34
|
+
|
35
|
+
NewRelic::Agent::PipeChannelManager.listener.close_all_pipes
|
36
|
+
end
|
37
|
+
|
38
|
+
if NewRelic::LanguageSupport.can_fork? && !NewRelic::LanguageSupport.using_version?('1.9.1')
|
39
|
+
def test_listener_merges_timeslice_metrics
|
40
|
+
metric = 'Custom/test/method'
|
41
|
+
engine = NewRelic::Agent.agent.stats_engine
|
42
|
+
engine.get_stats_no_scope(metric).record_data_point(1.0)
|
43
|
+
|
44
|
+
listener = start_listener_with_pipe(666)
|
45
|
+
|
46
|
+
run_child(666) do
|
47
|
+
NewRelic::Agent.after_fork
|
48
|
+
new_engine = NewRelic::Agent::StatsEngine.new
|
49
|
+
new_engine.get_stats_no_scope(metric).record_data_point(2.0)
|
50
|
+
service = NewRelic::Agent::PipeService.new(666)
|
51
|
+
service.metric_data(new_engine.harvest!)
|
52
|
+
end
|
53
|
+
|
54
|
+
assert_equal(3.0, engine.lookup_stats(metric).total_call_time)
|
55
|
+
engine.reset!
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_listener_merges_transaction_traces
|
59
|
+
sampler = NewRelic::Agent.agent.transaction_sampler
|
60
|
+
sample = run_sample_trace_on(sampler)
|
61
|
+
assert_equal(1, sampler.count)
|
62
|
+
|
63
|
+
listener = start_listener_with_pipe(667)
|
64
|
+
run_child(667) do
|
65
|
+
NewRelic::Agent.after_fork
|
66
|
+
with_config(:'transaction_tracer.transaction_threshold' => 0.0) do
|
67
|
+
sample = run_sample_trace_on(sampler)
|
68
|
+
service = NewRelic::Agent::PipeService.new(667)
|
69
|
+
service.transaction_sample_data(sampler.harvest!)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
assert_equal(2, sampler.count)
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_listener_merges_error_traces
|
77
|
+
sampler = NewRelic::Agent.agent.error_collector
|
78
|
+
sampler.notice_error(Exception.new("message"), :uri => '/myurl/',
|
79
|
+
:metric => 'path', :referer => 'test_referer',
|
80
|
+
:request_params => {:x => 'y'})
|
81
|
+
NewRelic::Agent.agent.merge_data_for_endpoint(:error_data, sampler.errors)
|
82
|
+
|
83
|
+
assert_equal(1, NewRelic::Agent.agent.error_collector.errors.size)
|
84
|
+
|
85
|
+
listener = start_listener_with_pipe(668)
|
86
|
+
|
87
|
+
run_child(668) do
|
88
|
+
NewRelic::Agent.after_fork
|
89
|
+
new_sampler = NewRelic::Agent::ErrorCollector.new
|
90
|
+
new_sampler.notice_error(Exception.new("new message"), :uri => '/myurl/',
|
91
|
+
:metric => 'path', :referer => 'test_referer',
|
92
|
+
:request_params => {:x => 'y'})
|
93
|
+
service = NewRelic::Agent::PipeService.new(668)
|
94
|
+
service.error_data(new_sampler.harvest!)
|
95
|
+
end
|
96
|
+
|
97
|
+
assert_equal(2, NewRelic::Agent.agent.error_collector.errors.size)
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_listener_merges_analytics_events
|
101
|
+
request_sampler = NewRelic::Agent.agent.instance_variable_get(:@request_sampler)
|
102
|
+
|
103
|
+
listener = start_listener_with_pipe(699)
|
104
|
+
NewRelic::Agent.agent.stubs(:connected?).returns(true)
|
105
|
+
run_child(699) do
|
106
|
+
NewRelic::Agent.after_fork(:report_to_channel => 699)
|
107
|
+
request_sampler.on_transaction_finished({
|
108
|
+
:start_timestamp => Time.now,
|
109
|
+
:name => 'whatever',
|
110
|
+
:duration => 10,
|
111
|
+
:type => :controller
|
112
|
+
})
|
113
|
+
NewRelic::Agent.agent.send(:transmit_data)
|
114
|
+
end
|
115
|
+
|
116
|
+
assert_equal(1, request_sampler.samples.size)
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_listener_merges_sql_traces
|
120
|
+
sampler = NewRelic::Agent.agent.sql_sampler
|
121
|
+
create_sql_sample(sampler)
|
122
|
+
|
123
|
+
listener = start_listener_with_pipe(667)
|
124
|
+
run_child(667) do
|
125
|
+
NewRelic::Agent.after_fork
|
126
|
+
create_sql_sample(sampler)
|
127
|
+
service = NewRelic::Agent::PipeService.new(667)
|
128
|
+
service.sql_trace_data(sampler.harvest!)
|
129
|
+
end
|
130
|
+
|
131
|
+
assert_equal(2, sampler.harvest!.size)
|
132
|
+
end
|
133
|
+
|
134
|
+
def test_close_pipe_on_child_explicit_close
|
135
|
+
listener = start_listener_with_pipe(669)
|
136
|
+
pid = Process.fork do
|
137
|
+
NewRelic::Agent::PipeService.new(669)
|
138
|
+
end
|
139
|
+
Process.wait(pid)
|
140
|
+
listener.stop_listener_thread
|
141
|
+
assert_pipe_finished(669)
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_close_pipe_on_child_exit
|
145
|
+
listener = start_listener_with_pipe(669)
|
146
|
+
pid = Process.fork do
|
147
|
+
NewRelic::Agent::PipeService.new(669)
|
148
|
+
exit!
|
149
|
+
end
|
150
|
+
Process.wait(pid)
|
151
|
+
listener.stop_listener_thread
|
152
|
+
assert_pipe_finished(669)
|
153
|
+
end
|
154
|
+
|
155
|
+
def test_manager_does_not_crash_when_given_bad_data
|
156
|
+
listener = start_listener_with_pipe(670)
|
157
|
+
pid = Process.fork do
|
158
|
+
listener.pipes[670].in << 'some unloadable garbage'
|
159
|
+
end
|
160
|
+
Process.wait(pid)
|
161
|
+
listener.stop
|
162
|
+
end
|
163
|
+
|
164
|
+
def pipe_finished?(id)
|
165
|
+
(!NewRelic::Agent::PipeChannelManager.channels[id] ||
|
166
|
+
NewRelic::Agent::PipeChannelManager.channels[id].closed?)
|
167
|
+
end
|
168
|
+
|
169
|
+
def assert_pipe_finished(id)
|
170
|
+
assert(pipe_finished?(id),
|
171
|
+
"Expected pipe with ID #{id} to be nil or closed")
|
172
|
+
end
|
173
|
+
|
174
|
+
def create_sql_sample(sampler)
|
175
|
+
sampler.notice_first_scope_push(Time.now)
|
176
|
+
sampler.notice_sql("SELECT * FROM table", "ActiveRecord/Widgets/find", nil, 100)
|
177
|
+
sampler.notice_scope_empty('noodles', Time.now)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
def start_listener_with_pipe(pipe_id)
|
182
|
+
listener = NewRelic::Agent::PipeChannelManager.listener
|
183
|
+
listener.start
|
184
|
+
listener.register_pipe(pipe_id)
|
185
|
+
listener
|
186
|
+
end
|
187
|
+
|
188
|
+
def test_pipe_read_length_failure
|
189
|
+
write_pipe = stub(:set_encoding => nil, :closed? => false, :close => nil)
|
190
|
+
|
191
|
+
# If we only read three bytes, it isn't valid.
|
192
|
+
# We can't tell whether any four bytes or more are a "good" length or not.
|
193
|
+
read_pipe = stub(:read => "jrc")
|
194
|
+
IO.stubs(:pipe).returns([read_pipe, write_pipe])
|
195
|
+
|
196
|
+
# Includes the failed bytes
|
197
|
+
expects_logging(:error, includes("[6a 72 63]"))
|
198
|
+
|
199
|
+
pipe = NewRelic::Agent::PipeChannelManager::Pipe.new
|
200
|
+
assert_nil pipe.read
|
201
|
+
end
|
202
|
+
|
203
|
+
def test_pipe_read_length_nil_fails
|
204
|
+
write_pipe = stub(:set_encoding => nil, :closed? => false, :close => nil)
|
205
|
+
|
206
|
+
# No length at all returned on pipe, also a failure.
|
207
|
+
read_pipe = stub(:read => nil)
|
208
|
+
IO.stubs(:pipe).returns([read_pipe, write_pipe])
|
209
|
+
|
210
|
+
pipe = NewRelic::Agent::PipeChannelManager::Pipe.new
|
211
|
+
assert_nil pipe.read
|
212
|
+
end
|
213
|
+
|
214
|
+
def run_child(channel_id)
|
215
|
+
pid = Process.fork do
|
216
|
+
yield
|
217
|
+
end
|
218
|
+
|
219
|
+
Process.wait(pid)
|
220
|
+
until pipe_finished?(channel_id)
|
221
|
+
sleep 0.01
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|