newrelic_rpm 3.6.5.130 → 3.6.6.147
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +27 -3
- data/Gemfile +1 -14
- data/Rakefile +15 -5
- data/config.dot +1 -1
- data/lib/new_relic/agent/agent.rb +15 -0
- data/lib/new_relic/agent/agent_logger.rb +19 -14
- data/lib/new_relic/agent/configuration/defaults.rb +4 -3
- data/lib/new_relic/agent/configuration/environment_source.rb +6 -4
- data/lib/new_relic/agent/configuration/manager.rb +7 -2
- data/lib/new_relic/agent/configuration/mask_defaults.rb +1 -2
- data/lib/new_relic/agent/cross_app_monitor.rb +5 -4
- data/lib/new_relic/agent/cross_app_tracing.rb +0 -1
- data/lib/new_relic/agent/error_collector.rb +30 -1
- data/lib/new_relic/agent/http_clients/curb_wrappers.rb +67 -0
- data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +59 -0
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +12 -0
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +3 -3
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +3 -3
- data/lib/new_relic/agent/instrumentation/authlogic.rb +3 -3
- data/lib/new_relic/agent/instrumentation/curb.rb +179 -0
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +3 -3
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +35 -26
- data/lib/new_relic/agent/instrumentation/httpclient.rb +46 -0
- data/lib/new_relic/agent/instrumentation/merb/controller.rb +3 -3
- data/lib/new_relic/agent/instrumentation/puma.rb +23 -0
- data/lib/new_relic/agent/instrumentation/rack.rb +40 -0
- data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +4 -4
- data/lib/new_relic/agent/instrumentation/rails/errors.rb +0 -1
- data/lib/new_relic/agent/instrumentation/sequel.rb +0 -1
- data/lib/new_relic/agent/instrumentation/sunspot.rb +1 -1
- data/lib/new_relic/agent/internal_agent_error.rb +18 -0
- data/lib/new_relic/agent/new_relic_service.rb +2 -8
- data/lib/new_relic/agent/request_sampler.rb +4 -6
- data/lib/new_relic/agent/samplers/cpu_sampler.rb +0 -1
- data/lib/new_relic/agent/stats.rb +9 -0
- data/lib/new_relic/agent/stats_engine/stats_hash.rb +44 -6
- data/lib/new_relic/agent/system_info.rb +1 -1
- data/lib/new_relic/agent/thread_profiler.rb +6 -6
- data/lib/new_relic/agent/transaction.rb +1 -1
- data/lib/new_relic/agent/transaction_info.rb +0 -1
- data/lib/new_relic/agent/transaction_sample_builder.rb +6 -5
- data/lib/new_relic/agent/transaction_sampler.rb +1 -1
- data/lib/new_relic/commands/deployments.rb +6 -0
- data/lib/new_relic/commands/install.rb +2 -2
- data/lib/new_relic/control/frameworks/rails.rb +1 -2
- data/lib/new_relic/control/instrumentation.rb +2 -2
- data/lib/new_relic/control/server_methods.rb +1 -2
- data/lib/new_relic/delayed_job_injection.rb +0 -40
- data/lib/new_relic/helper.rb +0 -1
- data/lib/new_relic/latest_changes.rb +1 -1
- data/lib/new_relic/local_environment.rb +9 -4
- data/lib/new_relic/metric_spec.rb +19 -3
- data/lib/new_relic/noticed_error.rb +2 -1
- data/lib/new_relic/rack/agent_hooks.rb +0 -1
- data/lib/new_relic/rack/developer_mode.rb +1 -1
- data/lib/new_relic/rack/error_collector.rb +42 -21
- data/lib/new_relic/recipes.rb +0 -1
- data/lib/new_relic/transaction_analysis.rb +0 -1
- data/lib/new_relic/transaction_sample/segment.rb +4 -4
- data/lib/new_relic/version.rb +1 -1
- data/lib/sequel/extensions/newrelic_instrumentation.rb +6 -7
- data/lib/sequel/plugins/newrelic_instrumentation.rb +0 -1
- data/lib/tasks/install.rake +2 -2
- data/newrelic_rpm.gemspec +11 -1
- data/test/active_record_fixtures.rb +2 -2
- data/test/agent_helper.rb +46 -3
- data/test/config/newrelic.yml +2 -2
- data/test/multiverse/.gitignore +2 -0
- data/test/multiverse/lib/multiverse/envfile.rb +6 -9
- data/test/multiverse/lib/multiverse/environment.rb +0 -1
- data/test/multiverse/lib/multiverse/output_collector.rb +43 -11
- data/test/multiverse/lib/multiverse/runner.rb +37 -5
- data/test/multiverse/lib/multiverse/suite.rb +149 -67
- data/test/multiverse/script/run_one +4 -2
- data/test/multiverse/script/runner +1 -5
- data/test/multiverse/suites/active_record/Envfile +3 -2
- data/test/multiverse/suites/active_record/ar_method_aliasing.rb +13 -12
- data/test/multiverse/suites/active_record/config/newrelic.yml +0 -3
- data/test/multiverse/suites/agent_only/audit_log_test.rb +30 -34
- data/test/multiverse/suites/agent_only/before_suite.rb +7 -0
- data/test/multiverse/suites/agent_only/config/newrelic.yml +1 -7
- data/test/multiverse/suites/agent_only/cross_application_tracing_test.rb +12 -20
- data/test/multiverse/suites/agent_only/http_response_code_test.rb +16 -34
- data/test/multiverse/suites/agent_only/key_transactions_test.rb +18 -28
- data/test/multiverse/suites/agent_only/logging_test.rb +25 -49
- data/test/multiverse/suites/agent_only/marshaling_test.rb +30 -38
- data/test/multiverse/suites/agent_only/pipe_manager_test.rb +12 -6
- data/test/multiverse/suites/agent_only/rename_rule_test.rb +30 -38
- data/test/multiverse/suites/agent_only/rum_instrumentation_test.rb +16 -18
- data/test/multiverse/suites/agent_only/service_timeout_test.rb +6 -7
- data/test/multiverse/suites/agent_only/set_transaction_name_test.rb +26 -32
- data/test/multiverse/suites/agent_only/ssl_test.rb +10 -14
- data/test/multiverse/suites/agent_only/start_up_test.rb +1 -1
- data/test/multiverse/suites/agent_only/testing_app.rb +2 -0
- data/test/multiverse/suites/agent_only/thread_profiling_test.rb +23 -24
- data/test/multiverse/suites/config_file_loading/Envfile +6 -2
- data/test/multiverse/suites/config_file_loading/config_file_loading_test.rb +8 -4
- data/test/multiverse/suites/curb/Envfile +19 -0
- data/test/multiverse/suites/curb/config/newrelic.yml +19 -0
- data/test/multiverse/suites/curb/curb_test.rb +195 -0
- data/test/multiverse/suites/datamapper/Envfile +2 -0
- data/test/multiverse/suites/datamapper/config/newrelic.yml +0 -2
- data/test/multiverse/suites/datamapper/datamapper_test.rb +6 -10
- data/test/multiverse/suites/deferred_instrumentation/Envfile +19 -0
- data/test/multiverse/suites/deferred_instrumentation/config/newrelic.yml +22 -0
- data/test/multiverse/suites/deferred_instrumentation/sinatra_test.rb +103 -0
- data/test/multiverse/suites/excon/config/newrelic.yml +0 -2
- data/test/multiverse/suites/excon/excon_test.rb +3 -3
- data/test/multiverse/suites/httpclient/Envfile +15 -0
- data/test/multiverse/suites/httpclient/config/newrelic.yml +19 -0
- data/test/multiverse/suites/httpclient/httpclient_test.rb +70 -0
- data/test/multiverse/suites/net_http/config/newrelic.yml +0 -2
- data/test/multiverse/suites/net_http/net_http_test.rb +9 -4
- data/test/multiverse/suites/padrino/Envfile +2 -0
- data/test/multiverse/suites/padrino/config/newrelic.yml +0 -3
- data/test/multiverse/suites/padrino/padrino_test.rb +5 -4
- data/test/multiverse/suites/rails/Envfile +3 -0
- data/test/multiverse/suites/rails/app.rb +1 -0
- data/test/multiverse/suites/rails/bad_instrumentation_test.rb +31 -0
- data/test/multiverse/suites/rails/config/newrelic.yml +2 -3
- data/test/multiverse/suites/rails/error_tracing_test.rb +32 -41
- data/test/multiverse/suites/rails/gc_instrumentation_test.rb +6 -16
- data/test/multiverse/suites/rails/queue_time_test.rb +4 -20
- data/test/multiverse/suites/rails/request_statistics_test.rb +7 -32
- data/test/multiverse/suites/rails/view_instrumentation_test.rb +6 -10
- data/test/multiverse/suites/resque/config/newrelic.yml +1 -3
- data/test/multiverse/suites/resque/instrumentation_test.rb +10 -7
- data/test/multiverse/suites/sequel/Envfile +8 -0
- data/test/multiverse/suites/sequel/config/newrelic.yml +0 -3
- data/test/multiverse/suites/sequel/sequel_test.rb +1 -2
- data/test/multiverse/suites/sidekiq/Envfile +0 -12
- data/test/multiverse/suites/sidekiq/config/newrelic.yml +1 -3
- data/test/multiverse/suites/sidekiq/sidekiq_instrumentation_test.rb +44 -100
- data/test/multiverse/suites/sinatra/config/newrelic.yml +0 -3
- data/test/multiverse/suites/sinatra/ignoring_test.rb +8 -5
- data/test/multiverse/suites/sinatra/sinatra_classic_test.rb +8 -1
- data/test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb +9 -12
- data/test/multiverse/suites/sinatra/sinatra_metric_explosion_test.rb +9 -8
- data/test/multiverse/suites/sinatra/sinatra_modular_test.rb +1 -1
- data/test/multiverse/suites/sinatra/sinatra_routes_test.rb +6 -5
- data/test/multiverse/suites/sinatra/sinatra_test_cases.rb +10 -13
- data/test/multiverse/suites/typhoeus/config/newrelic.yml +0 -2
- data/test/multiverse/suites/typhoeus/typhoeus_test.rb +7 -4
- data/test/multiverse/test/suite_examples/one/a/a_test.rb +0 -1
- data/test/multiverse/test/suite_examples/one/a/config/newrelic.yml +0 -1
- data/test/multiverse/test/suite_examples/one/b/b_test.rb +0 -1
- data/test/multiverse/test/suite_examples/one/b/config/newrelic.yml +0 -1
- data/test/new_relic/agent/agent/connect_test.rb +1 -1
- data/test/new_relic/agent/agent/start_test.rb +0 -1
- data/test/new_relic/agent/agent/start_worker_thread_test.rb +0 -1
- data/test/new_relic/agent/agent_logger_test.rb +37 -3
- data/test/new_relic/agent/agent_test.rb +23 -1
- data/test/new_relic/agent/browser_monitoring_test.rb +0 -1
- data/test/new_relic/agent/busy_calculator_test.rb +2 -2
- data/test/new_relic/agent/configuration/environment_source_test.rb +22 -0
- data/test/new_relic/agent/error_collector/notice_error_test.rb +1 -1
- data/test/new_relic/agent/error_collector_test.rb +95 -13
- data/test/new_relic/agent/event_listener_test.rb +0 -1
- data/test/new_relic/agent/instrumentation/active_record_instrumentation_test.rb +23 -0
- data/test/new_relic/agent/instrumentation/active_record_subscriber_test.rb +4 -2
- data/test/new_relic/agent/instrumentation/instrumentation_test.rb +0 -1
- data/test/new_relic/agent/instrumentation/queue_time_test.rb +16 -11
- data/test/new_relic/agent/instrumentation/rack_test.rb +0 -1
- data/test/new_relic/agent/memcache_instrumentation_test.rb +7 -7
- data/test/{multiverse/suites/agent_only/test_trace_method_with_punctuation.rb → new_relic/agent/method_interrobang_test.rb} +3 -5
- data/test/new_relic/agent/method_tracer/instance_methods/trace_execution_scoped_test.rb +1 -2
- data/test/{multiverse/suites/agent_only → new_relic/agent}/method_visibility_test.rb +17 -29
- data/test/new_relic/agent/new_relic_service_test.rb +1 -1
- data/test/new_relic/agent/pipe_service_test.rb +1 -1
- data/test/new_relic/agent/request_sampler_test.rb +10 -10
- data/test/new_relic/agent/rpm_agent_test.rb +1 -2
- data/test/new_relic/agent/stats_hash_test.rb +83 -5
- data/test/new_relic/agent/stats_test.rb +0 -1
- data/test/new_relic/agent/thread_profiler_test.rb +7 -7
- data/test/new_relic/agent/threaded_test.rb +1 -2
- data/test/new_relic/agent/transaction/pop_test.rb +0 -1
- data/test/{multiverse/suites/agent_only/test_trace_transaction_with_punctuation.rb → new_relic/agent/transaction_interrobang_test.rb} +2 -4
- data/test/new_relic/agent/transaction_sample_builder_test.rb +13 -0
- data/test/new_relic/agent/transaction_test.rb +7 -5
- data/test/new_relic/agent/worker_loop_test.rb +0 -1
- data/test/new_relic/agent_test.rb +0 -27
- data/test/new_relic/collection_helper_test.rb +17 -17
- data/test/new_relic/control/class_methods_test.rb +1 -1
- data/test/new_relic/control_test.rb +6 -6
- data/test/new_relic/dependency_detection_test.rb +28 -0
- data/test/new_relic/evil_server.rb +0 -1
- data/test/new_relic/fake_collector.rb +20 -2
- data/test/new_relic/fake_server.rb +0 -12
- data/test/new_relic/http_client_test_cases.rb +20 -24
- data/test/new_relic/metric_spec_test.rb +18 -0
- data/test/new_relic/multiverse_helpers.rb +164 -0
- data/test/new_relic/rack/agent_hooks_test.rb +0 -1
- data/test/new_relic/rack/all_test.rb +0 -1
- data/test/new_relic/rack/deferred_instrumentation_test.rb +35 -0
- data/test/new_relic/rack/developer_mode_helper_test.rb +8 -9
- data/test/new_relic/rack/developer_mode_test.rb +0 -2
- data/test/new_relic/rack/error_collector_test.rb +52 -8
- data/test/new_relic/transaction_sample/composite_segment_test.rb +0 -1
- data/test/new_relic/transaction_sample/fake_segment_test.rb +0 -1
- data/test/new_relic/transaction_sample/segment_test.rb +0 -1
- data/test/new_relic/transaction_sample/summary_segment_test.rb +0 -1
- data/test/performance/README.md +162 -0
- data/test/performance/lib/performance.rb +28 -0
- data/test/performance/lib/performance/console_reporter.rb +51 -0
- data/test/performance/lib/performance/hako_client.rb +31 -0
- data/test/performance/lib/performance/hako_reporter.rb +26 -0
- data/test/performance/lib/performance/instrumentation/cpu_usage.rb +26 -0
- data/test/performance/lib/performance/instrumentation/gc_stats.rb +53 -0
- data/test/performance/lib/performance/instrumentation/perf_tools.rb +30 -0
- data/test/performance/lib/performance/instrumentor.rb +110 -0
- data/test/performance/lib/performance/json_reporter.rb +15 -0
- data/test/performance/lib/performance/result.rb +80 -0
- data/test/performance/lib/performance/runner.rb +207 -0
- data/test/performance/lib/performance/test_case.rb +65 -0
- data/test/performance/lib/performance/timer.rb +38 -0
- data/test/performance/script/mega-runner +37 -0
- data/test/performance/script/runner +81 -0
- data/test/performance/suites/startup.rb +12 -0
- data/test/performance/suites/transaction_tracing.rb +66 -0
- data/test/script/ci_agent-tests_runner.sh +4 -4
- data/test/script/ci_multiverse_runner.sh +3 -3
- data/test/test_helper.rb +0 -11
- data/ui/helpers/developer_mode_helper.rb +1 -1
- data/ui/views/layouts/newrelic_default.rhtml +1 -1
- data/ui/views/newrelic/_segment.rhtml +2 -2
- data/ui/views/newrelic/_segment_limit_message.rhtml +1 -1
- data/ui/views/newrelic/_show_sample_detail.rhtml +1 -1
- data/ui/views/newrelic/_show_sample_sql.rhtml +4 -4
- data/ui/views/newrelic/_stack_trace.rhtml +2 -2
- data/ui/views/newrelic/file/javascript/transaction_sample.js +3 -3
- data/ui/views/newrelic/file/stylesheets/style.css +13 -13
- data/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb +18 -4
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/metric_parser.rb +0 -1
- metadata +186 -17
- metadata.gz.sig +0 -0
- data/test/multiverse/suites/active_record/encoding_test.rb +0 -30
- data/test/multiverse/suites/agent_only/no_dns_resolv.rb +0 -21
- data/test/multiverse/suites/sidekiq/app.rb +0 -25
- data/test/new_relic/delayed_job_injection_test.rb +0 -25
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
# New Relic Ruby Agent Release Notes #
|
2
2
|
|
3
|
+
## v3.6.6 ##
|
4
|
+
|
5
|
+
* HTTPClient and Curb support
|
6
|
+
|
7
|
+
The Ruby agent now supports the HTTPClient and Curb HTTP libraries! Cross
|
8
|
+
application tracing and more is fully supported for these libraries. For more
|
9
|
+
details see https://newrelic.com/docs/ruby/ruby-http-clients.
|
10
|
+
|
11
|
+
* Sinatra startup improvements
|
12
|
+
|
13
|
+
In earlier agent versions, newrelic_rpm had to be required after Sinatra to
|
14
|
+
get instrumentation. Now the agent should start when your Sinatra app starts
|
15
|
+
up in rackup, thin, unicorn, or similar web servers.
|
16
|
+
|
17
|
+
* Puma clustered mode support
|
18
|
+
|
19
|
+
Clustered mode in Puma was not reporting data without manually adding a hook
|
20
|
+
to Puma's configuration. The agent will now automatically add this hook.
|
21
|
+
|
22
|
+
* SSL certificate verification
|
23
|
+
|
24
|
+
Early versions of the agent's SSL support provided an option to skip
|
25
|
+
certificate verification. This option has been removed.
|
26
|
+
|
3
27
|
## v3.6.5 ##
|
4
28
|
|
5
29
|
* Rails 4.0 Support
|
@@ -121,8 +145,8 @@
|
|
121
145
|
|
122
146
|
* Added NewRelic::Agent.set_transaction_name and NewRelic::Agent.get_transaction_name
|
123
147
|
|
124
|
-
Ordinarily the name of your transaction is defined up-front, but if you'd like to
|
125
|
-
change the name of a transaction while it is still running you can use
|
148
|
+
Ordinarily the name of your transaction is defined up-front, but if you'd like to
|
149
|
+
change the name of a transaction while it is still running you can use
|
126
150
|
**NewRelic::Agent.set_transaction_name()**. Similarly, if you need to know the name
|
127
151
|
of the currently running transaction, you can use **NewRelic::Agent.get_transaction_name()**.
|
128
152
|
|
@@ -274,7 +298,7 @@
|
|
274
298
|
The agent can now log all of the data it sends to the New Relic servers to
|
275
299
|
a special log file for human inspection. This feature is off by default, and
|
276
300
|
can be enabled by setting the audit_log.enabled configuration key to true.
|
277
|
-
You may also control the location of the audit log with the audit_log.path key.
|
301
|
+
You may also control the location of the audit log with the audit_log.path key.
|
278
302
|
|
279
303
|
* Use config system for dispatcher, framework, and config file detection
|
280
304
|
|
data/Gemfile
CHANGED
@@ -1,16 +1,3 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
|
4
|
-
# require 0.9.6.
|
5
|
-
# There's problems with the test task in rake 10
|
6
|
-
# https://github.com/jimweirich/rake/issues/144
|
7
|
-
gem 'rake', '0.9.6'
|
8
|
-
gem 'mocha', '~>0.13.0', :require => false
|
9
|
-
gem 'sdoc-helpers'
|
10
|
-
gem 'rdoc', '>= 2.4.2'
|
11
|
-
gem 'rails', '~>3.2.13'
|
12
|
-
gem 'sqlite3', :platform => 'mri'
|
13
|
-
gem 'activerecord-jdbcsqlite3-adapter', :platform => 'jruby'
|
14
|
-
gem 'jruby-openssl', :platform => 'jruby'
|
15
|
-
gem 'sequel', '~> 3.46.0'
|
16
|
-
end
|
3
|
+
gemspec
|
data/Rakefile
CHANGED
@@ -22,12 +22,13 @@ namespace :test do
|
|
22
22
|
agent_home = File.expand_path(File.dirname(__FILE__))
|
23
23
|
|
24
24
|
desc "Run functional test suite for newrelic"
|
25
|
-
task :multiverse, [:suite, :
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
task :multiverse, [:suite, :param1, :param2, :param3, :param4] => [] do |t, args|
|
26
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'test', 'multiverse', 'lib', 'multiverse', 'environment'))
|
27
|
+
opts = Multiverse::Runner.parse_args(args)
|
28
|
+
if opts.key?(:run_one)
|
29
|
+
Multiverse::Runner.run_one(args.suite, opts)
|
29
30
|
else
|
30
|
-
|
31
|
+
Multiverse::Runner.run(args.suite, opts)
|
31
32
|
end
|
32
33
|
end
|
33
34
|
|
@@ -39,6 +40,15 @@ namespace :test do
|
|
39
40
|
ruby test_files.join(" ")
|
40
41
|
end
|
41
42
|
|
43
|
+
desc "Run agent performance tests"
|
44
|
+
task :performance, [:suite, :name] => [] do |t, args|
|
45
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'test', 'performance', 'lib', 'performance'))
|
46
|
+
options = {}
|
47
|
+
options[:suite] = args[:suite] if args[:suite]
|
48
|
+
options[:name] = args[:name] if args[:name]
|
49
|
+
Performance::Runner.new(options).run_and_report
|
50
|
+
end
|
51
|
+
|
42
52
|
Rake::TestTask.new(:intentional_fail) do |t|
|
43
53
|
t.libs << "#{agent_home}/test"
|
44
54
|
t.libs << "#{agent_home}/lib"
|
data/config.dot
CHANGED
@@ -155,7 +155,7 @@ digraph AgentEnabled {
|
|
155
155
|
"Control#init_plugin" -> "[agent_enabled]"
|
156
156
|
"Control#init_plugin" -> "Control#setup_log"
|
157
157
|
"Control#init_plugin" -> "[disable_samplers]"
|
158
|
-
"Control#should_log?" -> "[agent_enabled]"
|
158
|
+
"Control#should_log?" -> "[agent_enabled]"
|
159
159
|
"Control#api_server" -> "[api_host]"
|
160
160
|
"Control#api_server" -> "[api_port]"
|
161
161
|
"Control#proxy_server" -> "[proxy_host]"
|
@@ -474,11 +474,20 @@ module NewRelic
|
|
474
474
|
|
475
475
|
include Start
|
476
476
|
|
477
|
+
def defer_for_delayed_job?
|
478
|
+
NewRelic::Agent.config[:dispatcher] == :delayed_job &&
|
479
|
+
!NewRelic::DelayedJobInjection.worker_name
|
480
|
+
end
|
477
481
|
|
478
482
|
# Check to see if the agent should start, returning +true+ if it should.
|
479
483
|
def agent_should_start?
|
480
484
|
return false if already_started? || disabled?
|
481
485
|
|
486
|
+
if defer_for_delayed_job?
|
487
|
+
::NewRelic::Agent.logger.debug "Deferring startup for DelayedJob"
|
488
|
+
return false
|
489
|
+
end
|
490
|
+
|
482
491
|
if defer_for_resque?
|
483
492
|
::NewRelic::Agent.logger.debug "Deferring startup for Resque in case it daemonizes"
|
484
493
|
return false
|
@@ -635,6 +644,12 @@ module NewRelic
|
|
635
644
|
#
|
636
645
|
# See #connect for a description of connection_options.
|
637
646
|
def start_worker_thread(connection_options = {})
|
647
|
+
disable = NewRelic::Agent.config[:disable_harvest_thread]
|
648
|
+
if disable
|
649
|
+
NewRelic::Agent.logger.info "Not starting Ruby Agent worker thread because :disable_harvest_thread is #{disable}"
|
650
|
+
return
|
651
|
+
end
|
652
|
+
|
638
653
|
::NewRelic::Agent.logger.debug "Creating Ruby Agent worker thread."
|
639
654
|
@worker_thread = NewRelic::Agent::AgentThread.new('Worker Loop') do
|
640
655
|
deferred_work!(connection_options)
|
@@ -41,24 +41,29 @@ module NewRelic
|
|
41
41
|
false
|
42
42
|
end
|
43
43
|
|
44
|
-
#
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
44
|
+
# Use this when you want to log an exception with explicit control over
|
45
|
+
# the log level that the backtrace is logged at. If you just want the
|
46
|
+
# default behavior of backtraces logged at debug, use one of the methods
|
47
|
+
# above and pass an Exception as one of the args.
|
48
|
+
def log_exception(level, e, backtrace_level=level)
|
49
|
+
@log.send(level, "%p: %s" % [ e.class, e.message ])
|
50
|
+
@log.send(backtrace_level) do
|
51
|
+
backtrace = e.backtrace
|
52
|
+
if backtrace
|
53
|
+
"Debugging backtrace:\n" + backtrace.join("\n ")
|
51
54
|
else
|
52
|
-
|
55
|
+
"No backtrace available."
|
53
56
|
end
|
54
57
|
end
|
58
|
+
end
|
55
59
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
@log.
|
60
|
+
# Allows for passing exceptions in explicitly, which format with backtrace
|
61
|
+
def format_and_send(level, *msgs)
|
62
|
+
msgs.flatten.each do |item|
|
63
|
+
case item
|
64
|
+
when Exception then log_exception(level, item, :debug)
|
65
|
+
else @log.send(level, item)
|
66
|
+
end
|
62
67
|
end
|
63
68
|
end
|
64
69
|
|
@@ -39,7 +39,7 @@ module NewRelic
|
|
39
39
|
when 4
|
40
40
|
:rails4
|
41
41
|
else
|
42
|
-
::NewRelic::Agent
|
42
|
+
::NewRelic::Agent.logger.error "Detected unsupported Rails version #{Rails::VERSION::STRING}"
|
43
43
|
end
|
44
44
|
when defined?(::Sinatra) && defined?(::Sinatra::Base) then :sinatra
|
45
45
|
when defined?(::NewRelic::IA) then :external
|
@@ -61,7 +61,7 @@ module NewRelic
|
|
61
61
|
:'autostart.blacklisted_constants' => 'Rails::Console',
|
62
62
|
# Comma separated list of executables that you don't want to trigger
|
63
63
|
# agents start. e.g. 'rake,my_ruby_script.rb'
|
64
|
-
:'autostart.blacklisted_executables' => 'irb',
|
64
|
+
:'autostart.blacklisted_executables' => 'irb,rspec',
|
65
65
|
:'autostart.blacklisted_rake_tasks' => 'about,assets:clean,assets:clobber,assets:environment,assets:precompile,db:create,db:drop,db:fixtures:load,db:migrate,db:migrate:status,db:rollback,db:schema:cache:clear,db:schema:cache:dump,db:schema:dump,db:schema:load,db:seed,db:setup,db:structure:dump,db:version,doc:app,log:clear,middleware,notes,notes:custom,rails:template,rails:update,routes,secret,spec,spec:controllers,spec:helpers,spec:models,spec:rcov,stats,test,test:all,test:all:db,test:recent,test:single,test:uncommitted,time:zones:all,tmp:clear,tmp:create',
|
66
66
|
:developer_mode => Proc.new { self[:developer] },
|
67
67
|
:developer => false,
|
@@ -80,7 +80,6 @@ module NewRelic
|
|
80
80
|
:port => Proc.new { self[:ssl] ? 443 : 80 },
|
81
81
|
:api_port => Proc.new { self[:port] },
|
82
82
|
:ssl => true,
|
83
|
-
:verify_certificate => true,
|
84
83
|
:sync_startup => false,
|
85
84
|
:send_data_on_exit => true,
|
86
85
|
:post_size_limit => 2 * 1024 * 1024, # 2 megs
|
@@ -108,11 +107,13 @@ module NewRelic
|
|
108
107
|
:disable_sinatra_auto_middleware => false,
|
109
108
|
:disable_view_instrumentation => false,
|
110
109
|
:disable_backtrace_cleanup => false,
|
110
|
+
:disable_harvest_thread => false,
|
111
111
|
:skip_ar_instrumentation => false,
|
112
112
|
:disable_activerecord_instrumentation => Proc.new { self[:skip_ar_instrumentation] },
|
113
113
|
:disable_memcache_instrumentation => false,
|
114
114
|
:disable_mobile_headers => true,
|
115
115
|
|
116
|
+
:capture_params => false,
|
116
117
|
:capture_memcache_keys => false,
|
117
118
|
:textmate => false,
|
118
119
|
|
@@ -29,10 +29,12 @@ module NewRelic
|
|
29
29
|
end
|
30
30
|
|
31
31
|
boolean_map = {
|
32
|
-
'NEWRELIC_ENABLE'
|
33
|
-
'NEWRELIC_ENABLED'
|
34
|
-
'NEW_RELIC_ENABLE'
|
35
|
-
'NEW_RELIC_ENABLED' => :agent_enabled
|
32
|
+
'NEWRELIC_ENABLE' => :agent_enabled,
|
33
|
+
'NEWRELIC_ENABLED' => :agent_enabled,
|
34
|
+
'NEW_RELIC_ENABLE' => :agent_enabled,
|
35
|
+
'NEW_RELIC_ENABLED' => :agent_enabled,
|
36
|
+
'NEWRELIC_DISABLE_HARVEST_THREAD' => :disable_harvest_thread,
|
37
|
+
'NEW_RELIC_DISABLE_HARVEST_THREAD' => :disable_harvest_thread
|
36
38
|
}.each do |key, val|
|
37
39
|
if ENV[key].to_s =~ /false|off|no/i
|
38
40
|
self[val] = false
|
@@ -18,8 +18,7 @@ module NewRelic
|
|
18
18
|
attr_reader :config_stack, :stripped_exceptions_whitelist
|
19
19
|
|
20
20
|
def initialize
|
21
|
-
|
22
|
-
@cache = Hash.new {|hash,key| hash[key] = self.fetch(key) }
|
21
|
+
reset_to_defaults
|
23
22
|
@callbacks = Hash.new {|hash,key| hash[key] = [] }
|
24
23
|
|
25
24
|
register_callback(:'strip_exception_messages.whitelist') do |whitelist|
|
@@ -145,6 +144,12 @@ module NewRelic
|
|
145
144
|
end
|
146
145
|
end
|
147
146
|
|
147
|
+
# Generally only useful during initial construction and tests
|
148
|
+
def reset_to_defaults
|
149
|
+
@config_stack = [ EnvironmentSource.new, DEFAULTS ]
|
150
|
+
reset_cache
|
151
|
+
end
|
152
|
+
|
148
153
|
def reset_cache
|
149
154
|
@cache = Hash.new {|hash,key| hash[key] = self.fetch(key) }
|
150
155
|
end
|
@@ -7,8 +7,7 @@ module NewRelic
|
|
7
7
|
module Configuration
|
8
8
|
MASK_DEFAULTS = {
|
9
9
|
:'thread_profiler' => Proc.new { !NewRelic::Agent::ThreadProfiler.is_supported? },
|
10
|
-
:'thread_profiler.enabled' => Proc.new { !NewRelic::Agent::ThreadProfiler.is_supported? }
|
11
|
-
:verify_certificate => Proc.new{ true }
|
10
|
+
:'thread_profiler.enabled' => Proc.new { !NewRelic::Agent::ThreadProfiler.is_supported? }
|
12
11
|
}
|
13
12
|
end
|
14
13
|
end
|
@@ -189,10 +189,12 @@ module NewRelic
|
|
189
189
|
# We expect to get the before call to set the id (if we have it) before
|
190
190
|
# this, and then write our custom parameter when the transaction starts
|
191
191
|
NewRelic::Agent.add_custom_parameters(:client_cross_process_id => client_cross_app_id()) if client_cross_app_id()
|
192
|
-
NewRelic::Agent.add_custom_parameters(:referring_transaction_guid => client_referring_transaction_guid()) if
|
193
|
-
client_referring_transaction_guid()
|
194
192
|
|
195
|
-
|
193
|
+
referring_guid = client_referring_transaction_guid()
|
194
|
+
if referring_guid
|
195
|
+
NewRelic::Agent.logger.debug "Referring transaction guid: %p" % [referring_guid]
|
196
|
+
NewRelic::Agent.add_custom_parameters(:referring_transaction_guid => referring_guid)
|
197
|
+
end
|
196
198
|
end
|
197
199
|
|
198
200
|
def set_error_custom_parameters(options)
|
@@ -237,4 +239,3 @@ module NewRelic
|
|
237
239
|
|
238
240
|
end
|
239
241
|
end
|
240
|
-
|
@@ -230,7 +230,7 @@ module NewRelic
|
|
230
230
|
# checks the size of the error queue to make sure we are under
|
231
231
|
# the maximum limit, and logs a warning if we are over the limit.
|
232
232
|
def over_queue_limit?(message)
|
233
|
-
over_limit = (@errors.length >= MAX_ERROR_QUEUE_LENGTH)
|
233
|
+
over_limit = (@errors.reject{|err| err.exception_class_constant < NewRelic::Agent::InternalAgentError}.length >= MAX_ERROR_QUEUE_LENGTH)
|
234
234
|
::NewRelic::Agent.logger.warn("The error reporting queue has reached #{MAX_ERROR_QUEUE_LENGTH}. The error detail for this and subsequent errors will not be transmitted to New Relic until the queued errors have been sent: #{message}") if over_limit
|
235
235
|
over_limit
|
236
236
|
end
|
@@ -272,6 +272,35 @@ module NewRelic
|
|
272
272
|
::NewRelic::Agent.logger.warn("Failure when capturing error '#{exception}':", e)
|
273
273
|
end
|
274
274
|
|
275
|
+
# *Use sparingly for difficult to track bugs.*
|
276
|
+
#
|
277
|
+
# Track internal agent errors for communication back to New Relic.
|
278
|
+
# To use, make a specific subclass of NewRelic::Agent::InternalAgentError,
|
279
|
+
# then pass an instance of it to this method when your problem occurs.
|
280
|
+
#
|
281
|
+
# Limits are treated differently for these errors. We only gather one per
|
282
|
+
# class per harvest, disregarding (and not impacting) the app error queue
|
283
|
+
# limit.
|
284
|
+
def notice_agent_error(exception)
|
285
|
+
return unless exception.class < NewRelic::Agent::InternalAgentError
|
286
|
+
|
287
|
+
# Log 'em all!
|
288
|
+
NewRelic::Agent.logger.info(exception)
|
289
|
+
|
290
|
+
@lock.synchronize do
|
291
|
+
# Already seen this class once? Bail!
|
292
|
+
return if @errors.any? { |err| err.exception_class_constant == exception.class }
|
293
|
+
|
294
|
+
trace = exception.backtrace || caller.dup
|
295
|
+
noticed_error = NewRelic::NoticedError.new("NewRelic/AgentError",
|
296
|
+
{:stack_trace => trace},
|
297
|
+
exception)
|
298
|
+
@errors << noticed_error
|
299
|
+
end
|
300
|
+
rescue => e
|
301
|
+
NewRelic::Agent.logger.info("Unable to capture internal agent error due to an exception:", e)
|
302
|
+
end
|
303
|
+
|
275
304
|
# Get the errors currently queued up. Unsent errors are left
|
276
305
|
# over from a previous unsuccessful attempt to send them to the server.
|
277
306
|
def harvest_errors(unsent_errors)
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# This file is distributed under New Relic's license terms.
|
3
|
+
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
|
+
|
5
|
+
module NewRelic
|
6
|
+
module Agent
|
7
|
+
module HTTPClients
|
8
|
+
|
9
|
+
class CurbRequest
|
10
|
+
def initialize( curlobj )
|
11
|
+
@curlobj = curlobj
|
12
|
+
end
|
13
|
+
|
14
|
+
def type
|
15
|
+
'Curb'
|
16
|
+
end
|
17
|
+
|
18
|
+
def host
|
19
|
+
self.uri.host
|
20
|
+
end
|
21
|
+
|
22
|
+
def method
|
23
|
+
@curlobj._nr_http_verb
|
24
|
+
end
|
25
|
+
|
26
|
+
def []( key )
|
27
|
+
@curlobj.headers[ key ]
|
28
|
+
end
|
29
|
+
|
30
|
+
def []=( key, value )
|
31
|
+
@curlobj.headers[ key ] = value
|
32
|
+
end
|
33
|
+
|
34
|
+
def uri
|
35
|
+
@uri ||= URI( @curlobj.url )
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
class CurbResponse
|
41
|
+
|
42
|
+
def initialize(curlobj)
|
43
|
+
@headers = {}
|
44
|
+
@curlobj = curlobj
|
45
|
+
end
|
46
|
+
|
47
|
+
def [](key)
|
48
|
+
@headers[ key.downcase ]
|
49
|
+
end
|
50
|
+
|
51
|
+
def to_hash
|
52
|
+
@headers.dup
|
53
|
+
end
|
54
|
+
|
55
|
+
def append_header_data( data )
|
56
|
+
key, value = data.split( /:\s*/, 2 )
|
57
|
+
@headers[ key.downcase ] = value
|
58
|
+
@curlobj._nr_header_str ||= ''
|
59
|
+
@curlobj._nr_header_str << data
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# This file is distributed under New Relic's license terms.
|
3
|
+
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
|
+
|
5
|
+
module NewRelic
|
6
|
+
module Agent
|
7
|
+
module HTTPClients
|
8
|
+
class HTTPClientResponse
|
9
|
+
attr_reader :response
|
10
|
+
|
11
|
+
def initialize(response)
|
12
|
+
@response = response
|
13
|
+
end
|
14
|
+
|
15
|
+
def [](key)
|
16
|
+
response.headers.each do |k,v|
|
17
|
+
if key.downcase == k.downcase
|
18
|
+
return v
|
19
|
+
end
|
20
|
+
end
|
21
|
+
nil
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_hash
|
25
|
+
response.headers
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class HTTPClientRequest
|
30
|
+
attr_reader :request, :uri
|
31
|
+
|
32
|
+
def initialize(request)
|
33
|
+
@request = request
|
34
|
+
@uri = request.header.request_uri
|
35
|
+
end
|
36
|
+
|
37
|
+
def type
|
38
|
+
"HTTPClient"
|
39
|
+
end
|
40
|
+
|
41
|
+
def method
|
42
|
+
request.header.request_method
|
43
|
+
end
|
44
|
+
|
45
|
+
def host
|
46
|
+
uri.host.to_s
|
47
|
+
end
|
48
|
+
|
49
|
+
def [](key)
|
50
|
+
request.headers[key]
|
51
|
+
end
|
52
|
+
|
53
|
+
def []=(key, value)
|
54
|
+
request.http_header[key] = value
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|