newrelic_rpm 3.11.2.286 → 3.12.0.288
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -2
- data/.yardopts +2 -0
- data/CHANGELOG +39 -4
- data/README.md +4 -2
- data/lib/new_relic/agent.rb +229 -214
- data/lib/new_relic/agent/agent.rb +23 -12
- data/lib/new_relic/agent/attribute_filter.rb +242 -0
- data/lib/new_relic/agent/attribute_processing.rb +62 -0
- data/lib/new_relic/agent/commands/xray_session_collection.rb +4 -1
- data/lib/new_relic/agent/configuration/default_source.rb +284 -30
- data/lib/new_relic/agent/configuration/high_security_source.rb +0 -8
- data/lib/new_relic/agent/configuration/manager.rb +1 -1
- data/lib/new_relic/agent/configuration/server_source.rb +86 -31
- data/lib/new_relic/agent/configuration/yaml_source.rb +1 -1
- data/lib/new_relic/agent/cross_app_monitor.rb +8 -13
- data/lib/new_relic/agent/cross_app_tracing.rb +15 -15
- data/lib/new_relic/agent/custom_event_aggregator.rb +6 -2
- data/lib/new_relic/agent/database.rb +15 -2
- data/lib/new_relic/agent/datastores.rb +52 -38
- data/lib/new_relic/agent/datastores/metric_helper.rb +2 -1
- data/lib/new_relic/agent/encoding_normalizer.rb +82 -0
- data/lib/new_relic/agent/error_collector.rb +125 -169
- data/lib/new_relic/agent/hash_extensions.rb +26 -0
- data/lib/new_relic/agent/http_clients/excon_wrappers.rb +13 -11
- data/lib/new_relic/agent/http_clients/uri_util.rb +9 -0
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +1 -3
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +12 -5
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +6 -7
- data/lib/new_relic/agent/instrumentation/curb.rb +6 -6
- data/lib/new_relic/agent/instrumentation/excon/middleware.rb +4 -4
- data/lib/new_relic/agent/instrumentation/grape.rb +4 -3
- data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +6 -3
- data/lib/new_relic/agent/instrumentation/rails/errors.rb +9 -3
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +6 -1
- data/lib/new_relic/agent/instrumentation/rails3/errors.rb +9 -7
- data/lib/new_relic/agent/instrumentation/rails4/errors.rb +8 -6
- data/lib/new_relic/agent/instrumentation/resque.rb +2 -3
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +3 -3
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +2 -2
- data/lib/new_relic/agent/javascript_instrumentor.rb +24 -16
- data/lib/new_relic/agent/parameter_filtering.rb +8 -1
- data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +2 -2
- data/lib/new_relic/agent/sql_sampler.rb +1 -0
- data/lib/new_relic/agent/stats.rb +0 -4
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +5 -3
- data/lib/new_relic/agent/stats_engine/stats_hash.rb +4 -0
- data/lib/new_relic/agent/supported_versions.rb +2 -2
- data/lib/new_relic/agent/traced_method_stack.rb +3 -3
- data/lib/new_relic/agent/transaction.rb +141 -118
- data/lib/new_relic/agent/transaction/attributes.rb +161 -0
- data/lib/new_relic/agent/transaction/developer_mode_sample_buffer.rb +4 -4
- data/lib/new_relic/agent/transaction/trace.rb +150 -0
- data/lib/new_relic/agent/transaction/trace_node.rb +190 -0
- data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +2 -2
- data/lib/new_relic/agent/transaction_event_aggregator.rb +23 -7
- data/lib/new_relic/agent/transaction_sample_builder.rb +37 -62
- data/lib/new_relic/agent/transaction_sampler.rb +29 -66
- data/lib/new_relic/cli/commands/install.rb +2 -2
- data/lib/new_relic/coerce.rb +15 -28
- data/lib/new_relic/json_wrapper.rb +14 -73
- data/lib/new_relic/noticed_error.rb +81 -5
- data/lib/new_relic/rack/browser_monitoring.rb +14 -19
- data/lib/new_relic/rack/developer_mode.rb +68 -14
- data/lib/new_relic/rack/developer_mode/segment_summary.rb +56 -0
- data/lib/new_relic/version.rb +2 -2
- data/newrelic.yml +19 -196
- data/test/agent_helper.rb +42 -36
- data/test/config/newrelic.yml +0 -1
- data/test/environments/rails40/Gemfile +1 -1
- data/test/environments/rails41/Gemfile +1 -1
- data/test/environments/rails42/Gemfile +1 -1
- data/test/fixtures/cross_agent_tests/attribute_configuration.json +35 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/README.md +19 -12
- data/test/fixtures/cross_agent_tests/sql_obfuscation/sql_obfuscation.json +365 -0
- data/test/multiverse/lib/multiverse/suite.rb +5 -1
- data/test/multiverse/suites/active_record/active_record_test.rb +8 -8
- data/test/multiverse/suites/agent_only/agent_attributes_test.rb +145 -0
- data/test/multiverse/suites/agent_only/cross_application_tracing_test.rb +8 -0
- data/test/multiverse/suites/agent_only/custom_queue_time_test.rb +5 -1
- data/test/multiverse/suites/agent_only/encoding_handling_test.rb +6 -6
- data/test/multiverse/suites/agent_only/marshaling_test.rb +1 -1
- data/test/multiverse/suites/agent_only/set_transaction_name_test.rb +2 -3
- data/test/multiverse/suites/agent_only/synthetics_test.rb +3 -3
- data/test/multiverse/suites/agent_only/testing_app.rb +4 -0
- data/test/multiverse/suites/agent_only/thread_profiling_test.rb +1 -1
- data/test/multiverse/suites/agent_only/utilization_data_collection_test.rb +9 -7
- data/test/multiverse/suites/curb/Envfile +5 -6
- data/test/multiverse/suites/curb/curb_test.rb +4 -5
- data/test/multiverse/suites/datamapper/datamapper_test.rb +2 -2
- data/test/multiverse/suites/excon/Envfile +11 -4
- data/test/multiverse/suites/excon/excon_test.rb +5 -5
- data/test/multiverse/suites/grape/config/newrelic.yml +1 -0
- data/test/multiverse/suites/grape/grape_test.rb +76 -12
- data/test/multiverse/suites/grape/grape_test_api.rb +16 -0
- data/test/multiverse/suites/high_security/config/newrelic.yml +43 -3
- data/test/multiverse/suites/high_security/high_security_test.rb +165 -9
- data/test/multiverse/suites/httpclient/Envfile +5 -1
- data/test/multiverse/suites/httpclient/httpclient_test.rb +2 -2
- data/test/multiverse/suites/memcached/Envfile +1 -1
- data/test/multiverse/suites/mongo/Envfile +8 -1
- data/test/multiverse/suites/mongo/helpers/mongo_operation_tests.rb +29 -29
- data/test/multiverse/suites/mongo/mongo_unsupported_version_test.rb +43 -8
- data/test/multiverse/suites/rack/rack_parameter_filtering_test.rb +13 -3
- data/test/multiverse/suites/rails/Envfile +3 -3
- data/test/multiverse/suites/rails/error_tracing_test.rb +52 -31
- data/test/multiverse/suites/rails/gc_instrumentation_test.rb +1 -1
- data/test/multiverse/suites/rails/ignore_test.rb +1 -1
- data/test/multiverse/suites/rails/parameter_capture_test.rb +108 -40
- data/test/multiverse/suites/rails/request_statistics_test.rb +10 -4
- data/test/multiverse/suites/rails/view_instrumentation_test.rb +24 -24
- data/test/multiverse/suites/resque/instrumentation_test.rb +46 -12
- data/test/multiverse/suites/sequel/sequel_extension_test.rb +8 -8
- data/test/multiverse/suites/sequel/sequel_helpers.rb +11 -11
- data/test/multiverse/suites/sequel/sequel_plugin_test.rb +11 -11
- data/test/multiverse/suites/sidekiq/Envfile +1 -4
- data/test/multiverse/suites/sidekiq/after_suite.rb +9 -0
- data/test/multiverse/suites/sidekiq/sidekiq_instrumentation_test.rb +49 -16
- data/test/multiverse/suites/sidekiq/test_worker.rb +1 -2
- data/test/multiverse/suites/sinatra/Envfile +1 -1
- data/test/multiverse/suites/sinatra/config/newrelic.yml +1 -0
- data/test/multiverse/suites/sinatra/sinatra_classic_test.rb +0 -4
- data/test/multiverse/suites/sinatra/sinatra_modular_test.rb +0 -4
- data/test/multiverse/suites/sinatra/sinatra_parameter_capture_test.rb +65 -0
- data/test/multiverse/suites/sinatra/sinatra_test_cases.rb +0 -11
- data/test/multiverse/suites/typhoeus/Envfile +8 -2
- data/test/multiverse/suites/typhoeus/typhoeus_test.rb +4 -4
- data/test/new_relic/agent/agent/connect_test.rb +13 -9
- data/test/new_relic/agent/agent_test.rb +34 -24
- data/test/new_relic/agent/attribute_filter_test.rb +218 -0
- data/test/new_relic/agent/attribute_processing_test.rb +160 -0
- data/test/new_relic/agent/configuration/default_source_test.rb +88 -0
- data/test/new_relic/agent/configuration/manager_test.rb +3 -4
- data/test/new_relic/agent/configuration/orphan_configuration_test.rb +3 -1
- data/test/new_relic/agent/configuration/server_source_test.rb +39 -0
- data/test/new_relic/agent/cross_app_monitor_test.rb +6 -30
- data/test/new_relic/agent/cross_app_tracing_test.rb +12 -12
- data/test/new_relic/agent/database/sql_obfuscation_test.rb +39 -65
- data/test/new_relic/agent/datastores/metric_helper_test.rb +36 -0
- data/test/new_relic/agent/encoding_normalizer_test.rb +66 -0
- data/test/new_relic/agent/error_collector_test.rb +181 -34
- data/test/new_relic/agent/hash_extensions_test.rb +34 -0
- data/test/new_relic/agent/instrumentation/action_controller_subscriber_test.rb +20 -23
- data/test/new_relic/agent/instrumentation/action_view_subscriber_test.rb +12 -12
- data/test/new_relic/agent/instrumentation/active_record_subscriber_test.rb +5 -5
- data/test/new_relic/agent/instrumentation/controller_instrumentation_test.rb +4 -4
- data/test/new_relic/agent/instrumentation/task_instrumentation_test.rb +21 -11
- data/test/new_relic/agent/javascript_instrumentor_test.rb +69 -45
- data/test/new_relic/agent/pipe_service_test.rb +2 -2
- data/test/new_relic/agent/stats_engine/gc_profiler_test.rb +1 -1
- data/test/new_relic/agent/stats_engine/metric_stats_test.rb +8 -7
- data/test/new_relic/agent/stats_engine/stats_hash_test.rb +2 -2
- data/test/new_relic/agent/threading/backtrace_node_test.rb +2 -2
- data/test/new_relic/agent/transaction/attributes_test.rb +276 -0
- data/test/new_relic/agent/transaction/developer_mode_sample_buffer_test.rb +10 -10
- data/test/new_relic/agent/transaction/trace_node_test.rb +361 -0
- data/test/new_relic/agent/transaction/trace_test.rb +394 -0
- data/test/new_relic/agent/transaction/xray_sample_buffer_test.rb +1 -1
- data/test/new_relic/agent/transaction_event_aggregator_test.rb +127 -57
- data/test/new_relic/agent/transaction_sample_builder_test.rb +70 -78
- data/test/new_relic/agent/transaction_sampler_test.rb +76 -185
- data/test/new_relic/agent/transaction_test.rb +283 -135
- data/test/new_relic/agent_test.rb +27 -12
- data/test/new_relic/cli/commands/install_test.rb +27 -0
- data/test/new_relic/coerce_test.rb +0 -59
- data/test/new_relic/data_container_tests.rb +5 -5
- data/test/new_relic/fake_collector.rb +27 -9
- data/test/new_relic/filtering_test_app.rb +2 -1
- data/test/new_relic/http_client_test_cases.rb +16 -16
- data/test/new_relic/json_wrapper_test.rb +0 -54
- data/test/new_relic/marshalling_test_cases.rb +1 -0
- data/test/new_relic/multiverse_helpers.rb +144 -0
- data/test/new_relic/noticed_error_test.rb +112 -9
- data/test/new_relic/rack/browser_monitoring_test.rb +12 -7
- data/test/new_relic/{transaction_analysis → rack/developer_mode}/segment_summary_test.rb +5 -4
- data/test/new_relic/rack/developer_mode_test.rb +17 -3
- data/test/new_relic/rack/error_collector_test.rb +1 -1
- data/test/performance/lib/performance/instrumentation/stackprof.rb +1 -1
- data/test/performance/script/runner +2 -2
- data/test/performance/suites/active_record.rb +3 -3
- data/test/performance/suites/agent_attributes.rb +62 -0
- data/test/performance/suites/rack_middleware.rb +78 -28
- data/test/performance/suites/transaction_tracing.rb +35 -0
- data/test/test_helper.rb +9 -1
- data/ui/helpers/developer_mode_helper.rb +16 -23
- data/ui/views/newrelic/_sample.rhtml +3 -3
- data/ui/views/newrelic/_segment.rhtml +1 -1
- data/ui/views/newrelic/_show_sample_summary.rhtml +1 -1
- data/ui/views/newrelic/show_sample.rhtml +5 -4
- metadata +23 -80
- data/lib/new_relic/agent/transaction/force_persist_sample_buffer.rb +0 -25
- data/lib/new_relic/transaction_analysis.rb +0 -80
- data/lib/new_relic/transaction_analysis/segment_summary.rb +0 -53
- data/lib/new_relic/transaction_sample.rb +0 -207
- data/lib/new_relic/transaction_sample/composite_segment.rb +0 -31
- data/lib/new_relic/transaction_sample/fake_segment.rb +0 -13
- data/lib/new_relic/transaction_sample/segment.rb +0 -197
- data/lib/new_relic/transaction_sample/summary_segment.rb +0 -25
- data/lib/new_relic/url_rule.rb +0 -18
- data/test/fixtures/cross_agent_tests/sql_obfuscation/back_quoted_identifiers.mysql.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/back_quoted_identifiers.mysql.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/comment_delimiters_in_strings.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/comment_delimiters_in_strings.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/double_quoted_identifiers.postgres.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/double_quoted_identifiers.postgres.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_line_comment_in_string.obfuscated +0 -2
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_line_comment_in_string.sql +0 -2
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_cstyle.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_cstyle.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_doubledash.obfuscated +0 -2
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_doubledash.sql +0 -2
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_hash.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_hash.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/escape_string_constants.postgres.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/escape_string_constants.postgres.sql +0 -4
- data/test/fixtures/cross_agent_tests/sql_obfuscation/malformed/unterminated_double_quoted_string.mysql.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/malformed/unterminated_single_quoted_string.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/multiple_literal_types.mysql.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/multiple_literal_types.mysql.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/numbers_in_identifiers.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/numbers_in_identifiers.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/numeric_literals.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/numeric_literals.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/README.md +0 -4
- data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/end_of_line_comments_with_quotes.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/end_of_line_comments_with_quotes.sql +0 -2
- data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/mixed_comments_and_quotes.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/mixed_comments_and_quotes.sql +0 -2
- data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/mixed_quotes_comments_and_newlines.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/mixed_quotes_comments_and_newlines.sql +0 -4
- data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/mixed_quotes_end_of_line_comments.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/mixed_quotes_end_of_line_comments.sql +0 -3
- data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/quote_delimiters_in_comments.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/quote_delimiters_in_comments.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_double_quoted.mysql.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_double_quoted.mysql.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_single_quoted.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_single_quoted.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_backslash_and_twin_single_quotes.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_backslash_and_twin_single_quotes.sql +0 -4
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_double_quote.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_double_quote.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_newline.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_newline.sql +0 -2
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_single_quote.mysql.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_single_quote.mysql.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_escaped_quotes.mysql.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_escaped_quotes.mysql.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_backslash.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_backslash.sql +0 -4
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_backslash.mysql.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_backslash.mysql.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_backslash_single_quoted.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_backslash_single_quoted.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_quote.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_quote.sql +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_twin_single_quotes.obfuscated +0 -1
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_twin_single_quotes.sql +0 -1
- data/test/new_relic/agent/error_collector/notice_error_test.rb +0 -261
- data/test/new_relic/agent/transaction/force_persist_sample_buffer_test.rb +0 -52
- data/test/new_relic/transaction_analysis_test.rb +0 -125
- data/test/new_relic/transaction_sample/composite_segment_test.rb +0 -38
- data/test/new_relic/transaction_sample/fake_segment_test.rb +0 -18
- data/test/new_relic/transaction_sample/segment_test.rb +0 -361
- data/test/new_relic/transaction_sample/summary_segment_test.rb +0 -34
- data/test/new_relic/transaction_sample_subtest_test.rb +0 -41
- data/test/new_relic/transaction_sample_test.rb +0 -361
@@ -180,8 +180,12 @@ module Multiverse
|
|
180
180
|
f.puts " gem 'mocha', '0.14.0', :require => false"
|
181
181
|
|
182
182
|
if debug
|
183
|
+
pry_version = RUBY_VERSION >= '1.8.7' ? '0.10.0' : '0.9.12'
|
184
|
+
|
183
185
|
# Pry 0.10.0 breaks compatibility with Ruby 1.8.7 :(
|
184
|
-
f.puts " gem 'pry', '~>
|
186
|
+
f.puts " gem 'pry', '~> #{pry_version}'"
|
187
|
+
f.puts " gem 'pry-byebug'" if RUBY_VERSION >= "2.0.0"
|
188
|
+
f.puts " gem 'pry-stack_explorer'"
|
185
189
|
end
|
186
190
|
end
|
187
191
|
puts yellow("Gemfile.#{env_index} set to:") if verbose?
|
@@ -208,10 +208,10 @@ class ActiveRecordInstrumentationTest < Minitest::Test
|
|
208
208
|
end
|
209
209
|
sample = NewRelic::Agent.instance.transaction_sampler.last_sample
|
210
210
|
metric = "Datastore/statement/#{current_product}/Order/find"
|
211
|
-
|
212
|
-
assert_equal(metric,
|
211
|
+
node = find_node_with_name(sample, metric)
|
212
|
+
assert_equal(metric, node.metric_name)
|
213
213
|
|
214
|
-
sql =
|
214
|
+
sql = node.params[:sql]
|
215
215
|
assert_match(/^SELECT /, sql)
|
216
216
|
|
217
217
|
assert_equal(adapter.to_s, sql.adapter)
|
@@ -227,16 +227,16 @@ class ActiveRecordInstrumentationTest < Minitest::Test
|
|
227
227
|
|
228
228
|
sample = NewRelic::Agent.instance.transaction_sampler.last_sample
|
229
229
|
metric = "Datastore/statement/#{current_product}/Order/find"
|
230
|
-
|
230
|
+
sql_node = find_node_with_name(sample, metric)
|
231
231
|
|
232
|
-
assert_match(/^SELECT /,
|
232
|
+
assert_match(/^SELECT /, sql_node.params[:sql])
|
233
233
|
|
234
234
|
sample.prepare_to_send!
|
235
|
-
explanations =
|
235
|
+
explanations = sql_node.params[:explain_plan]
|
236
236
|
if supports_explain_plans?
|
237
|
-
refute_nil explanations, "No explains in
|
237
|
+
refute_nil explanations, "No explains in node: #{sql_node}"
|
238
238
|
assert_equal(2, explanations.size,
|
239
|
-
"No explains in
|
239
|
+
"No explains in node: #{sql_node}")
|
240
240
|
end
|
241
241
|
end
|
242
242
|
end
|
@@ -0,0 +1,145 @@
|
|
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
|
+
class AgentAttributesTest < Minitest::Test
|
6
|
+
|
7
|
+
include MultiverseHelpers
|
8
|
+
|
9
|
+
setup_and_teardown_agent
|
10
|
+
|
11
|
+
def test_http_response_code_default_destinations
|
12
|
+
run_transaction do |txn|
|
13
|
+
txn.http_response_code = 418
|
14
|
+
end
|
15
|
+
|
16
|
+
assert_transaction_trace_has_agent_attribute("httpResponseCode", 418)
|
17
|
+
assert_event_has_agent_attribute("httpResponseCode", 418)
|
18
|
+
assert_error_has_agent_attribute("httpResponseCode", 418)
|
19
|
+
|
20
|
+
refute_browser_monitoring_has_agent_attribute("httpResponseCode")
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_request_headers_referer_default_destinations
|
24
|
+
txn_options = {:request => stub(:referer => "referrer", :path => "/")}
|
25
|
+
run_transaction({}, txn_options) do |txn|
|
26
|
+
end
|
27
|
+
|
28
|
+
assert_error_has_agent_attribute("request.headers.referer", "referrer")
|
29
|
+
|
30
|
+
refute_transaction_trace_has_agent_attribute("request.headers.referer")
|
31
|
+
refute_event_has_agent_attribute("request.headers.referer")
|
32
|
+
refute_browser_monitoring_has_agent_attribute("request.headers.referer")
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_request_parameters_default_destinations_without_capture_params
|
36
|
+
run_transaction(:capture_params => false) do |txn|
|
37
|
+
txn.merge_request_parameters(:duly => "noted")
|
38
|
+
end
|
39
|
+
|
40
|
+
refute_transaction_trace_has_agent_attribute("request.parameters.duly")
|
41
|
+
refute_event_has_agent_attribute("request.parameters.duly")
|
42
|
+
refute_error_has_agent_attribute("request.parameters.duly")
|
43
|
+
refute_browser_monitoring_has_agent_attribute("request.parameters.duly")
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_request_parameters_default_destinations_with_capture_params
|
47
|
+
run_transaction(:capture_params => true) do |txn|
|
48
|
+
txn.merge_request_parameters(:duly => "noted")
|
49
|
+
end
|
50
|
+
|
51
|
+
assert_transaction_trace_has_agent_attribute("request.parameters.duly", "noted")
|
52
|
+
assert_error_has_agent_attribute("request.parameters.duly", "noted")
|
53
|
+
|
54
|
+
refute_event_has_agent_attribute("request.parameters.duly")
|
55
|
+
refute_browser_monitoring_has_agent_attribute("request.parameters.duly")
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_custom_attributes_included
|
59
|
+
run_transaction do
|
60
|
+
NewRelic::Agent.add_custom_attributes(:foo => 'bar')
|
61
|
+
end
|
62
|
+
|
63
|
+
assert_transaction_tracer_has_custom_attributes('foo', 'bar')
|
64
|
+
assert_transaction_event_has_custom_attributes('foo', 'bar')
|
65
|
+
assert_error_collector_has_custom_attributes('foo', 'bar')
|
66
|
+
assert_browser_monitoring_has_custom_attributes('foo', 'bar')
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_custom_attributes_excluded
|
70
|
+
config = {
|
71
|
+
:'transaction_tracer.attributes.enabled' => false,
|
72
|
+
:'transaction_events.attributes.enabled' => false,
|
73
|
+
:'error_collector.attributes.enabled' => false,
|
74
|
+
:'browser_monitoring.attributes.enabled' => false
|
75
|
+
}
|
76
|
+
|
77
|
+
run_transaction(config) do
|
78
|
+
NewRelic::Agent.add_custom_attributes(:foo => 'bar')
|
79
|
+
end
|
80
|
+
|
81
|
+
refute_transaction_tracer_has_custom_attributes('foo')
|
82
|
+
refute_transaction_event_has_custom_attributes('foo')
|
83
|
+
refute_error_collector_has_custom_attributes('foo')
|
84
|
+
refute_browser_monitoring_has_custom_attributes('foo')
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_custom_attributes_excluded_with_global_config
|
88
|
+
run_transaction(:'attributes.enabled' => false) do
|
89
|
+
NewRelic::Agent.add_custom_attributes(:foo => 'bar')
|
90
|
+
end
|
91
|
+
|
92
|
+
refute_transaction_tracer_has_custom_attributes('foo')
|
93
|
+
refute_transaction_event_has_custom_attributes('foo')
|
94
|
+
refute_error_collector_has_custom_attributes('foo')
|
95
|
+
refute_browser_monitoring_has_custom_attributes('foo')
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_request_parameters_captured_on_transaction_events_when_enabled
|
99
|
+
config = {:'transaction_events.attributes.include' => 'request.parameters.*'}
|
100
|
+
txn_options = {
|
101
|
+
:filtered_params => {:foo => "bar", :bar => "baz"}
|
102
|
+
}
|
103
|
+
run_transaction(config, txn_options)
|
104
|
+
|
105
|
+
assert_event_has_agent_attribute("request.parameters.foo", "bar")
|
106
|
+
assert_event_has_agent_attribute("request.parameters.bar", "baz")
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_request_parameters_captured_in_bam_when_enabled
|
110
|
+
config = {:'browser_monitoring.attributes.include' => 'request.parameters.*'}
|
111
|
+
txn_options = {
|
112
|
+
:filtered_params => {:foo => "bar", :bar => "baz"}
|
113
|
+
}
|
114
|
+
run_transaction(config, txn_options)
|
115
|
+
|
116
|
+
assert_browser_monitoring_has_agent_attribute("request.parameters.foo", "bar")
|
117
|
+
assert_browser_monitoring_has_agent_attribute("request.parameters.bar", "baz")
|
118
|
+
end
|
119
|
+
|
120
|
+
def run_transaction(config = {}, txn_options = {})
|
121
|
+
default_config = {
|
122
|
+
:'transaction_tracer.transaction_threshold' => -10,
|
123
|
+
:'transaction_tracer.attributes.enabled' => true,
|
124
|
+
:'transaction_events.attributes.enabled' => true,
|
125
|
+
:'error_collector.attributes.enabled' => true,
|
126
|
+
:'browser_monitoring.attributes.enabled' => true
|
127
|
+
}
|
128
|
+
|
129
|
+
assert_raises(RuntimeError) do
|
130
|
+
with_config(default_config.merge(config)) do
|
131
|
+
in_transaction(txn_options) do |txn|
|
132
|
+
yield(txn) if block_given?
|
133
|
+
|
134
|
+
# JS instrumentation happens within transaction, so capture it now
|
135
|
+
capture_js_data
|
136
|
+
|
137
|
+
# Have to raise an error to exercise attribute capture there
|
138
|
+
raise "O_o"
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
run_harvest
|
144
|
+
end
|
145
|
+
end
|
@@ -46,6 +46,14 @@ class CrossApplicationTracingTest < Minitest::Test
|
|
46
46
|
assert_nil last_response.headers["X-NewRelic-App-Data"]
|
47
47
|
end
|
48
48
|
|
49
|
+
def test_cross_app_error_attaches_process_id_to_intrinsics
|
50
|
+
assert_raises(RuntimeError) do
|
51
|
+
get '/', {'fail' => 'true'}, {'HTTP_X_NEWRELIC_ID' => Base64.encode64('1#234')}
|
52
|
+
end
|
53
|
+
|
54
|
+
assert_includes attributes_for(last_traced_error, :intrinsic), :client_cross_process_id
|
55
|
+
end
|
56
|
+
|
49
57
|
load_cross_agent_test("cat_map").each do |test_case|
|
50
58
|
# We only can do test cases here that don't involve outgoing calls
|
51
59
|
if !test_case["outboundRequests"]
|
@@ -9,7 +9,11 @@ class CustomQueueTimeTest < Minitest::Test
|
|
9
9
|
|
10
10
|
setup_and_teardown_agent
|
11
11
|
|
12
|
-
DummyRequest = Struct.new(:headers, :cookies)
|
12
|
+
DummyRequest = Struct.new(:headers, :cookies) do
|
13
|
+
def path
|
14
|
+
"/"
|
15
|
+
end
|
16
|
+
end
|
13
17
|
|
14
18
|
class DummyApp
|
15
19
|
include NewRelic::Agent::Instrumentation::ControllerInstrumentation
|
@@ -35,23 +35,23 @@ class EncodingHandlingTest < Minitest::Test
|
|
35
35
|
assert_endpoint_received_string('transaction_sample_data', normalized_bad_string)
|
36
36
|
end
|
37
37
|
|
38
|
-
def
|
38
|
+
def test_handles_mis_encoded_custom_attributes
|
39
39
|
with_config(:'transaction_tracer.transaction_threshold' => 0.0) do
|
40
40
|
in_transaction do
|
41
|
-
NewRelic::Agent.
|
41
|
+
NewRelic::Agent.add_custom_attributes(:foo => bad_string)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
assert_endpoint_received_string('transaction_sample_data', normalized_bad_string)
|
45
45
|
end
|
46
46
|
|
47
|
-
def
|
47
|
+
def test_handles_mis_encoded_custom_attributes_on_analytics_events
|
48
48
|
in_transaction(:category => :controller) do
|
49
|
-
NewRelic::Agent.
|
49
|
+
NewRelic::Agent.add_custom_attributes(:foo => bad_string)
|
50
50
|
end
|
51
51
|
assert_endpoint_received_string('analytic_event_data', normalized_bad_string)
|
52
52
|
end
|
53
53
|
|
54
|
-
def
|
54
|
+
def test_handles_mis_encoded_custom_attributes_on_errors
|
55
55
|
NewRelic::Agent.notice_error('bad news', :custom_params => {'foo' => bad_string})
|
56
56
|
assert_endpoint_received_string('error_data', normalized_bad_string)
|
57
57
|
end
|
@@ -119,7 +119,7 @@ class EncodingHandlingTest < Minitest::Test
|
|
119
119
|
end
|
120
120
|
|
121
121
|
def bad_string
|
122
|
-
|
122
|
+
[128].to_a.pack("C*").force_encoding('UTF-8')
|
123
123
|
end
|
124
124
|
|
125
125
|
def normalized_bad_string
|
@@ -34,7 +34,7 @@ class MarshalingTest < Minitest::Test
|
|
34
34
|
encoder = NewRelic::Agent::NewRelicService::Encoders::Identity
|
35
35
|
|
36
36
|
expected = expected_sample.to_collector_array(encoder)
|
37
|
-
expected = NewRelic::
|
37
|
+
expected = NewRelic::Agent::EncodingNormalizer.normalize_object(expected)
|
38
38
|
|
39
39
|
assert_equal(expected, actual)
|
40
40
|
end
|
@@ -72,9 +72,8 @@ class SetTransactionNameTest < Minitest::Test
|
|
72
72
|
|
73
73
|
def test_apply_to_traced_transactions
|
74
74
|
TestTransactor.new.parent_txn
|
75
|
-
|
76
|
-
|
77
|
-
.params[:path])
|
75
|
+
sample = NewRelic::Agent.instance.transaction_sampler.last_sample
|
76
|
+
assert_equal('Controller/TestTransactor/child', sample.transaction_name)
|
78
77
|
end
|
79
78
|
|
80
79
|
def test_apply_to_traced_errors
|
@@ -84,18 +84,18 @@ class SyntheticsTest < Minitest::Test
|
|
84
84
|
expected_attrs = trace_spec['expectedIntrinsics']
|
85
85
|
non_expected_attrs = trace_spec['nonExpectedIntrinsics']
|
86
86
|
|
87
|
-
trace_attrs = trace.
|
87
|
+
trace_attrs = trace.intrinsic_attributes
|
88
88
|
|
89
89
|
assert_equal(expected_resource_id, trace.synthetics_resource_id)
|
90
90
|
|
91
91
|
expected_attrs.each do |key, value|
|
92
|
-
key = "
|
92
|
+
key = "#{key}"
|
93
93
|
msg = "Incorrect value for transaction trace intrinsic '#{key}'. All intrinsics = #{trace_attrs.inspect}"
|
94
94
|
assert_equal(value, trace_attrs[key], msg)
|
95
95
|
end
|
96
96
|
|
97
97
|
non_expected_attrs.each do |key|
|
98
|
-
key = "
|
98
|
+
key = "#{key}"
|
99
99
|
msg = "Did not expect key '#{key}' on transaction trace. Actual value was #{trace_attrs[key]}"
|
100
100
|
refute_includes(trace_attrs.keys, key, msg)
|
101
101
|
end
|
@@ -13,7 +13,7 @@ class ThreadProfilingTest < Minitest::Test
|
|
13
13
|
|
14
14
|
include MultiverseHelpers
|
15
15
|
|
16
|
-
setup_and_teardown_agent(:'thread_profiler.enabled' => true
|
16
|
+
setup_and_teardown_agent(:'thread_profiler.enabled' => true) do |collector|
|
17
17
|
collector.stub('connect', {"agent_run_id" => 666 })
|
18
18
|
collector.stub('get_agent_commands', [])
|
19
19
|
collector.stub('agent_command_results', [])
|
@@ -9,12 +9,12 @@ class UtilizationDataCollectionTest < Minitest::Test
|
|
9
9
|
include MultiverseHelpers
|
10
10
|
|
11
11
|
setup_and_teardown_agent do
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
$collector.stub('connect',
|
13
|
+
{
|
14
|
+
"agent_run_id" => 42,
|
15
|
+
"collect_utilization" => true
|
16
|
+
}
|
17
|
+
)
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_hostname
|
@@ -124,7 +124,9 @@ class UtilizationDataCollectionTest < Minitest::Test
|
|
124
124
|
end
|
125
125
|
|
126
126
|
def trigger_usage_data_collection_and_submission
|
127
|
-
|
127
|
+
if NewRelic::Agent.config[:collect_utilization]
|
128
|
+
agent.send(:transmit_utilization_data)
|
129
|
+
end
|
128
130
|
end
|
129
131
|
|
130
132
|
def with_fake_metadata_service
|
@@ -2,10 +2,10 @@ suite_condition("Curb is not useful on JRuby") do
|
|
2
2
|
RUBY_PLATFORM != 'java'
|
3
3
|
end
|
4
4
|
|
5
|
-
# There appears to be a bug in
|
6
|
-
# when run on Ruby 1.8.7 or REE, so don't run against that version
|
7
|
-
# Rubies.
|
8
|
-
curb_version_spec = RUBY_VERSION == "1.8.7" ? '0.8.5' : '~>0.8.
|
5
|
+
# There appears to be a bug in later curbs (> 0.8.6) that manifests in hangs of
|
6
|
+
# this suite when run on Ruby 1.8.7 or REE, so don't run against that version
|
7
|
+
# on those Rubies.
|
8
|
+
curb_version_spec = RUBY_VERSION == "1.8.7" ? '0.8.5' : '~>0.8.8'
|
9
9
|
gemfile <<-RB
|
10
10
|
gem 'curb', '#{curb_version_spec}'
|
11
11
|
gem 'rack'
|
@@ -21,8 +21,7 @@ gemfile <<-RB
|
|
21
21
|
gem 'json', :platforms => [:rbx, :mri_18]
|
22
22
|
RB
|
23
23
|
|
24
|
-
# Older curb's than 0.8.6 don't build against Ruby 2.2.0
|
25
|
-
# Recheck on later RC's, but for now, just skip this env for Ruby 2.2.0
|
24
|
+
# Older curb's than 0.8.6 don't build against Ruby 2.2.0
|
26
25
|
if RUBY_VERSION < "2.2.0"
|
27
26
|
gemfile <<-RB
|
28
27
|
gem 'curb', '0.8.1'
|
@@ -129,8 +129,8 @@ class CurbTest < Minitest::Test
|
|
129
129
|
assert_match %r/<head>/i, res
|
130
130
|
end
|
131
131
|
|
132
|
-
|
133
|
-
assert_equal "External/Multiple/Curb::Multi/perform",
|
132
|
+
last_node = find_last_transaction_node()
|
133
|
+
assert_equal "External/Multiple/Curb::Multi/perform", last_node.metric_name
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
@@ -153,8 +153,8 @@ class CurbTest < Minitest::Test
|
|
153
153
|
|
154
154
|
assert_equal(num_requests, successes)
|
155
155
|
assert(perform_block_called, "Block passed to Curl::Multi.perform should have been called")
|
156
|
-
|
157
|
-
assert_equal "External/Multiple/Curb::Multi/perform",
|
156
|
+
last_node = find_last_transaction_node()
|
157
|
+
assert_equal "External/Multiple/Curb::Multi/perform", last_node.metric_name
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
@@ -211,4 +211,3 @@ class CurbTest < Minitest::Test
|
|
211
211
|
end
|
212
212
|
|
213
213
|
end
|
214
|
-
|
@@ -247,8 +247,8 @@ class DataMapperTest < Minitest::Test
|
|
247
247
|
Post.get(42)
|
248
248
|
end
|
249
249
|
|
250
|
-
|
251
|
-
refute_nil
|
250
|
+
sql_node = find_last_transaction_node(last_transaction_trace)
|
251
|
+
refute_nil sql_node.obfuscated_sql
|
252
252
|
end
|
253
253
|
|
254
254
|
def test_direct_select_on_adapter
|
@@ -1,10 +1,17 @@
|
|
1
|
-
if
|
2
|
-
|
3
|
-
excon_versions = %w(0.25.0 0.24.0 0.19.0 0.18.0)
|
1
|
+
if RUBY_VERSION >= '2.2.0'
|
2
|
+
excon_versions = %w(0.45.3)
|
4
3
|
else
|
5
|
-
excon_versions = %w(0.
|
4
|
+
excon_versions = %w(0.45.3
|
5
|
+
0.25.0
|
6
|
+
0.24.0
|
7
|
+
0.19.0
|
8
|
+
0.18.0
|
9
|
+
0.10.0)
|
6
10
|
end
|
7
11
|
|
12
|
+
# Excon 0.10.0 doesn't seem to work on Rubinius 2.2.10
|
13
|
+
excon_versions.delete("0.10.0") if defined?(RUBY_ENGINE) && RUBY_ENGINE == "rbx"
|
14
|
+
|
8
15
|
excon_versions.each do |excon_version|
|
9
16
|
gemfile <<-RB
|
10
17
|
gem 'excon', '~> #{excon_version}'
|