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
@@ -29,22 +29,24 @@ module NewRelic
|
|
29
29
|
class ExconHTTPRequest
|
30
30
|
def initialize(datum)
|
31
31
|
@datum = datum
|
32
|
-
end
|
33
32
|
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
@method = @datum[:method].to_s.upcase
|
34
|
+
@scheme = @datum[:scheme]
|
35
|
+
@port = @datum[:port]
|
36
|
+
@path = @datum[:path]
|
37
37
|
|
38
|
-
|
39
|
-
if hostname = (
|
40
|
-
hostname.split(':').first
|
38
|
+
headers = @datum[:headers]
|
39
|
+
if hostname = (headers['host'] || headers['Host'])
|
40
|
+
@host = hostname.split(':').first
|
41
41
|
else
|
42
|
-
@datum[:host]
|
42
|
+
@host = @datum[:host]
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
|
47
|
-
|
46
|
+
attr_reader :host, :method
|
47
|
+
|
48
|
+
def type
|
49
|
+
"Excon"
|
48
50
|
end
|
49
51
|
|
50
52
|
def [](key)
|
@@ -57,7 +59,7 @@ module NewRelic
|
|
57
59
|
end
|
58
60
|
|
59
61
|
def uri
|
60
|
-
URI.parse("#{@
|
62
|
+
URI.parse("#{@scheme}://#{@host}:#{@port}#{@path}")
|
61
63
|
end
|
62
64
|
end
|
63
65
|
end
|
@@ -58,9 +58,7 @@ module NewRelic
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def filter(params)
|
61
|
-
munged_params = params
|
62
|
-
munged_params.delete('controller')
|
63
|
-
munged_params.delete('action')
|
61
|
+
munged_params = NewRelic::Agent::ParameterFiltering.filter_rails_request_parameters(params)
|
64
62
|
filters = Rails.application.config.filter_parameters
|
65
63
|
ActionDispatch::Http::ParameterFilter.new(filters).filter(munged_params)
|
66
64
|
end
|
@@ -4,7 +4,7 @@
|
|
4
4
|
require 'new_relic/agent/instrumentation/evented_subscriber'
|
5
5
|
|
6
6
|
# Listen for ActiveSupport::Notifications events for ActionView render
|
7
|
-
# events. Write metric data and transaction trace
|
7
|
+
# events. Write metric data and transaction trace nodes for each event.
|
8
8
|
module NewRelic
|
9
9
|
module Agent
|
10
10
|
module Instrumentation
|
@@ -27,7 +27,7 @@ module NewRelic
|
|
27
27
|
|
28
28
|
# @deprecated
|
29
29
|
def rollup_metrics_for(*_)
|
30
|
-
NewRelic::Agent::Deprecator.deprecate("
|
30
|
+
NewRelic::Agent::Deprecator.deprecate("ActiveRecordHelper.rollup_metrics_for",
|
31
31
|
"NewRelic::Agent::Datastores::MetricHelper.metrics_for")
|
32
32
|
|
33
33
|
rollup_metric = if NewRelic::Agent::Transaction.recording_web_transaction?
|
@@ -5,7 +5,7 @@ require 'new_relic/agent/instrumentation/active_record_helper'
|
|
5
5
|
require 'new_relic/agent/instrumentation/evented_subscriber'
|
6
6
|
|
7
7
|
# Listen for ActiveSupport::Notifications events for ActiveRecord query
|
8
|
-
# events. Write metric data, transaction trace
|
8
|
+
# events. Write metric data, transaction trace nodes and slow sql
|
9
9
|
# nodes for each event.
|
10
10
|
module NewRelic
|
11
11
|
module Agent
|
@@ -13,6 +13,13 @@ module NewRelic
|
|
13
13
|
class ActiveRecordSubscriber < EventedSubscriber
|
14
14
|
CACHED_QUERY_NAME = 'CACHE'.freeze unless defined? CACHED_QUERY_NAME
|
15
15
|
|
16
|
+
def initialize
|
17
|
+
# We cache this in an instance variable to avoid re-calling method
|
18
|
+
# on each query.
|
19
|
+
@explainer = method(:get_explain_plan)
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
16
23
|
def start(name, id, payload) #THREAD_LOCAL_ACCESS
|
17
24
|
return if payload[:name] == CACHED_QUERY_NAME
|
18
25
|
return unless NewRelic::Agent.tl_is_execution_traced?
|
@@ -46,20 +53,20 @@ module NewRelic
|
|
46
53
|
def notice_sql(state, event, config, metric)
|
47
54
|
stack = state.traced_method_stack
|
48
55
|
|
49
|
-
# enter transaction trace
|
56
|
+
# enter transaction trace node
|
50
57
|
frame = stack.push_frame(state, :active_record, event.time)
|
51
58
|
|
52
59
|
NewRelic::Agent.instance.transaction_sampler \
|
53
60
|
.notice_sql(event.payload[:sql], config,
|
54
61
|
Helper.milliseconds_to_seconds(event.duration),
|
55
|
-
state,
|
62
|
+
state, &@explainer)
|
56
63
|
|
57
64
|
NewRelic::Agent.instance.sql_sampler \
|
58
65
|
.notice_sql(event.payload[:sql], metric, config,
|
59
66
|
Helper.milliseconds_to_seconds(event.duration),
|
60
|
-
state,
|
67
|
+
state, &@explainer)
|
61
68
|
|
62
|
-
# exit transaction trace
|
69
|
+
# exit transaction trace node
|
63
70
|
stack.pop_frame(state, frame, metric, event.end)
|
64
71
|
end
|
65
72
|
|
@@ -11,16 +11,13 @@ module NewRelic
|
|
11
11
|
module Instrumentation
|
12
12
|
# == NewRelic instrumentation for controller actions and tasks
|
13
13
|
#
|
14
|
-
# This
|
15
|
-
# metrics for every web request.
|
16
|
-
#
|
17
|
-
# It can also be used to capture performance information for
|
14
|
+
# This module can also be used to capture performance information for
|
18
15
|
# background tasks and other non-web transactions, including
|
19
16
|
# detailed transaction traces and traced errors.
|
20
17
|
#
|
21
18
|
# For details on how to instrument background tasks see
|
22
|
-
# ClassMethods#add_transaction_tracer and
|
23
|
-
# #perform_action_with_newrelic_trace
|
19
|
+
# {ClassMethods#add_transaction_tracer} and
|
20
|
+
# {#perform_action_with_newrelic_trace}
|
24
21
|
#
|
25
22
|
# @api public
|
26
23
|
#
|
@@ -212,6 +209,8 @@ module NewRelic
|
|
212
209
|
end
|
213
210
|
end
|
214
211
|
|
212
|
+
# @!parse extend ClassMethods
|
213
|
+
|
215
214
|
class TransactionNamer
|
216
215
|
def self.name_for(txn, traced_obj, category, options={})
|
217
216
|
"#{prefix_for_category(txn, category)}#{path_name(traced_obj, options)}"
|
@@ -323,7 +322,7 @@ module NewRelic
|
|
323
322
|
# allows you to set the entire metric after the category part. Overrides
|
324
323
|
# all the other options.
|
325
324
|
# * <tt>:request => Rack::Request#new(env)</tt> is used to pass in a
|
326
|
-
# request object that may respond to
|
325
|
+
# request object that may respond to path and referer.
|
327
326
|
#
|
328
327
|
# @api public
|
329
328
|
#
|
@@ -124,13 +124,13 @@ DependencyDetection.defer do
|
|
124
124
|
# tracing if it's enabled.
|
125
125
|
def hook_pending_request(request) #THREAD_LOCAL_ACCESS
|
126
126
|
wrapped_request, wrapped_response = wrap_request(request)
|
127
|
-
state
|
128
|
-
t0
|
129
|
-
|
127
|
+
state = NewRelic::Agent::TransactionState.tl_get
|
128
|
+
t0 = Time.now
|
129
|
+
node = NewRelic::Agent::CrossAppTracing.start_trace(state, t0, wrapped_request)
|
130
130
|
|
131
131
|
unless request._nr_instrumented
|
132
132
|
install_header_callback(request, wrapped_response)
|
133
|
-
install_completion_callback(request, t0,
|
133
|
+
install_completion_callback(request, t0, node, wrapped_request, wrapped_response)
|
134
134
|
request._nr_instrumented = true
|
135
135
|
end
|
136
136
|
rescue => err
|
@@ -163,13 +163,13 @@ DependencyDetection.defer do
|
|
163
163
|
end
|
164
164
|
|
165
165
|
# Install a callback that will finish the trace.
|
166
|
-
def install_completion_callback(request, t0,
|
166
|
+
def install_completion_callback(request, t0, node, wrapped_request, wrapped_response) #THREAD_LOCAL_ACCESS
|
167
167
|
original_callback = request.on_complete
|
168
168
|
request._nr_original_on_complete = original_callback
|
169
169
|
request.on_complete do |finished_request|
|
170
170
|
begin
|
171
171
|
state = NewRelic::Agent::TransactionState.tl_get
|
172
|
-
NewRelic::Agent::CrossAppTracing.finish_trace(state, t0,
|
172
|
+
NewRelic::Agent::CrossAppTracing.finish_trace(state, t0, node, wrapped_request, wrapped_response)
|
173
173
|
ensure
|
174
174
|
# Make sure the existing completion callback is run, and restore the
|
175
175
|
# on_complete callback to how it was before.
|
@@ -21,8 +21,8 @@ module ::Excon
|
|
21
21
|
wrapped_request = ::NewRelic::Agent::HTTPClients::ExconHTTPRequest.new(datum)
|
22
22
|
state = ::NewRelic::Agent::TransactionState.tl_get
|
23
23
|
t0 = Time.now
|
24
|
-
|
25
|
-
datum[:connection].instance_variable_set(TRACE_DATA_IVAR, [t0,
|
24
|
+
node = ::NewRelic::Agent::CrossAppTracing.start_trace(state, t0, wrapped_request)
|
25
|
+
datum[:connection].instance_variable_set(TRACE_DATA_IVAR, [t0, node, wrapped_request])
|
26
26
|
end
|
27
27
|
rescue => e
|
28
28
|
NewRelic::Agent.logger.debug(e)
|
@@ -44,12 +44,12 @@ module ::Excon
|
|
44
44
|
trace_data = datum[:connection] && datum[:connection].instance_variable_get(TRACE_DATA_IVAR)
|
45
45
|
if trace_data
|
46
46
|
datum[:connection].instance_variable_set(TRACE_DATA_IVAR, nil)
|
47
|
-
t0,
|
47
|
+
t0, node, wrapped_request = trace_data
|
48
48
|
if datum[:response]
|
49
49
|
wrapped_response = ::NewRelic::Agent::HTTPClients::ExconHTTPResponse.new(datum[:response])
|
50
50
|
end
|
51
51
|
state = ::NewRelic::Agent::TransactionState.tl_get
|
52
|
-
::NewRelic::Agent::CrossAppTracing.finish_trace(state, t0,
|
52
|
+
::NewRelic::Agent::CrossAppTracing.finish_trace(state, t0, node, wrapped_request, wrapped_response)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -19,13 +19,13 @@ module NewRelic
|
|
19
19
|
def handle_transaction(endpoint, class_name)
|
20
20
|
return unless endpoint && route = endpoint.route
|
21
21
|
name_transaction(route, class_name)
|
22
|
-
capture_params(endpoint)
|
22
|
+
capture_params(endpoint)
|
23
23
|
end
|
24
24
|
|
25
25
|
def name_transaction(route, class_name)
|
26
26
|
txn_name = name_for_transaction(route, class_name)
|
27
|
-
|
28
|
-
Transaction.set_default_transaction_name(txn_name, :grape,
|
27
|
+
node_name = "Middleware/Grape/#{class_name}/call"
|
28
|
+
Transaction.set_default_transaction_name(txn_name, :grape, node_name)
|
29
29
|
end
|
30
30
|
|
31
31
|
def name_for_transaction(route, class_name)
|
@@ -46,6 +46,7 @@ module NewRelic
|
|
46
46
|
params = ParameterFiltering::apply_filters(env, endpoint.params)
|
47
47
|
params.delete("route_info")
|
48
48
|
txn.filtered_params = params
|
49
|
+
txn.merge_request_parameters(params)
|
49
50
|
end
|
50
51
|
end
|
51
52
|
end
|
@@ -96,9 +96,12 @@ DependencyDetection.defer do
|
|
96
96
|
include NewRelic::Agent::Instrumentation::ControllerInstrumentation
|
97
97
|
|
98
98
|
def perform_action_with_newrelic_trace_wrapper
|
99
|
-
|
100
|
-
|
101
|
-
|
99
|
+
munged_params = (respond_to?(:filter_parameters)) ? filter_parameters(params) : params
|
100
|
+
munged_params = NewRelic::Agent::ParameterFiltering.filter_rails_request_parameters(munged_params)
|
101
|
+
|
102
|
+
perform_action_with_newrelic_trace(:params => munged_params) do
|
103
|
+
perform_action_without_newrelic_trace
|
104
|
+
end
|
102
105
|
end
|
103
106
|
|
104
107
|
alias_method :perform_action_without_newrelic_trace, :perform_action
|
@@ -24,14 +24,20 @@ DependencyDetection.defer do
|
|
24
24
|
# Make a note of an exception associated with the currently executing
|
25
25
|
# controller action. Note that this used to be available on Object
|
26
26
|
# but we replaced that global method with NewRelic::Agent#notice_error.
|
27
|
-
# Use that one
|
27
|
+
# Use that one instead.
|
28
|
+
#
|
29
|
+
# @api public
|
30
|
+
# @deprecated
|
28
31
|
def newrelic_notice_error(exception, custom_params = {})
|
29
|
-
NewRelic::Agent::
|
32
|
+
NewRelic::Agent::Deprecator.deprecate("ActionController#newrelic_notice_error",
|
33
|
+
"NewRelic::Agent#notice_error")
|
34
|
+
|
35
|
+
NewRelic::Agent::Transaction.notice_error exception, :custom_params => custom_params
|
30
36
|
end
|
31
37
|
|
32
38
|
def rescue_action_with_newrelic_trace(exception)
|
33
39
|
rescue_action_without_newrelic_trace exception
|
34
|
-
NewRelic::Agent::Transaction.notice_error exception
|
40
|
+
NewRelic::Agent::Transaction.notice_error exception
|
35
41
|
end
|
36
42
|
|
37
43
|
# Compare with #alias_method_chain, which is not available in
|
@@ -19,7 +19,12 @@ module NewRelic
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def process_action(*args) #THREAD_LOCAL_ACCESS
|
22
|
-
|
22
|
+
munged_params = NewRelic::Agent::ParameterFiltering.filter_rails_request_parameters(request.filtered_parameters)
|
23
|
+
perform_action_with_newrelic_trace(:category => :controller,
|
24
|
+
:name => self.action_name,
|
25
|
+
:path => newrelic_metric_path,
|
26
|
+
:params => munged_params,
|
27
|
+
:class_name => self.class.name) do
|
23
28
|
super
|
24
29
|
end
|
25
30
|
end
|
@@ -7,14 +7,16 @@ module NewRelic
|
|
7
7
|
module Instrumentation
|
8
8
|
module Rails3
|
9
9
|
module Errors
|
10
|
+
|
11
|
+
# @api public
|
12
|
+
# @deprecated
|
10
13
|
def newrelic_notice_error(exception, custom_params = {})
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
:custom_params => filtered_params)
|
14
|
+
NewRelic::Agent::Deprecator.deprecate("ActionController#newrelic_notice_error",
|
15
|
+
"NewRelic::Agent#notice_error")
|
16
|
+
|
17
|
+
NewRelic::Agent::Transaction.notice_error(exception,
|
18
|
+
:metric => newrelic_metric_path,
|
19
|
+
:custom_params => custom_params)
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
@@ -7,13 +7,15 @@ module NewRelic
|
|
7
7
|
module Instrumentation
|
8
8
|
module Rails4
|
9
9
|
module Errors
|
10
|
+
|
11
|
+
# @api public
|
12
|
+
# @deprecated
|
10
13
|
def newrelic_notice_error(exception, custom_params = {})
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
:custom_params => filtered_params)
|
14
|
+
NewRelic::Agent::Deprecator.deprecate("ActionController#newrelic_notice_error",
|
15
|
+
"NewRelic::Agent#notice_error")
|
16
|
+
|
17
|
+
NewRelic::Agent::Transaction.notice_error(exception,
|
18
|
+
:custom_params => custom_params)
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
@@ -27,9 +27,8 @@ DependencyDetection.defer do
|
|
27
27
|
:class_name => self.name,
|
28
28
|
:category => 'OtherTransaction/ResqueJob') do
|
29
29
|
|
30
|
-
|
31
|
-
NewRelic::Agent
|
32
|
-
end
|
30
|
+
NewRelic::Agent::Transaction.merge_untrusted_agent_attributes(args, :'job.resque.args',
|
31
|
+
NewRelic::Agent::AttributeFilter::DST_NONE)
|
33
32
|
|
34
33
|
yield(*args)
|
35
34
|
end
|
@@ -27,9 +27,9 @@ DependencyDetection.defer do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
perform_action_with_newrelic_trace(trace_args) do
|
30
|
-
|
31
|
-
NewRelic::Agent
|
32
|
-
|
30
|
+
NewRelic::Agent::Transaction.merge_untrusted_agent_attributes(msg['args'], :'job.sidekiq.args',
|
31
|
+
NewRelic::Agent::AttributeFilter::DST_NONE)
|
32
|
+
|
33
33
|
yield
|
34
34
|
end
|
35
35
|
end
|
@@ -65,10 +65,10 @@ module NewRelic::Agent::Instrumentation::TyphoeusTracing
|
|
65
65
|
if state.is_execution_traced? && !request_is_hydra_enabled?(request)
|
66
66
|
wrapped_request = ::NewRelic::Agent::HTTPClients::TyphoeusHTTPRequest.new(request)
|
67
67
|
t0 = Time.now
|
68
|
-
|
68
|
+
node = ::NewRelic::Agent::CrossAppTracing.start_trace(state, t0, wrapped_request)
|
69
69
|
callback = Proc.new do
|
70
70
|
wrapped_response = ::NewRelic::Agent::HTTPClients::TyphoeusHTTPResponse.new(request.response)
|
71
|
-
::NewRelic::Agent::CrossAppTracing.finish_trace(state, t0,
|
71
|
+
::NewRelic::Agent::CrossAppTracing.finish_trace(state, t0, node, wrapped_request, wrapped_response)
|
72
72
|
end
|
73
73
|
request.on_complete.unshift(callback)
|
74
74
|
end
|
@@ -127,8 +127,10 @@ module NewRelic
|
|
127
127
|
QUEUE_TIME_KEY = "queueTime".freeze
|
128
128
|
APPLICATION_TIME_KEY = "applicationTime".freeze
|
129
129
|
AGENT_KEY = "agent".freeze
|
130
|
-
USER_ATTRIBUTES_KEY = "userAttributes".freeze
|
131
130
|
SSL_FOR_HTTP_KEY = "sslForHttp".freeze
|
131
|
+
ATTS_KEY = "atts".freeze
|
132
|
+
ATTS_USER_SUBKEY = "u".freeze
|
133
|
+
ATTS_AGENT_SUBKEY = "a".freeze
|
132
134
|
|
133
135
|
# NOTE: Internal prototyping may override this, so leave name stable!
|
134
136
|
def data_for_js_agent(state)
|
@@ -146,7 +148,7 @@ module NewRelic
|
|
146
148
|
}
|
147
149
|
|
148
150
|
add_ssl_for_http(data)
|
149
|
-
|
151
|
+
add_attributes(data, state.current_transaction)
|
150
152
|
|
151
153
|
data
|
152
154
|
end
|
@@ -158,25 +160,31 @@ module NewRelic
|
|
158
160
|
end
|
159
161
|
end
|
160
162
|
|
161
|
-
def
|
162
|
-
return unless
|
163
|
+
def add_attributes(data, txn)
|
164
|
+
return unless txn
|
163
165
|
|
164
|
-
|
165
|
-
|
166
|
-
|
166
|
+
atts = {}
|
167
|
+
append_custom_attributes!(txn, atts)
|
168
|
+
append_agent_attributes!(txn, atts)
|
169
|
+
|
170
|
+
unless atts.empty?
|
171
|
+
json = NewRelic::JSONWrapper.dump(atts)
|
172
|
+
data[ATTS_KEY] = obfuscator.obfuscate(json)
|
173
|
+
end
|
167
174
|
end
|
168
175
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
(NewRelic::Agent.config[:'browser_monitoring.capture_attributes'] ||
|
175
|
-
NewRelic::Agent.config[:'capture_attributes.page_view_events'])
|
176
|
+
def append_custom_attributes!(txn, atts)
|
177
|
+
custom_attributes = txn.attributes.custom_attributes_for(NewRelic::Agent::AttributeFilter::DST_BROWSER_MONITORING)
|
178
|
+
unless custom_attributes.empty?
|
179
|
+
atts[ATTS_USER_SUBKEY] = custom_attributes
|
180
|
+
end
|
176
181
|
end
|
177
182
|
|
178
|
-
def
|
179
|
-
|
183
|
+
def append_agent_attributes!(txn, atts)
|
184
|
+
agent_attributes = txn.attributes.agent_attributes_for(NewRelic::Agent::AttributeFilter::DST_BROWSER_MONITORING)
|
185
|
+
unless agent_attributes.empty?
|
186
|
+
atts[ATTS_AGENT_SUBKEY] = agent_attributes
|
187
|
+
end
|
180
188
|
end
|
181
189
|
|
182
190
|
def html_safe_if_needed(string)
|