newrelic_rpm 3.9.1.236 → 3.9.2.239
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +2 -4
- data/CHANGELOG +96 -2
- data/lib/new_relic/agent.rb +47 -4
- data/lib/new_relic/agent/agent.rb +51 -26
- data/lib/new_relic/agent/agent_logger.rb +4 -0
- data/lib/new_relic/agent/configuration.rb +2 -32
- data/lib/new_relic/agent/configuration/default_source.rb +153 -118
- data/lib/new_relic/agent/configuration/dotted_hash.rb +52 -0
- data/lib/new_relic/agent/configuration/environment_source.rb +1 -1
- data/lib/new_relic/agent/configuration/manager.rb +101 -2
- data/lib/new_relic/agent/configuration/manual_source.rb +17 -0
- data/lib/new_relic/agent/configuration/server_source.rb +12 -4
- data/lib/new_relic/agent/configuration/yaml_source.rb +46 -22
- data/lib/new_relic/agent/cross_app_monitor.rb +1 -1
- data/lib/new_relic/agent/cross_app_tracing.rb +1 -1
- data/lib/new_relic/agent/database/obfuscation_helpers.rb +55 -14
- data/lib/new_relic/agent/database/obfuscator.rb +22 -7
- data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +6 -8
- data/lib/new_relic/agent/error_collector.rb +24 -16
- data/lib/new_relic/agent/event_loop.rb +189 -0
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +8 -17
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +1 -1
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +17 -16
- data/lib/new_relic/agent/instrumentation/ignore_actions.rb +41 -0
- data/lib/new_relic/agent/instrumentation/merb/controller.rb +0 -11
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +0 -8
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +1 -9
- data/lib/new_relic/agent/instrumentation/rails4/action_controller.rb +0 -18
- data/lib/new_relic/agent/instrumentation/rubyprof.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sinatra.rb +12 -1
- data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +1 -1
- data/lib/new_relic/agent/method_tracer.rb +33 -39
- data/lib/new_relic/agent/new_relic_service.rb +35 -156
- data/lib/new_relic/agent/new_relic_service/encoders.rb +34 -0
- data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +50 -0
- data/lib/new_relic/agent/new_relic_service/marshaller.rb +52 -0
- data/lib/new_relic/agent/new_relic_service/pruby_marshaller.rb +52 -0
- data/lib/new_relic/agent/threading/backtrace_node.rb +1 -1
- data/lib/new_relic/agent/traced_method_stack.rb +16 -2
- data/lib/new_relic/agent/transaction.rb +0 -4
- data/lib/new_relic/collection_helper.rb +2 -2
- data/lib/new_relic/control/frameworks/rails.rb +3 -0
- data/lib/new_relic/control/instrumentation.rb +6 -2
- data/lib/new_relic/json_wrapper.rb +47 -25
- data/lib/new_relic/language_support.rb +0 -4
- data/lib/new_relic/latest_changes.rb +2 -2
- data/lib/new_relic/rack/developer_mode.rb +4 -3
- data/lib/new_relic/recipes/capistrano3.rb +2 -2
- data/lib/new_relic/recipes/capistrano_legacy.rb +1 -1
- data/lib/new_relic/timer_lib.rb +1 -1
- data/lib/new_relic/version.rb +2 -2
- data/lib/tasks/config.html.erb +28 -0
- data/lib/tasks/config.rake +134 -0
- data/lib/tasks/config.text.erb +7 -0
- data/lib/tasks/install.rake +0 -63
- data/newrelic.yml +7 -0
- data/test/active_record_fixtures.rb +4 -4
- data/test/agent_helper.rb +58 -18
- data/test/environments/lib/environments/runner.rb +1 -1
- data/test/environments/rails21/Gemfile +1 -1
- data/test/environments/rails21/config/boot.rb +1 -1
- data/test/environments/rails22/Gemfile +1 -1
- data/test/environments/rails22/config/boot.rb +1 -1
- data/test/environments/rails23/config/boot.rb +2 -2
- data/test/environments/rails30/Gemfile +1 -1
- data/test/environments/rails31/Gemfile +1 -1
- data/test/environments/rails32/Gemfile +1 -1
- data/test/environments/rails40/Gemfile +1 -1
- data/test/environments/rails41/Gemfile +1 -1
- data/test/fixtures/cross_agent_tests/labels.json +104 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/README.md +23 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/back_quoted_identifiers.mysql.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/back_quoted_identifiers.mysql.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/comment_delimiters_in_strings.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/comment_delimiters_in_strings.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/double_quoted_identifiers.postgres.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/double_quoted_identifiers.postgres.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_line_comment_in_string.obfuscated +2 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_line_comment_in_string.sql +2 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_line_comments_with_quotes.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_line_comments_with_quotes.sql +2 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_cstyle.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_cstyle.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_doubledash.obfuscated +2 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_doubledash.sql +2 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_hash.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/end_of_query_comment_hash.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/escape_string_constants.postgres.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/escape_string_constants.postgres.sql +4 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/malformed/unterminated_double_quoted_string.mysql.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/malformed/unterminated_single_quoted_string.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/mixed_comments_and_quotes.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/mixed_comments_and_quotes.sql +2 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/mixed_quotes_comments_and_newlines.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/mixed_quotes_comments_and_newlines.sql +4 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/mixed_quotes_end_of_line_comments.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/mixed_quotes_end_of_line_comments.sql +3 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/multiple_literal_types.mysql.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/multiple_literal_types.mysql.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/numbers_in_identifiers.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/numbers_in_identifiers.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/numeric_literals.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/numeric_literals.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/quote_delimiters_in_comments.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/quote_delimiters_in_comments.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_double_quoted.mysql.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_double_quoted.mysql.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_single_quoted.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_single_quoted.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_backslash_and_twin_single_quotes.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_backslash_and_twin_single_quotes.sql +4 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_double_quote.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_double_quote.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_newline.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_newline.sql +2 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_single_quote.mysql.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_embedded_single_quote.mysql.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_escaped_quotes.mysql.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_escaped_quotes.mysql.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_backslash.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_backslash.sql +4 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_backslash.mysql.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_backslash.mysql.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_backslash_single_quoted.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_backslash_single_quoted.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_quote.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_trailing_escaped_quote.sql +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_twin_single_quotes.obfuscated +1 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/string_with_twin_single_quotes.sql +1 -0
- data/test/multiverse/lib/multiverse/output_collector.rb +1 -1
- data/test/multiverse/lib/multiverse/runner.rb +1 -1
- data/test/multiverse/lib/multiverse/suite.rb +19 -4
- data/test/multiverse/suites/agent_only/audit_log_test.rb +1 -38
- data/test/multiverse/suites/agent_only/collector_exception_handling_test.rb +25 -35
- data/test/multiverse/suites/agent_only/config/newrelic.yml +2 -0
- data/test/multiverse/suites/agent_only/encoding_handling_test.rb +1 -0
- data/test/multiverse/suites/agent_only/harvest_timestamps_test.rb +1 -1
- data/test/multiverse/suites/agent_only/keepalive_test.rb +29 -0
- data/test/multiverse/suites/agent_only/labels_test.rb +89 -0
- data/test/multiverse/suites/agent_only/marshaling_test.rb +1 -3
- data/test/multiverse/suites/agent_only/service_timeout_test.rb +1 -1
- data/test/multiverse/suites/agent_only/start_up_test.rb +9 -1
- data/test/multiverse/suites/capistrano/config/deploy.rb +6 -2
- data/test/multiverse/suites/capistrano/deployment_test.rb +12 -4
- data/test/multiverse/suites/config_file_loading/config_file_loading_test.rb +29 -1
- data/test/multiverse/suites/curb/Envfile +6 -2
- data/test/multiverse/suites/datamapper/Envfile +0 -4
- data/test/multiverse/suites/deferred_instrumentation/Envfile +0 -4
- data/test/multiverse/suites/deferred_instrumentation/sinatra_test.rb +1 -1
- data/test/multiverse/suites/excon/Envfile +5 -4
- data/test/multiverse/suites/excon/excon_test.rb +1 -1
- data/test/multiverse/suites/httpclient/Envfile +0 -4
- data/test/multiverse/suites/marshalling/Envfile +12 -0
- data/test/multiverse/suites/marshalling/config/newrelic.yml +20 -0
- data/test/multiverse/suites/marshalling/marshalling_test.rb +60 -0
- data/test/multiverse/suites/mongo/helpers/mongo_operation_tests.rb +1 -1
- data/test/multiverse/suites/mongo/helpers/mongo_replica_set.rb +1 -1
- data/test/multiverse/suites/mongo/helpers/mongo_server.rb +4 -4
- data/test/multiverse/suites/padrino/Envfile +0 -5
- data/test/multiverse/suites/padrino/padrino_test.rb +1 -1
- data/test/multiverse/suites/rack/rack_auto_instrumentation_test.rb +1 -1
- data/test/multiverse/suites/rails/gc_instrumentation_test.rb +2 -1
- data/test/multiverse/suites/rails/ignore_test.rb +22 -0
- data/test/multiverse/suites/rails/rails2_app/config/boot.rb +2 -2
- data/test/multiverse/suites/rails/rails2_app/config/routes.rb +1 -0
- data/test/multiverse/suites/resque/Envfile +0 -4
- data/test/multiverse/suites/sequel/Envfile +0 -5
- data/test/multiverse/suites/sinatra/sinatra_classic_test.rb +1 -1
- data/test/multiverse/suites/sinatra/sinatra_modular_test.rb +1 -1
- data/test/multiverse/suites/sinatra/sinatra_test_cases.rb +22 -0
- data/test/multiverse/suites/typhoeus/Envfile +1 -4
- data/test/new_relic/agent/agent/start_worker_thread_test.rb +1 -13
- data/test/new_relic/agent/agent_logger_test.rb +11 -0
- data/test/new_relic/agent/agent_test.rb +43 -20
- data/test/new_relic/agent/audit_logger_test.rb +7 -3
- data/test/new_relic/agent/commands/thread_profiler_session_test.rb +0 -1
- data/test/new_relic/agent/commands/xray_session_collection_test.rb +1 -1
- data/test/new_relic/agent/configuration/dotted_hash_test.rb +53 -0
- data/test/new_relic/agent/configuration/manager_test.rb +99 -6
- data/test/new_relic/agent/configuration/manual_source_test.rb +18 -0
- data/test/new_relic/agent/configuration/orphan_configuration_test.rb +1 -1
- data/test/new_relic/agent/configuration/yaml_source_test.rb +8 -4
- data/test/new_relic/agent/database/sql_obfuscation_test.rb +76 -0
- data/test/new_relic/agent/database_test.rb +2 -38
- data/test/new_relic/agent/error_collector/notice_error_test.rb +21 -3
- data/test/new_relic/agent/error_collector_test.rb +15 -2
- data/test/new_relic/agent/event_loop_test.rb +202 -0
- data/test/new_relic/agent/instrumentation/active_record_helper_test.rb +4 -0
- data/test/new_relic/agent/instrumentation/controller_instrumentation_test.rb +283 -182
- data/test/new_relic/agent/method_tracer_test.rb +1 -2
- data/test/new_relic/agent/new_relic_service_test.rb +83 -27
- data/test/new_relic/agent/pipe_channel_manager_test.rb +6 -6
- data/test/new_relic/agent/rpm_agent_test.rb +1 -8
- data/test/new_relic/agent/sql_sampler_test.rb +10 -8
- data/test/new_relic/agent/threading/backtrace_service_test.rb +1 -1
- data/test/new_relic/agent/traced_method_stack_test.rb +45 -13
- data/test/new_relic/agent/transaction_sample_builder_test.rb +1 -2
- data/test/new_relic/agent/transaction_test.rb +3 -3
- data/test/new_relic/agent_test.rb +47 -8
- data/test/new_relic/collection_helper_test.rb +5 -5
- data/test/new_relic/control/instrumentation_test.rb +56 -0
- data/test/new_relic/control_test.rb +4 -3
- data/test/new_relic/fake_collector.rb +7 -2
- data/test/new_relic/http_client_test_cases.rb +4 -4
- data/test/new_relic/latest_changes_test.rb +3 -3
- data/test/new_relic/transaction_sample/segment_test.rb +0 -1
- data/test/new_relic/transaction_sample_test.rb +19 -2
- data/test/performance/lib/performance/runner.rb +4 -4
- data/test/performance/suites/marshalling.rb +46 -30
- data/test/performance/suites/sql_obfuscation.rb +30 -0
- data/test/test_helper.rb +1 -1
- data/ui/helpers/developer_mode_helper.rb +2 -2
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/java.rb +1 -1
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb +1 -1
- metadata +84 -3
- metadata.gz.sig +0 -0
- data/test/environments/rails23/config/environments/development.rb +0 -11
@@ -9,7 +9,7 @@ namespace :newrelic do
|
|
9
9
|
# notifies New Relic of a deployment
|
10
10
|
desc "Record a deployment in New Relic (newrelic.com)"
|
11
11
|
task :notice_deployment do
|
12
|
-
|
12
|
+
run_locally do
|
13
13
|
rails_env = fetch(:newrelic_rails_env, fetch(:rails_env, "production"))
|
14
14
|
|
15
15
|
require 'new_relic/cli/command.rb'
|
@@ -25,7 +25,7 @@ namespace :newrelic do
|
|
25
25
|
|
26
26
|
unless scm == :none
|
27
27
|
changelog ||= lookup_changelog
|
28
|
-
rev
|
28
|
+
rev ||= fetch(:current_revision)
|
29
29
|
end
|
30
30
|
|
31
31
|
new_revision = rev
|
data/lib/new_relic/timer_lib.rb
CHANGED
data/lib/new_relic/version.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
<% sections.each do |(section_key, section_name, section_description, configs)| %>
|
2
|
+
<h2 id="<%=section_key%>"><%=section_name%></h2>
|
3
|
+
|
4
|
+
<%= "<p>#{section_description}</p>" unless section_description.nil? %>
|
5
|
+
|
6
|
+
<dl class="clamshell-list">
|
7
|
+
<% configs.each do |config|%>
|
8
|
+
<!-- ********** <%= config[:key] %> ********** -->
|
9
|
+
<dt id="<%=config[:key]%>"><%=config[:key]%></dt>
|
10
|
+
<dd>
|
11
|
+
<table class="specs">
|
12
|
+
<tbody>
|
13
|
+
<tr>
|
14
|
+
<th>Type:</th>
|
15
|
+
<td><%=config[:type]%></td>
|
16
|
+
</tr>
|
17
|
+
<tr>
|
18
|
+
<th>Default:</th>
|
19
|
+
<td><%=config[:default]%></td>
|
20
|
+
</tr>
|
21
|
+
</tbody>
|
22
|
+
</table>
|
23
|
+
|
24
|
+
<p><%=config[:description]%></p>
|
25
|
+
</dd>
|
26
|
+
<% end %>
|
27
|
+
</dl>
|
28
|
+
<% end %>
|
@@ -0,0 +1,134 @@
|
|
1
|
+
namespace :newrelic do
|
2
|
+
namespace :config do
|
3
|
+
desc "Describe available New Relic configuration settings."
|
4
|
+
|
5
|
+
GENERAL = "general"
|
6
|
+
DISABLING = "disabling"
|
7
|
+
|
8
|
+
SECTION_DESCRIPTIONS = {
|
9
|
+
GENERAL => 'These settings are available for agent configuration. Some settings depend on your New Relic subscription level.',
|
10
|
+
DISABLING => 'These settings are available to disable different instrumentation during the agent startup.',
|
11
|
+
"transaction_tracer" => 'The <a href="/docs/apm/traces/transaction-traces/transaction-traces">transaction traces</a> feature collects detailed information on a selection of transactions, including a summary of the calling sequence, a breakdown of time spent, and a list of SQL queries and their query plans (on mysql and postgresql). Available features depend on your New Relic subscription level.',
|
12
|
+
"error_collector" => 'The agent will collect and report all uncaught exceptions. Several configuration options allow you to customize the error collection.',
|
13
|
+
"browser_monitoring" => "New Relic Browser's page load timing feature (sometimes referred to as real user monitoring or RUM) gives you insight into the performance real users are experiencing with your website. This is accomplished by measuring the time it takes for your users' browsers to download and render your web pages by injecting a small amount of JavaScript code into the header and footer of each page.",
|
14
|
+
"analytics_events" => 'New Relic Insights is a software analytics resource to gather and visualize data about your software and what it says about your business. With it you can quickly and easily create real-time dashboards to get immediate answers about end-user experiences, clickstreams, mobile activities, and server transactions.'
|
15
|
+
}
|
16
|
+
|
17
|
+
NAME_OVERRIDES = {
|
18
|
+
"slow_sql" => "Slow SQL",
|
19
|
+
"xray_session" => "X-Ray Session"
|
20
|
+
}
|
21
|
+
|
22
|
+
def output(format)
|
23
|
+
config_hash = build_config_hash
|
24
|
+
sections = flatten_config_hash(config_hash)
|
25
|
+
|
26
|
+
puts build_erb(format).result(binding)
|
27
|
+
end
|
28
|
+
|
29
|
+
def build_config_hash
|
30
|
+
sections = Hash.new {|hash, key| hash[key] = []}
|
31
|
+
NewRelic::Agent::Configuration::DEFAULTS.each do |key, value|
|
32
|
+
next unless value[:public]
|
33
|
+
|
34
|
+
section_key = GENERAL
|
35
|
+
section = key.to_s.match(/(.*)\.(.*)/)
|
36
|
+
|
37
|
+
if section
|
38
|
+
section_key = section[1]
|
39
|
+
key = section[2]
|
40
|
+
elsif key.to_s.match(/^disable_/)
|
41
|
+
section_key = DISABLING
|
42
|
+
key = key.to_s
|
43
|
+
end
|
44
|
+
|
45
|
+
sections[section_key] << {
|
46
|
+
:key => format_key(section_key, key),
|
47
|
+
:type => format_type(value[:type]),
|
48
|
+
:description => format_description(value),
|
49
|
+
:default => format_default_value(value)
|
50
|
+
}
|
51
|
+
end
|
52
|
+
sections
|
53
|
+
end
|
54
|
+
|
55
|
+
def flatten_config_hash(config_hash)
|
56
|
+
sections = []
|
57
|
+
sections << pluck(GENERAL, config_hash)
|
58
|
+
sections << pluck("transaction_tracer", config_hash)
|
59
|
+
sections << pluck("error_collector", config_hash)
|
60
|
+
sections << pluck("browser_monitoring", config_hash)
|
61
|
+
sections << pluck("analytics_events", config_hash)
|
62
|
+
sections.concat(config_hash.to_a.sort_by { |a| a.first})
|
63
|
+
|
64
|
+
add_data_to_sections(sections)
|
65
|
+
|
66
|
+
sections
|
67
|
+
end
|
68
|
+
|
69
|
+
def add_data_to_sections(sections)
|
70
|
+
sections.each do |section|
|
71
|
+
section_key = section[0]
|
72
|
+
section.insert(1, format_name(section_key))
|
73
|
+
section.insert(2, SECTION_DESCRIPTIONS[section_key])
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def format_key(section_key, key)
|
78
|
+
if section_key == GENERAL || section_key == DISABLING
|
79
|
+
key.to_s
|
80
|
+
else
|
81
|
+
"#{section_key}.#{key}"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def format_name(key)
|
86
|
+
name = NAME_OVERRIDES[key]
|
87
|
+
return name if name
|
88
|
+
|
89
|
+
key.split("_").
|
90
|
+
each { |fragment| fragment[0] = fragment[0].upcase }.
|
91
|
+
join(" ")
|
92
|
+
end
|
93
|
+
|
94
|
+
def format_type(type)
|
95
|
+
if type == NewRelic::Agent::Configuration::Boolean
|
96
|
+
"Boolean"
|
97
|
+
else
|
98
|
+
type
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def format_description(value)
|
103
|
+
description = value[:description]
|
104
|
+
description = "**DEPRECATED** #{description}" if value[:deprecated]
|
105
|
+
description
|
106
|
+
end
|
107
|
+
|
108
|
+
def format_default_value(spec)
|
109
|
+
if spec[:default].is_a?(Proc)
|
110
|
+
'(Dynamic)'
|
111
|
+
else
|
112
|
+
spec[:default].inspect
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def pluck(key, config_hash)
|
117
|
+
value = config_hash.delete(key)
|
118
|
+
[key, value]
|
119
|
+
end
|
120
|
+
|
121
|
+
def build_erb(format)
|
122
|
+
require 'erb'
|
123
|
+
path = File.join(File.dirname(__FILE__), "config.#{format}.erb")
|
124
|
+
template = File.read(File.expand_path(path))
|
125
|
+
ERB.new(template)
|
126
|
+
end
|
127
|
+
|
128
|
+
task :docs, [:format] => [] do |t, args|
|
129
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "new_relic", "agent", "configuration", "default_source.rb"))
|
130
|
+
format = args[:format] || "text"
|
131
|
+
output(format)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<% sections.each do |(section_key, section_name, section_description, configs)| %><% configs.each do |config|%>
|
2
|
+
<%=config[:key]%>
|
3
|
+
<%=config[:description]%>
|
4
|
+
|
5
|
+
Type: <%=config[:type]%>
|
6
|
+
Default: <%=config[:default]%>
|
7
|
+
------------------------------<% end %><% end %>
|
data/lib/tasks/install.rake
CHANGED
@@ -8,67 +8,4 @@ namespace :newrelic do
|
|
8
8
|
task :thanks do
|
9
9
|
puts "The Ruby agent team is grateful to Jim Weirich for his kindness and his code. He will be missed."
|
10
10
|
end
|
11
|
-
|
12
|
-
namespace :config do
|
13
|
-
desc "Describe available New Relic configuration settings."
|
14
|
-
|
15
|
-
def output_text
|
16
|
-
NewRelic::Agent::Configuration::DEFAULTS.each do |key, value|
|
17
|
-
if value[:public]
|
18
|
-
puts "Setting: #{key}"
|
19
|
-
if value[:type] == NewRelic::Agent::Configuration::Boolean
|
20
|
-
puts "Type: Boolean"
|
21
|
-
else
|
22
|
-
puts "Type: #{value[:type]}"
|
23
|
-
end
|
24
|
-
puts "Default: #{format_default_value(value)}"
|
25
|
-
|
26
|
-
puts 'Description: ' + value[:description]
|
27
|
-
puts "-" * (value[:description].length + 14)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def format_default_value(spec)
|
33
|
-
if spec[:default].is_a?(Proc)
|
34
|
-
'(Dynamic)'
|
35
|
-
else
|
36
|
-
spec[:default].inspect
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def output_html
|
41
|
-
puts "<table>"
|
42
|
-
puts "<thead>"
|
43
|
-
puts " <th>Setting</th>"
|
44
|
-
puts " <th style='width: 15%'>Type</th>"
|
45
|
-
puts " <th>Default</th>"
|
46
|
-
puts " <th>Description</th>"
|
47
|
-
puts "</thead>"
|
48
|
-
|
49
|
-
NewRelic::Agent::Configuration::DEFAULTS.each do |key, value|
|
50
|
-
if value[:public]
|
51
|
-
puts "<tr>"
|
52
|
-
puts " <td><a name='#{key}'></a>#{key}</td>"
|
53
|
-
puts " <td>#{value[:type].to_s.gsub("NewRelic::Agent::Configuration::", "")}</td>"
|
54
|
-
puts " <td>#{format_default_value(value)}</td>"
|
55
|
-
puts " <td>#{value[:description]}</td>"
|
56
|
-
puts "</tr>"
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
puts "</table>"
|
61
|
-
end
|
62
|
-
|
63
|
-
task :docs, [:format] => [] do |t, args|
|
64
|
-
require File.expand_path(File.join(File.dirname(__FILE__), "..", "new_relic", "agent", "configuration", "default_source.rb"))
|
65
|
-
|
66
|
-
format = args[:format]
|
67
|
-
if format.nil? || format == "text"
|
68
|
-
output_text
|
69
|
-
else
|
70
|
-
output_html
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
11
|
end
|
data/newrelic.yml
CHANGED
@@ -42,6 +42,13 @@ common: &default_settings
|
|
42
42
|
# - Ajax Service
|
43
43
|
# - All Services
|
44
44
|
#
|
45
|
+
# Caution: If you change this name, a new application will appear in the New
|
46
|
+
# Relic user interface with the new name, and data will stop reporting to the
|
47
|
+
# app with the old name.
|
48
|
+
#
|
49
|
+
# See https://newrelic.com/docs/site/renaming-applications for more details
|
50
|
+
# on renaming your New Relic applications.
|
51
|
+
#
|
45
52
|
app_name: <%= @app_name %>
|
46
53
|
|
47
54
|
# When "true", the agent collects performance data about your
|
@@ -16,7 +16,7 @@ module ActiveRecordFixtures
|
|
16
16
|
ActiveRecordFixtures::Order.teardown
|
17
17
|
begin
|
18
18
|
super
|
19
|
-
rescue
|
19
|
+
rescue
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -37,13 +37,13 @@ module ActiveRecordFixtures
|
|
37
37
|
|
38
38
|
def self.check_for_table
|
39
39
|
connection.table_exists?(self.table_name)
|
40
|
-
rescue
|
40
|
+
rescue
|
41
41
|
false
|
42
42
|
end
|
43
43
|
|
44
44
|
def self.teardown
|
45
45
|
def connection.log_info *args
|
46
|
-
super
|
46
|
+
super(*args)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -68,7 +68,7 @@ module ActiveRecordFixtures
|
|
68
68
|
end
|
69
69
|
def self.check_for_table
|
70
70
|
connection.table_exists?(self.table_name) && connection.table_exists?('orders_shipments')
|
71
|
-
rescue
|
71
|
+
rescue
|
72
72
|
false
|
73
73
|
end
|
74
74
|
|
data/test/agent_helper.rb
CHANGED
@@ -63,6 +63,42 @@ def assert_equal_unordered(left, right)
|
|
63
63
|
left.each { |element| assert_includes(right, element) }
|
64
64
|
end
|
65
65
|
|
66
|
+
def assert_audit_log_contains(audit_log_contents, needle)
|
67
|
+
# Original request bodies dumped to the log have symbol keys, but once
|
68
|
+
# they go through a dump/load, they're strings again, so we strip
|
69
|
+
# double-quotes and colons from the log, and the strings we searching for.
|
70
|
+
regex = /[:"]/
|
71
|
+
needle = needle.gsub(regex, '')
|
72
|
+
haystack = audit_log_contents.gsub(regex, '')
|
73
|
+
assert(haystack.include?(needle), "Expected log to contain '#{needle}'")
|
74
|
+
end
|
75
|
+
|
76
|
+
# Because we don't generate a strictly machine-readable representation of
|
77
|
+
# request bodies for the audit log, the transformation into strings is
|
78
|
+
# effectively one-way. This, combined with the fact that Hash traversal order
|
79
|
+
# is arbitrary in Ruby 1.8.x means that it's difficult to directly assert that
|
80
|
+
# some object graph made it into the audit log (due to different possible
|
81
|
+
# orderings of the key/value pairs in Hashes that were embedded in the request
|
82
|
+
# body). So, this method traverses an object graph and only makes assertions
|
83
|
+
# about the terminal (non-Array-or-Hash) nodes therein.
|
84
|
+
def assert_audit_log_contains_object(audit_log_contents, o, format)
|
85
|
+
case o
|
86
|
+
when Hash
|
87
|
+
o.each do |k,v|
|
88
|
+
assert_audit_log_contains_object(audit_log_contents, v, format)
|
89
|
+
assert_audit_log_contains_object(audit_log_contents, k, format)
|
90
|
+
end
|
91
|
+
when Array
|
92
|
+
o.each do |el|
|
93
|
+
assert_audit_log_contains_object(audit_log_contents, el, format)
|
94
|
+
end
|
95
|
+
when NilClass
|
96
|
+
assert_audit_log_contains(audit_log_contents, format == :json ? "null" : "nil")
|
97
|
+
else
|
98
|
+
assert_audit_log_contains(audit_log_contents, o.inspect)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
66
102
|
def compare_metrics(expected, actual)
|
67
103
|
actual.delete_if {|a| a.include?('GC/Transaction/') }
|
68
104
|
assert_equal(expected.to_a.sort, actual.to_a.sort, "extra: #{(actual - expected).to_a.inspect}; missing: #{(expected - actual).to_a.inspect}")
|
@@ -341,14 +377,9 @@ def find_all_segments_with_name_matching(transaction_sample, regexes)
|
|
341
377
|
matching_segments
|
342
378
|
end
|
343
379
|
|
344
|
-
def with_config(config_hash,
|
345
|
-
|
346
|
-
|
347
|
-
config = config_hash
|
348
|
-
else
|
349
|
-
config = NewRelic::Agent::Configuration::DottedHash.new(config_hash)
|
350
|
-
end
|
351
|
-
NewRelic::Agent.config.add_config_for_testing(config, opts[:level])
|
380
|
+
def with_config(config_hash, at_start=true)
|
381
|
+
config = NewRelic::Agent::Configuration::DottedHash.new(config_hash, true)
|
382
|
+
NewRelic::Agent.config.add_config_for_testing(config, at_start)
|
352
383
|
begin
|
353
384
|
yield
|
354
385
|
ensure
|
@@ -356,6 +387,12 @@ def with_config(config_hash, opts={})
|
|
356
387
|
end
|
357
388
|
end
|
358
389
|
|
390
|
+
def with_config_low_priority(config_hash)
|
391
|
+
with_config(config_hash, false) do
|
392
|
+
yield
|
393
|
+
end
|
394
|
+
end
|
395
|
+
|
359
396
|
def freeze_time(now=Time.now)
|
360
397
|
Time.stubs(:now).returns(now)
|
361
398
|
now
|
@@ -444,11 +481,7 @@ end
|
|
444
481
|
|
445
482
|
def with_array_logger(level=:info)
|
446
483
|
orig_logger = NewRelic::Agent.logger
|
447
|
-
config = {
|
448
|
-
:log_file_path => nil,
|
449
|
-
:log_file_name => nil,
|
450
|
-
:log_level => level,
|
451
|
-
}
|
484
|
+
config = { :log_level => level }
|
452
485
|
logdev = ArrayLogDevice.new
|
453
486
|
override_logger = Logger.new(logdev)
|
454
487
|
|
@@ -481,11 +514,7 @@ def with_ignore_error_filter(filter, &blk)
|
|
481
514
|
|
482
515
|
yield
|
483
516
|
ensure
|
484
|
-
|
485
|
-
NewRelic::Agent.instance.error_collector.clear_ignore_error_filter
|
486
|
-
else
|
487
|
-
NewRelic::Agent.ignore_error_filter(&original_filter)
|
488
|
-
end
|
517
|
+
NewRelic::Agent::ErrorCollector.ignore_error_filter = original_filter
|
489
518
|
end
|
490
519
|
|
491
520
|
def json_dump_and_encode(object)
|
@@ -496,6 +525,17 @@ def get_last_analytics_event
|
|
496
525
|
NewRelic::Agent.agent.instance_variable_get(:@request_sampler).samples.last
|
497
526
|
end
|
498
527
|
|
528
|
+
def swap_instance_method(target, method_name, new_method_implementation, &blk)
|
529
|
+
old_method_implementation = target.instance_method(method_name)
|
530
|
+
target.send(:define_method, method_name, new_method_implementation)
|
531
|
+
yield
|
532
|
+
rescue NameError => e
|
533
|
+
puts "Your target does not have the instance method #{method_name}"
|
534
|
+
puts e.inspect
|
535
|
+
ensure
|
536
|
+
target.send(:define_method, method_name, old_method_implementation)
|
537
|
+
end
|
538
|
+
|
499
539
|
def cross_agent_tests_dir
|
500
540
|
File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'cross_agent_tests'))
|
501
541
|
end
|