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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab8bebcd389bae69e6fbac95dd23d18923adc883
|
4
|
+
data.tar.gz: f8270582f1517c086367167d739444c11a01db90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35f890abc5f586c85bcfe9d94830053574ae40523aec910094725627649caece236d2ecba04b6d1da7dee8270b302eb1fb331520d8e728b73c661cbb1855bde3
|
7
|
+
data.tar.gz: 6998f741f755f020c6f8c676e0a8de17e92efaf4d6261fdbb2ab73fe66af51de63c28c084c1a43cfbfb18bb998fa1254a6d59d977933156f62e85d0580b8f873
|
data/.travis.yml
CHANGED
data/.yardopts
CHANGED
@@ -5,6 +5,8 @@ lib/new_relic/agent/method_tracer.rb
|
|
5
5
|
lib/new_relic/agent/instrumentation/controller_instrumentation.rb
|
6
6
|
lib/new_relic/agent/instrumentation/rack.rb
|
7
7
|
lib/new_relic/agent/instrumentation/metric_frame.rb
|
8
|
+
lib/new_relic/agent/stats_engine/metric_stats.rb
|
9
|
+
lib/new_relic/agent/datastores.rb
|
8
10
|
lib/new_relic/agent/sql_sampler.rb
|
9
11
|
lib/new_relic/agent/transaction.rb
|
10
12
|
lib/new_relic/agent/transaction_sampler.rb
|
data/CHANGELOG
CHANGED
@@ -1,21 +1,42 @@
|
|
1
1
|
# New Relic Ruby Agent Release Notes #
|
2
2
|
|
3
|
+
## v3.12.0 ##
|
4
|
+
|
5
|
+
* Flexible capturing of attributes
|
6
|
+
|
7
|
+
The Ruby agent now allows you more control over exactly which request
|
8
|
+
parameters and job arguments are attached to transaction traces, traced
|
9
|
+
errors, and Insights events. For details, see:
|
10
|
+
|
11
|
+
https://docs.newrelic.com/docs/agents/ruby-agent/ruby-agent-attributes
|
12
|
+
|
13
|
+
* Fixed missing URIs in traces for retried Excon requests
|
14
|
+
|
15
|
+
If Excon's idempotent option retried a request, the transaction trace node
|
16
|
+
for the call would miss having the URI assigned. This has been fixed.
|
17
|
+
|
18
|
+
* Capturing request parameters from rescued exceptions in Grape
|
19
|
+
|
20
|
+
If an exception was handled via a rescue_from in Grape, request parameters
|
21
|
+
were not properly set on the error trace. This has been fixed. Thanks to
|
22
|
+
Ankit Shah for helping us spot the bug.
|
23
|
+
|
3
24
|
## v3.11.2 ##
|
4
25
|
|
5
|
-
* Better naming for Rack::URLMap
|
26
|
+
* Better naming for Rack::URLMap
|
6
27
|
|
7
28
|
If a Rack app made direct use of Rack::URLMap, instrumentation would miss
|
8
29
|
out on using the clearest naming based on the app class. This has been
|
9
30
|
fixed.
|
10
31
|
|
11
|
-
* Avoid performance regression in makara database adapter
|
32
|
+
* Avoid performance regression in makara database adapter
|
12
33
|
|
13
34
|
Delegation in the makara database adapter caused performance issues when the
|
14
35
|
agent looked up a connection in the pool. The agent now uses a faster
|
15
36
|
lookup to work around this problem in makara, and allocates less as well.
|
16
37
|
Thanks Mike Nelson for the help in resolving this!
|
17
38
|
|
18
|
-
* Allow audit logging to STDOUT
|
39
|
+
* Allow audit logging to STDOUT
|
19
40
|
|
20
41
|
Previously audit logs of the agent's communication with New Relic could only
|
21
42
|
write to a file. This prevented using the feature on cloud providers like
|
@@ -24,7 +45,7 @@
|
|
24
45
|
|
25
46
|
For more information see https://docs.newrelic.com/docs/agents/ruby-agent/installation-configuration/ruby-agent-configuration#audit_log
|
26
47
|
|
27
|
-
* Fix for crash during startup when Rails required but not used
|
48
|
+
* Fix for crash during startup when Rails required but not used
|
28
49
|
|
29
50
|
If an application requires Rails but wasn't actually running it, the Ruby
|
30
51
|
agent would fail during startup. This has been fixed.
|
@@ -43,6 +64,20 @@
|
|
43
64
|
the background thread used by the agent to report data would hang, leading
|
44
65
|
to no data being reported. This has been be fixed.
|
45
66
|
|
67
|
+
## v3.11.1 ##
|
68
|
+
|
69
|
+
If an application adds their own select method to Object/Kernel or mixes in a
|
70
|
+
module that overrides the select method (as with ActionView::Helpers) we would
|
71
|
+
previously have used their implementation instead of the intended IO.select,
|
72
|
+
leading to all sorts of unusual errors. We now explicitly reference IO.select
|
73
|
+
in the event loop to avoid these issues.
|
74
|
+
|
75
|
+
* Fix for background thread hangs on old Linux kernels
|
76
|
+
|
77
|
+
When running under Ruby 1.8.7 on Linux kernel versions 2.6.11 and earlier,
|
78
|
+
the background thread used by the agent to report data would hang, leading
|
79
|
+
to no data being reported. This has been be fixed.
|
80
|
+
|
46
81
|
## v3.11.1 ##
|
47
82
|
|
48
83
|
The Ruby agent incorrectly rescued exceptions at a point which caused
|
data/README.md
CHANGED
@@ -60,8 +60,10 @@ http://newrelic.com/ . There you can
|
|
60
60
|
sign up for a free Lite account or one of our paid subscriptions.
|
61
61
|
|
62
62
|
Once you receive the welcome e-mail with a license key and
|
63
|
-
`newrelic.yml` file
|
64
|
-
directory
|
63
|
+
`newrelic.yml` file. You can copy the `newrelic.yml` file into your app config
|
64
|
+
directory OR can generate the file manually with command:
|
65
|
+
|
66
|
+
newrelic install --license_key="YOUR_KEY" "My application"
|
65
67
|
|
66
68
|
The initial configuration is done in the `newrelic.yml` file. This file
|
67
69
|
is by default read from the `config` directory of the application root
|
data/lib/new_relic/agent.rb
CHANGED
@@ -5,64 +5,19 @@
|
|
5
5
|
require 'forwardable'
|
6
6
|
require 'new_relic/control'
|
7
7
|
|
8
|
-
# = New Relic Ruby Agent
|
9
|
-
#
|
10
|
-
# New Relic is a performance monitoring application for applications
|
11
|
-
# running in production. For more information on New Relic please visit
|
12
|
-
# http://www.newrelic.com.
|
13
|
-
#
|
14
|
-
# The New Relic Ruby Agent can be installed in Rails applications to
|
15
|
-
# gather runtime performance metrics, traces, and errors for display
|
16
|
-
# in a Developer Mode middleware (mapped to /newrelic in your application
|
17
|
-
# server) or for monitoring and analysis at http://rpm.newrelic.com
|
18
|
-
# with just about any Ruby application.
|
19
|
-
#
|
20
|
-
# == Getting Started
|
21
|
-
# For instructions on installation and setup, see
|
22
|
-
# the README[link:./files/README_rdoc.html] file.
|
23
|
-
#
|
24
|
-
# == Using with Rack/Metal
|
25
|
-
#
|
26
|
-
# To instrument Rack middlewares or Metal apps, refer to the docs in
|
27
|
-
# NewRelic::Agent::Instrumentation::Rack.
|
28
|
-
#
|
29
|
-
# == Ruby Agent API
|
30
|
-
#
|
31
|
-
# For details on the Ruby Agent API, refer to NewRelic::Agent.
|
32
|
-
#
|
33
|
-
# == Customizing the Ruby Agent
|
34
|
-
#
|
35
|
-
# For detailed information on customizing the Ruby Agent
|
36
|
-
# please visit our {support and documentation site}[http://support.newrelic.com].
|
37
|
-
#
|
38
8
|
# @api public
|
39
|
-
#
|
40
9
|
module NewRelic
|
41
|
-
#
|
42
|
-
# This module contains the public API methods for the Ruby Agent.
|
10
|
+
# This module contains most of the public API methods for the Ruby Agent.
|
43
11
|
#
|
44
|
-
# For adding custom instrumentation to method invocations,
|
45
|
-
# the docs
|
12
|
+
# For adding custom instrumentation to method invocations, see
|
13
|
+
# the docs for {NewRelic::Agent::MethodTracer} and
|
14
|
+
# {NewRelic::Agent::MethodTracer::ClassMethods}.
|
46
15
|
#
|
47
|
-
# For information on how to
|
48
|
-
#
|
49
|
-
# that high level dispatcher actions or background tasks show up as
|
50
|
-
# first class operations in New Relic, refer to
|
51
|
-
# NewRelic::Agent::Instrumentation::ControllerInstrumentation and
|
52
|
-
# NewRelic::Agent::Instrumentation::ControllerInstrumentation::ClassMethods.
|
16
|
+
# For information on how to trace transactions in non-Rack contexts,
|
17
|
+
# see {NewRelic::Agent::Instrumentation::ControllerInstrumentation}.
|
53
18
|
#
|
54
|
-
#
|
55
|
-
#
|
56
|
-
# NewRelic::Agent::Instrumentation::ControllerInstrumentation are
|
57
|
-
# available to applications. When the agent is not enabled the
|
58
|
-
# method implementations are stubbed into no-ops to reduce overhead.
|
59
|
-
#
|
60
|
-
# Methods and classes in other parts of the agent are not guaranteed
|
61
|
-
# to be available between releases.
|
62
|
-
#
|
63
|
-
# Refer to the online docs at support.newrelic.com to see how to
|
64
|
-
# access the data collected by custom instrumentation, or e-mail
|
65
|
-
# support at New Relic for help.
|
19
|
+
# For general documentation about the Ruby agent, see:
|
20
|
+
# https://docs.newrelic.com/docs/agents/ruby-agent
|
66
21
|
#
|
67
22
|
# @api public
|
68
23
|
#
|
@@ -76,8 +31,6 @@ module NewRelic
|
|
76
31
|
require 'new_relic/metric_spec'
|
77
32
|
require 'new_relic/metric_data'
|
78
33
|
require 'new_relic/collection_helper'
|
79
|
-
require 'new_relic/transaction_sample'
|
80
|
-
require 'new_relic/url_rule'
|
81
34
|
require 'new_relic/noticed_error'
|
82
35
|
require 'new_relic/timer_lib'
|
83
36
|
|
@@ -185,6 +138,8 @@ module NewRelic
|
|
185
138
|
@config.reset_to_defaults
|
186
139
|
end
|
187
140
|
|
141
|
+
# @!group Recording custom metrics
|
142
|
+
|
188
143
|
# Record a value for the given metric name.
|
189
144
|
#
|
190
145
|
# This method should be used to record event-based metrics such as method
|
@@ -230,26 +185,85 @@ module NewRelic
|
|
230
185
|
end
|
231
186
|
end
|
232
187
|
|
233
|
-
#
|
234
|
-
|
188
|
+
# @!endgroup
|
189
|
+
|
190
|
+
# @!group Recording custom errors
|
191
|
+
|
192
|
+
# Set a filter to be applied to errors that the Ruby Agent will
|
193
|
+
# track. The block should evalute to the exception to track
|
194
|
+
# (which could be different from the original exception) or nil to
|
195
|
+
# ignore this exception.
|
235
196
|
#
|
236
|
-
#
|
237
|
-
# specific metrics should begin with "Custom/".
|
197
|
+
# The block is yielded to with the exception to filter.
|
238
198
|
#
|
239
|
-
# Return
|
240
|
-
# via calls to add_data_point(value).
|
199
|
+
# Return the new block or the existing filter Proc if no block is passed.
|
241
200
|
#
|
242
|
-
#
|
243
|
-
#
|
201
|
+
# @api public
|
202
|
+
#
|
203
|
+
def ignore_error_filter(&block)
|
204
|
+
if block
|
205
|
+
NewRelic::Agent::ErrorCollector.ignore_error_filter = block
|
206
|
+
else
|
207
|
+
NewRelic::Agent::ErrorCollector.ignore_error_filter
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
# Notice the error with the given available options:
|
212
|
+
#
|
213
|
+
# * <tt>:uri</tt> => Request path, minus request params or query string
|
214
|
+
# * <tt>:metric</tt> => The metric name associated with the transaction
|
215
|
+
# * <tt>:custom_params</tt> => Custom parameters
|
216
|
+
#
|
217
|
+
# Previous versions of the agent allowed passing :request_params but
|
218
|
+
# those are now ignored. Associate the request with the enclosing
|
219
|
+
# transaction, or record additional information as custom attributes.
|
220
|
+
# Anything left over is treated as custom params.
|
244
221
|
#
|
245
222
|
# @api public
|
246
|
-
# @deprecated
|
247
223
|
#
|
248
|
-
def
|
249
|
-
|
224
|
+
def notice_error(exception, options={})
|
225
|
+
Transaction.notice_error(exception, options)
|
226
|
+
nil # don't return a noticed error datastructure. it can only hurt.
|
250
227
|
end
|
251
228
|
|
252
|
-
|
229
|
+
# @!endgroup
|
230
|
+
|
231
|
+
# @!group Recording custom Insights events
|
232
|
+
|
233
|
+
# Record a custom event to be sent to New Relic Insights.
|
234
|
+
# The recorded event will be buffered in memory until the next time the
|
235
|
+
# agent sends data to New Relic's servers.
|
236
|
+
#
|
237
|
+
# If you want to be able to tie the information recorded via this call back
|
238
|
+
# to the web request or background job that it happened in, you may want to
|
239
|
+
# instead use the add_custom_attributes API call to attach attributes to
|
240
|
+
# the Transaction event that will automatically be generated for the
|
241
|
+
# request.
|
242
|
+
#
|
243
|
+
# A timestamp will be automatically added to the recorded event when this
|
244
|
+
# method is called.
|
245
|
+
#
|
246
|
+
# @param [Symbol or String] event_type The name of the event type to record. Event
|
247
|
+
# types must consist of only alphanumeric
|
248
|
+
# characters, '_', ':', or ' '.
|
249
|
+
#
|
250
|
+
# @param [Hash] event_attrs A Hash of attributes to be attached to the event.
|
251
|
+
# Keys should be strings or symbols, and values
|
252
|
+
# may be strings, symbols, numeric values or
|
253
|
+
# booleans.
|
254
|
+
#
|
255
|
+
# @api public
|
256
|
+
#
|
257
|
+
def record_custom_event(event_type, event_attrs)
|
258
|
+
if agent && NewRelic::Agent.config[:'custom_insights_events.enabled']
|
259
|
+
agent.custom_event_aggregator.record(event_type, event_attrs)
|
260
|
+
end
|
261
|
+
nil
|
262
|
+
end
|
263
|
+
|
264
|
+
# @!endgroup
|
265
|
+
|
266
|
+
# @!group Manual agent configuration and startup/shutdown
|
253
267
|
|
254
268
|
# Call this to manually start the Agent in situations where the Agent does
|
255
269
|
# not auto-start.
|
@@ -305,35 +319,23 @@ module NewRelic
|
|
305
319
|
agent.after_fork(options)
|
306
320
|
end
|
307
321
|
|
308
|
-
#
|
309
|
-
#
|
322
|
+
# Shutdown the agent. Call this before exiting. Sends any queued data
|
323
|
+
# and kills the background thread.
|
310
324
|
#
|
311
|
-
# @
|
312
|
-
def drop_buffered_data
|
313
|
-
agent.drop_buffered_data
|
314
|
-
end
|
315
|
-
|
316
|
-
# Require agent testing helper methods
|
325
|
+
# @param options [Hash] Unused options Hash, for back compatibility only
|
317
326
|
#
|
318
327
|
# @api public
|
319
|
-
def require_test_helper
|
320
|
-
path = File.join(__FILE__, '..', '..', '..', 'test', 'agent_helper')
|
321
|
-
require File.expand_path(path)
|
322
|
-
end
|
323
|
-
|
324
|
-
# Deprecated in favor of drop_buffered_data
|
325
328
|
#
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
+
def shutdown(options={})
|
330
|
+
agent.shutdown if agent
|
331
|
+
end
|
329
332
|
|
330
|
-
#
|
331
|
-
#
|
333
|
+
# Clear out any data the agent has buffered but has not yet transmitted
|
334
|
+
# to the collector.
|
332
335
|
#
|
333
336
|
# @api public
|
334
|
-
|
335
|
-
|
336
|
-
agent.shutdown(options) if agent
|
337
|
+
def drop_buffered_data
|
338
|
+
agent.drop_buffered_data
|
337
339
|
end
|
338
340
|
|
339
341
|
# Add instrumentation files to the agent. The argument should be
|
@@ -349,6 +351,14 @@ module NewRelic
|
|
349
351
|
NewRelic::Control.instance.add_instrumentation file_pattern
|
350
352
|
end
|
351
353
|
|
354
|
+
# Require agent testing helper methods
|
355
|
+
#
|
356
|
+
# @api public
|
357
|
+
def require_test_helper
|
358
|
+
path = File.join(__FILE__, '..', '..', '..', 'test', 'agent_helper')
|
359
|
+
require File.expand_path(path)
|
360
|
+
end
|
361
|
+
|
352
362
|
# This method sets the block sent to this method as a sql
|
353
363
|
# obfuscator. The block will be called with a single String SQL
|
354
364
|
# statement to obfuscate. The method must return the obfuscated
|
@@ -369,40 +379,9 @@ module NewRelic
|
|
369
379
|
NewRelic::Agent::Database.set_sql_obfuscator(type, &block)
|
370
380
|
end
|
371
381
|
|
382
|
+
# @!endgroup
|
372
383
|
|
373
|
-
#
|
374
|
-
# sampler feature. Within the given block, no sql will be recorded
|
375
|
-
#
|
376
|
-
# usage:
|
377
|
-
#
|
378
|
-
# NewRelic::Agent.disable_sql_recording do
|
379
|
-
# ...
|
380
|
-
# end
|
381
|
-
#
|
382
|
-
# @api public
|
383
|
-
#
|
384
|
-
def disable_sql_recording
|
385
|
-
state = agent.set_record_sql(false)
|
386
|
-
begin
|
387
|
-
yield
|
388
|
-
ensure
|
389
|
-
agent.set_record_sql(state)
|
390
|
-
end
|
391
|
-
end
|
392
|
-
|
393
|
-
# This method disables the recording of transaction traces in the given
|
394
|
-
# block. See also #disable_all_tracing
|
395
|
-
#
|
396
|
-
# @api public
|
397
|
-
#
|
398
|
-
def disable_transaction_tracing
|
399
|
-
state = agent.set_record_tt(false)
|
400
|
-
begin
|
401
|
-
yield
|
402
|
-
ensure
|
403
|
-
agent.set_record_tt(state)
|
404
|
-
end
|
405
|
-
end
|
384
|
+
# @!group Ignoring or excluding data
|
406
385
|
|
407
386
|
# This method disables the recording of the current transaction. No metrics,
|
408
387
|
# traced errors, transaction traces, Insights events, slow SQL traces,
|
@@ -435,20 +414,6 @@ module NewRelic
|
|
435
414
|
txn.ignore_enduser! if txn
|
436
415
|
end
|
437
416
|
|
438
|
-
# Cancel the collection of the current transaction in progress, if
|
439
|
-
# any. Only affects the transaction started on this thread once
|
440
|
-
# it has started and before it has completed.
|
441
|
-
#
|
442
|
-
# This method has been deprecated in favor of ignore_transaction,
|
443
|
-
# which does what people expect this method to do.
|
444
|
-
#
|
445
|
-
# @api public
|
446
|
-
# @deprecated
|
447
|
-
#
|
448
|
-
def abort_transaction!
|
449
|
-
Transaction.abort_transaction!
|
450
|
-
end
|
451
|
-
|
452
417
|
# Yield to the block without collecting any metrics or traces in
|
453
418
|
# any of the subsequent calls. If executed recursively, will keep
|
454
419
|
# track of the first entry point and turn on tracing again after
|
@@ -463,37 +428,42 @@ module NewRelic
|
|
463
428
|
agent.pop_trace_execution_flag
|
464
429
|
end
|
465
430
|
|
466
|
-
#
|
467
|
-
#
|
468
|
-
# agent sends data to New Relic's servers.
|
431
|
+
# This method disables the recording of transaction traces in the given
|
432
|
+
# block. See also #disable_all_tracing
|
469
433
|
#
|
470
|
-
#
|
471
|
-
# to the web request or background job that it happened in, you may want to
|
472
|
-
# instead use the add_custom_parameters API call to attach attributes to
|
473
|
-
# the Transaction event that will automatically be generated for the
|
474
|
-
# request.
|
434
|
+
# @api public
|
475
435
|
#
|
476
|
-
|
477
|
-
|
436
|
+
def disable_transaction_tracing
|
437
|
+
state = agent.set_record_tt(false)
|
438
|
+
begin
|
439
|
+
yield
|
440
|
+
ensure
|
441
|
+
agent.set_record_tt(state)
|
442
|
+
end
|
443
|
+
end
|
444
|
+
|
445
|
+
# This method sets the state of sql recording in the transaction
|
446
|
+
# sampler feature. Within the given block, no sql will be recorded
|
478
447
|
#
|
479
|
-
#
|
480
|
-
# types must consist of only alphanumeric
|
481
|
-
# characters, '_', ':', or ' '.
|
448
|
+
# usage:
|
482
449
|
#
|
483
|
-
#
|
484
|
-
#
|
485
|
-
#
|
486
|
-
# booleans.
|
450
|
+
# NewRelic::Agent.disable_sql_recording do
|
451
|
+
# ...
|
452
|
+
# end
|
487
453
|
#
|
488
454
|
# @api public
|
489
455
|
#
|
490
|
-
def
|
491
|
-
|
492
|
-
|
456
|
+
def disable_sql_recording
|
457
|
+
state = agent.set_record_sql(false)
|
458
|
+
begin
|
459
|
+
yield
|
460
|
+
ensure
|
461
|
+
agent.set_record_sql(state)
|
493
462
|
end
|
494
|
-
nil
|
495
463
|
end
|
496
464
|
|
465
|
+
# @!endgroup
|
466
|
+
|
497
467
|
# Check to see if we are capturing metrics currently on this thread.
|
498
468
|
def tl_is_execution_traced?
|
499
469
|
NewRelic::Agent::TransactionState.tl_get.is_execution_traced?
|
@@ -511,70 +481,30 @@ module NewRelic
|
|
511
481
|
NewRelic::Agent::TransactionState.tl_get.is_sql_recorded?
|
512
482
|
end
|
513
483
|
|
514
|
-
#
|
515
|
-
# track. The block should evalute to the exception to track
|
516
|
-
# (which could be different from the original exception) or nil to
|
517
|
-
# ignore this exception.
|
518
|
-
#
|
519
|
-
# The block is yielded to with the exception to filter.
|
520
|
-
#
|
521
|
-
# Return the new block or the existing filter Proc if no block is passed.
|
522
|
-
#
|
523
|
-
# @api public
|
524
|
-
#
|
525
|
-
def ignore_error_filter(&block)
|
526
|
-
if block
|
527
|
-
NewRelic::Agent::ErrorCollector.ignore_error_filter = block
|
528
|
-
else
|
529
|
-
NewRelic::Agent::ErrorCollector.ignore_error_filter
|
530
|
-
end
|
531
|
-
end
|
532
|
-
|
533
|
-
# Record the given error. It will be passed through the
|
534
|
-
# #ignore_error_filter if there is one.
|
535
|
-
#
|
536
|
-
# * <tt>exception</tt> is the exception which will be recorded. May also be
|
537
|
-
# an error message.
|
538
|
-
# Options:
|
539
|
-
# * <tt>:uri</tt> => The request path, minus any request params or query string.
|
540
|
-
# * <tt>:referer</tt> => The URI of the referer
|
541
|
-
# * <tt>:metric</tt> => The metric name associated with the transaction
|
542
|
-
# * <tt>:request_params</tt> => Request parameters, already filtered if necessary
|
543
|
-
# * <tt>:custom_params</tt> => Custom parameters
|
544
|
-
#
|
545
|
-
# Anything left over is treated as custom params.
|
546
|
-
#
|
547
|
-
# @api public
|
548
|
-
#
|
549
|
-
def notice_error(exception, options={})
|
550
|
-
Transaction.notice_error(exception, options)
|
551
|
-
nil # don't return a noticed error datastructure. it can only hurt.
|
552
|
-
end
|
484
|
+
# @!group Adding custom attributes to traces
|
553
485
|
|
554
|
-
# Add
|
486
|
+
# Add attributes to the transaction trace, Insights Transaction event, and
|
555
487
|
# any traced errors recorded for the current transaction.
|
556
488
|
#
|
557
489
|
# If Browser Monitoring is enabled, and the
|
558
|
-
# browser_monitoring.
|
559
|
-
# these custom
|
560
|
-
#
|
490
|
+
# browser_monitoring.attributes.enabled configuration setting is true,
|
491
|
+
# these custom attributes will also be present in the script injected into
|
492
|
+
# the response body, making them available on Insights PageView events.
|
561
493
|
#
|
562
494
|
# @api public
|
563
495
|
#
|
564
|
-
def
|
496
|
+
def add_custom_attributes(params) #THREAD_LOCAL_ACCESS
|
565
497
|
if params.is_a? Hash
|
566
498
|
txn = Transaction.tl_current
|
567
|
-
txn.
|
499
|
+
txn.add_custom_attributes(params) if txn
|
568
500
|
else
|
569
|
-
::NewRelic::Agent.logger.warn("Bad argument passed to #
|
501
|
+
::NewRelic::Agent.logger.warn("Bad argument passed to #add_custom_attributes. Expected Hash but got #{params.class}")
|
570
502
|
end
|
571
503
|
end
|
572
504
|
|
573
|
-
#
|
574
|
-
alias add_request_parameters add_custom_parameters
|
505
|
+
# @!endgroup
|
575
506
|
|
576
|
-
#
|
577
|
-
alias set_user_attributes add_custom_parameters
|
507
|
+
# @!group Transaction naming
|
578
508
|
|
579
509
|
# Set the name of the current running transaction. The agent will
|
580
510
|
# apply a reasonable default based on framework routing, but in
|
@@ -616,6 +546,8 @@ module NewRelic
|
|
616
546
|
end
|
617
547
|
end
|
618
548
|
|
549
|
+
# @!endgroup
|
550
|
+
|
619
551
|
# Yield to a block that is run with a database metric name context. This means
|
620
552
|
# the Database instrumentation will use this for the metric name if it does not
|
621
553
|
# otherwise know about a model. This is re-entrant.
|
@@ -625,7 +557,7 @@ module NewRelic
|
|
625
557
|
# @param [String] method the name of the finder method or other method to
|
626
558
|
# identify the operation with.
|
627
559
|
#
|
628
|
-
def with_database_metric_name(model, method, &block) #THREAD_LOCAL_ACCESS
|
560
|
+
def with_database_metric_name(model, method = nil, &block) #THREAD_LOCAL_ACCESS
|
629
561
|
if txn = Transaction.tl_current
|
630
562
|
txn.with_database_metric_name(model, method, &block)
|
631
563
|
else
|
@@ -633,18 +565,12 @@ module NewRelic
|
|
633
565
|
end
|
634
566
|
end
|
635
567
|
|
636
|
-
# Remove after 5/9/15
|
637
|
-
def record_transaction(*args)
|
638
|
-
NewRelic::Agent.logger.warn('This method has been deprecated, please see https://docs.newrelic.com/docs/ruby/ruby-agent-api for current API documentation.')
|
639
|
-
end
|
640
|
-
|
641
568
|
# Subscribe to events of +event_type+, calling the given +handler+
|
642
569
|
# when one is sent.
|
643
570
|
def subscribe(event_type, &handler)
|
644
571
|
agent.events.subscribe( event_type, &handler )
|
645
572
|
end
|
646
573
|
|
647
|
-
|
648
574
|
# Fire an event of the specified +event_type+, passing it an the given +args+
|
649
575
|
# to any registered handlers.
|
650
576
|
def notify(event_type, *args)
|
@@ -653,6 +579,8 @@ module NewRelic
|
|
653
579
|
NewRelic::Agent.logger.debug "Ignoring exception during %p event notification" % [event_type]
|
654
580
|
end
|
655
581
|
|
582
|
+
# @!group Manual browser monitoring configuration
|
583
|
+
|
656
584
|
# This method returns a string suitable for inclusion in a page - known as
|
657
585
|
# 'manual instrumentation' for Real User Monitoring. Can return either a
|
658
586
|
# script tag with associated javascript, or in the case of disabled Real
|
@@ -671,6 +599,10 @@ module NewRelic
|
|
671
599
|
agent.javascript_instrumentor.browser_timing_header
|
672
600
|
end
|
673
601
|
|
602
|
+
# @!endgroup
|
603
|
+
|
604
|
+
# @!group Deprecated methods
|
605
|
+
|
674
606
|
# In previous agent releases, this method was required for manual RUM
|
675
607
|
# instrumentation. That work is now all done by the browser_timing_header
|
676
608
|
# method, but this is left for compatibility.
|
@@ -682,6 +614,89 @@ module NewRelic
|
|
682
614
|
""
|
683
615
|
end
|
684
616
|
|
617
|
+
ADD_CUSTOM_ATTRIBUTES = "NewRelic::Agent.add_custom_attributes".freeze
|
618
|
+
ADD_CUSTOM_PARAMETERS = "NewRelic::Agent.add_custom_parameters".freeze
|
619
|
+
ADD_REQUEST_PARAMETERS = "NewRelic::Agent.add_request_parameters".freeze
|
620
|
+
SET_USER_ATTRIBUTES = "NewRelic::Agent.set_user_attributes".freeze
|
621
|
+
|
622
|
+
# Deprecated. Use add_custom_attributes instead.
|
623
|
+
#
|
624
|
+
# @deprecated
|
625
|
+
# @api public
|
626
|
+
#
|
627
|
+
def add_custom_parameters(*args)
|
628
|
+
NewRelic::Agent::Deprecator.deprecate(ADD_CUSTOM_PARAMETERS, ADD_CUSTOM_ATTRIBUTES)
|
629
|
+
add_custom_attributes(*args)
|
630
|
+
end
|
631
|
+
|
632
|
+
# Deprecated. Use add_custom_attributes instead.
|
633
|
+
#
|
634
|
+
# @deprecated
|
635
|
+
# @api public
|
636
|
+
#
|
637
|
+
def add_request_parameters(*args)
|
638
|
+
NewRelic::Agent::Deprecator.deprecate(ADD_REQUEST_PARAMETERS, ADD_CUSTOM_ATTRIBUTES)
|
639
|
+
add_custom_attributes(*args)
|
640
|
+
end
|
641
|
+
|
642
|
+
# Deprecated. Use add_custom_attributes instead.
|
643
|
+
#
|
644
|
+
# @deprecated
|
645
|
+
# @api public
|
646
|
+
#
|
647
|
+
def set_user_attributes(*args)
|
648
|
+
NewRelic::Agent::Deprecator.deprecate(SET_USER_ATTRIBUTES, ADD_CUSTOM_ATTRIBUTES)
|
649
|
+
add_custom_attributes(*args)
|
650
|
+
end
|
651
|
+
|
652
|
+
# Get or create a statistics gatherer that will aggregate numerical data
|
653
|
+
# under a metric name.
|
654
|
+
#
|
655
|
+
# +metric_name+ should follow a slash separated path convention. Application
|
656
|
+
# specific metrics should begin with "Custom/".
|
657
|
+
#
|
658
|
+
# Return a NewRelic::Agent::Stats that accepts data
|
659
|
+
# via calls to add_data_point(value).
|
660
|
+
#
|
661
|
+
# This method is deprecated in favor of record_metric and increment_metric,
|
662
|
+
# and is not thread-safe.
|
663
|
+
#
|
664
|
+
# @api public
|
665
|
+
# @deprecated
|
666
|
+
#
|
667
|
+
def get_stats(metric_name, use_scope=false)
|
668
|
+
agent.stats_engine.get_stats(metric_name, use_scope)
|
669
|
+
end
|
670
|
+
|
671
|
+
alias get_stats_no_scope get_stats
|
672
|
+
|
673
|
+
# Deprecated in favor of drop_buffered_data
|
674
|
+
#
|
675
|
+
# @api public
|
676
|
+
# @deprecated
|
677
|
+
def reset_stats; drop_buffered_data; end
|
678
|
+
|
679
|
+
# Cancel the collection of the current transaction in progress, if
|
680
|
+
# any. Only affects the transaction started on this thread once
|
681
|
+
# it has started and before it has completed.
|
682
|
+
#
|
683
|
+
# This method has been deprecated in favor of ignore_transaction,
|
684
|
+
# which does what people expect this method to do.
|
685
|
+
#
|
686
|
+
# @api public
|
687
|
+
# @deprecated
|
688
|
+
#
|
689
|
+
def abort_transaction!
|
690
|
+
Transaction.abort_transaction!
|
691
|
+
end
|
692
|
+
|
693
|
+
# Remove after 5/9/15
|
694
|
+
def record_transaction(*args)
|
695
|
+
NewRelic::Agent.logger.warn('This method has been deprecated, please see https://docs.newrelic.com/docs/ruby/ruby-agent-api for current API documentation.')
|
696
|
+
end
|
697
|
+
|
698
|
+
# @!endgroup
|
699
|
+
|
685
700
|
def_delegator :'NewRelic::Agent::PipeChannelManager', :register_report_channel
|
686
701
|
end
|
687
702
|
end
|