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
@@ -11,7 +11,6 @@ development:
|
|
11
11
|
app_name: test
|
12
12
|
host: 127.0.0.1
|
13
13
|
api_host: 127.0.0.1
|
14
|
-
port: <%= 30_000 + ($$ % 10_000) %>
|
15
14
|
transaction_tracer:
|
16
15
|
record_sql: obfuscated
|
17
16
|
enabled: true
|
@@ -19,4 +18,3 @@ development:
|
|
19
18
|
transaction_threshold: 1.0
|
20
19
|
capture_params: false
|
21
20
|
log_level: debug
|
22
|
-
log_file_path: agent.log
|
@@ -3,10 +3,9 @@
|
|
3
3
|
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'data_mapper'
|
6
|
-
require 'newrelic_rpm'
|
7
|
-
require 'test/unit'
|
8
6
|
|
9
7
|
require File.join(File.dirname(__FILE__), '..', '..', '..', 'agent_helper')
|
8
|
+
require 'multiverse_helpers'
|
10
9
|
|
11
10
|
DataMapper::Logger.new("/dev/null", :debug)
|
12
11
|
DataMapper.setup(:default, 'sqlite::memory:')
|
@@ -28,10 +27,10 @@ class DummyConnection
|
|
28
27
|
include NewRelic::Agent::Instrumentation::DataMapperInstrumentation
|
29
28
|
end
|
30
29
|
|
31
|
-
class DataMapperTest <
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
class DataMapperTest < MiniTest::Unit::TestCase
|
31
|
+
include MultiverseHelpers
|
32
|
+
|
33
|
+
setup_and_teardown_agent
|
35
34
|
|
36
35
|
def test_basic_metrics
|
37
36
|
post = Post.create(:title => "Dummy post", :body => "whatever, man")
|
@@ -97,9 +96,6 @@ class DataMapperTest < Test::Unit::TestCase
|
|
97
96
|
msg.stubs(:query).returns(q)
|
98
97
|
|
99
98
|
assert_equal false, msg.query.valid_encoding? if RUBY_VERSION >= '1.9'
|
100
|
-
|
101
|
-
db.send(:log, msg)
|
102
|
-
end
|
99
|
+
db.send(:log, msg)
|
103
100
|
end
|
104
101
|
end
|
105
|
-
|
@@ -0,0 +1,19 @@
|
|
1
|
+
suite_condition("Sinatra not compatible with 1.8.6") do
|
2
|
+
RUBY_VERSION != '1.8.6'
|
3
|
+
end
|
4
|
+
|
5
|
+
gemfile <<-RB
|
6
|
+
gem 'sinatra', '~> 1.4.0', :require => false
|
7
|
+
gem 'rack-test', :require => 'rack/test'
|
8
|
+
RB
|
9
|
+
|
10
|
+
gemfile <<-RB
|
11
|
+
gem 'sinatra', '~> 1.3.0', :require => false
|
12
|
+
gem 'rack-test', :require => 'rack/test'
|
13
|
+
RB
|
14
|
+
|
15
|
+
gemfile <<-RB
|
16
|
+
gem 'sinatra', '~> 1.2.0', :require => false
|
17
|
+
gem 'rack-test', :require => 'rack/test'
|
18
|
+
RB
|
19
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
development:
|
3
|
+
error_collector:
|
4
|
+
capture_source: true
|
5
|
+
enabled: true
|
6
|
+
apdex_t: 0.5
|
7
|
+
ssl: false
|
8
|
+
agent_enabled: true
|
9
|
+
monitor_mode: true
|
10
|
+
license_key: bootstrap_newrelic_admin_license_key_000
|
11
|
+
developer_mode: false
|
12
|
+
app_name: test
|
13
|
+
sync_startup: true
|
14
|
+
host: 127.0.0.1
|
15
|
+
api_host: 127.0.0.1
|
16
|
+
transaction_tracer:
|
17
|
+
record_sql: obfuscated
|
18
|
+
enabled: true
|
19
|
+
stack_trace_threshold: 0.5
|
20
|
+
transaction_threshold: 1.0
|
21
|
+
capture_params: false
|
22
|
+
disable_serialization: false
|
@@ -0,0 +1,103 @@
|
|
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
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'sinatra', 'sinatra_test_cases'))
|
6
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'agent_helper'))
|
7
|
+
|
8
|
+
require 'newrelic_rpm'
|
9
|
+
require 'sinatra'
|
10
|
+
|
11
|
+
class DeferredSinatraTestApp < Sinatra::Base
|
12
|
+
include NewRelic::Agent::Instrumentation::Rack
|
13
|
+
|
14
|
+
configure do
|
15
|
+
# display exceptions so we see what's going on
|
16
|
+
disable :show_exceptions
|
17
|
+
|
18
|
+
# create a condition (sintra's version of a before_filter) that returns the
|
19
|
+
# value that was passed into it.
|
20
|
+
set :my_condition do |boolean|
|
21
|
+
condition do
|
22
|
+
halt 404 unless boolean
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
get '/user/login' do
|
28
|
+
"please log in"
|
29
|
+
end
|
30
|
+
|
31
|
+
# this action will always return 404 because of the condition.
|
32
|
+
get '/user/:id', :my_condition => false do |id|
|
33
|
+
"Welcome #{id}"
|
34
|
+
end
|
35
|
+
|
36
|
+
get '/raise' do
|
37
|
+
raise "Uh-oh"
|
38
|
+
end
|
39
|
+
|
40
|
+
# check that pass works properly
|
41
|
+
condition { pass { halt 418, "I'm a teapot." } }
|
42
|
+
get('/pass') { }
|
43
|
+
|
44
|
+
get '/pass' do
|
45
|
+
"I'm not a teapot."
|
46
|
+
end
|
47
|
+
|
48
|
+
class Error < StandardError; end
|
49
|
+
error(Error) { halt 200, 'nothing happened' }
|
50
|
+
condition { raise Error }
|
51
|
+
get('/error') { }
|
52
|
+
|
53
|
+
condition do
|
54
|
+
raise "Boo" if $precondition_already_checked
|
55
|
+
$precondition_already_checked = true
|
56
|
+
end
|
57
|
+
get('/precondition') { 'precondition only happened once' }
|
58
|
+
|
59
|
+
get '/route/:name' do |name|
|
60
|
+
# usually this would be a db test or something
|
61
|
+
pass if name != 'match'
|
62
|
+
'first route'
|
63
|
+
end
|
64
|
+
|
65
|
+
get '/route/no_match' do
|
66
|
+
'second route'
|
67
|
+
end
|
68
|
+
|
69
|
+
before '/filtered' do
|
70
|
+
@filtered = true
|
71
|
+
end
|
72
|
+
|
73
|
+
get '/filtered' do
|
74
|
+
@filtered ? 'got filtered' : 'nope'
|
75
|
+
end
|
76
|
+
|
77
|
+
get /\/regex.*/ do
|
78
|
+
"Yeah, regex's!"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
class DeferredSinatraTest < MiniTest::Unit::TestCase
|
83
|
+
include SinatraTestCases
|
84
|
+
|
85
|
+
def app
|
86
|
+
Rack::Builder.new( DeferredSinatraTestApp ).to_app
|
87
|
+
end
|
88
|
+
|
89
|
+
|
90
|
+
def test_ignores_route_metrics
|
91
|
+
# Can't use 'newrelic_ignore' if newrelic was loaded before sinatra, as the
|
92
|
+
# instrumentation doesn't load until Rack is building the app to run it.
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
# (RUBY-1169)
|
97
|
+
def test_only_tries_deferred_detection_once
|
98
|
+
Rack::Builder.new( DeferredSinatraTestApp ).to_app
|
99
|
+
::DependencyDetection.expects( :detect! ).never
|
100
|
+
Rack::Builder.new( DeferredSinatraTestApp ).to_app
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
@@ -11,11 +11,9 @@ development:
|
|
11
11
|
app_name: test
|
12
12
|
host: 127.0.0.1
|
13
13
|
api_host: 127.0.0.1
|
14
|
-
port: <%= 30_000 + ($$ % 10_000) %>
|
15
14
|
transaction_tracer:
|
16
15
|
record_sql: obfuscated
|
17
16
|
enabled: true
|
18
17
|
stack_trace_threshold: 0.5
|
19
18
|
transaction_threshold: 1.0
|
20
19
|
capture_params: false
|
21
|
-
log_level: debug
|
@@ -9,7 +9,7 @@ require "http_client_test_cases"
|
|
9
9
|
|
10
10
|
require File.join(File.dirname(__FILE__), "..", "..", "..", "agent_helper")
|
11
11
|
|
12
|
-
class ExconTest <
|
12
|
+
class ExconTest < MiniTest::Unit::TestCase
|
13
13
|
include HttpClientTestCases
|
14
14
|
|
15
15
|
def client_name
|
@@ -40,8 +40,8 @@ class ExconTest < Test::Unit::TestCase
|
|
40
40
|
NewRelic::Agent::HTTPClients::ExconHTTPRequest.new({:headers => ""})
|
41
41
|
end
|
42
42
|
|
43
|
-
def response_instance
|
44
|
-
NewRelic::Agent::HTTPClients::ExconHTTPResponse.new(Excon::Response.new)
|
43
|
+
def response_instance(headers = {})
|
44
|
+
NewRelic::Agent::HTTPClients::ExconHTTPResponse.new(Excon::Response.new(:headers => headers))
|
45
45
|
end
|
46
46
|
|
47
47
|
def test_still_records_tt_node_when_request_expects_different_response_code
|
@@ -0,0 +1,15 @@
|
|
1
|
+
suite_condition("HTTPClient not supported in 1.8.6") do
|
2
|
+
RUBY_VERSION != '1.8.6'
|
3
|
+
end
|
4
|
+
|
5
|
+
httpclient_versions = %w(2.3.3 2.2.0)
|
6
|
+
|
7
|
+
httpclient_versions.each do |httpclient_version|
|
8
|
+
gemfile <<-RB
|
9
|
+
gem 'httpclient', '~> #{httpclient_version}'
|
10
|
+
gem 'rack'
|
11
|
+
if RUBY_VERSION < '1.9.0'
|
12
|
+
gem 'json'
|
13
|
+
end
|
14
|
+
RB
|
15
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
development:
|
3
|
+
error_collector:
|
4
|
+
capture_source: true
|
5
|
+
enabled: true
|
6
|
+
apdex_t: 0.5
|
7
|
+
ssl: false
|
8
|
+
monitor_mode: true
|
9
|
+
license_key: bootstrap_newrelic_admin_license_key_000
|
10
|
+
developer_mode: false
|
11
|
+
app_name: test
|
12
|
+
host: 127.0.0.1
|
13
|
+
api_host: 127.0.0.1
|
14
|
+
transaction_tracer:
|
15
|
+
record_sql: obfuscated
|
16
|
+
enabled: true
|
17
|
+
stack_trace_threshold: 0.5
|
18
|
+
transaction_threshold: 1.0
|
19
|
+
capture_params: false
|
@@ -0,0 +1,70 @@
|
|
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
|
+
require "httpclient"
|
6
|
+
require "newrelic_rpm"
|
7
|
+
require "test/unit"
|
8
|
+
require "http_client_test_cases"
|
9
|
+
|
10
|
+
require File.join(File.dirname(__FILE__), "..", "..", "..", "agent_helper")
|
11
|
+
|
12
|
+
class HTTPClientTest < MiniTest::Unit::TestCase
|
13
|
+
include HttpClientTestCases
|
14
|
+
|
15
|
+
def client_name
|
16
|
+
"HTTPClient"
|
17
|
+
end
|
18
|
+
|
19
|
+
def get_response(url=nil)
|
20
|
+
HTTPClient.get(url || default_url)
|
21
|
+
end
|
22
|
+
|
23
|
+
def head_response
|
24
|
+
HTTPClient.head(default_url)
|
25
|
+
end
|
26
|
+
|
27
|
+
def post_response
|
28
|
+
HTTPClient.post(default_url, :body => "")
|
29
|
+
end
|
30
|
+
|
31
|
+
def request_instance
|
32
|
+
httpclient_req = HTTP::Message.new_request(:get, 'http://newrelic.com')
|
33
|
+
NewRelic::Agent::HTTPClients::HTTPClientRequest.new(httpclient_req)
|
34
|
+
end
|
35
|
+
|
36
|
+
def response_instance(headers = {})
|
37
|
+
httpclient_resp = HTTP::Message.new_response('')
|
38
|
+
headers.each do |k, v|
|
39
|
+
httpclient_resp.http_header[k] = v
|
40
|
+
end
|
41
|
+
NewRelic::Agent::HTTPClients::HTTPClientResponse.new(httpclient_resp)
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_still_records_tt_node_when_pop_raises_an_exception
|
45
|
+
in_transaction do
|
46
|
+
test_exception = StandardError.new
|
47
|
+
evil_connection = HTTPClient::Connection.new
|
48
|
+
evil_connection.instance_variable_set(:@test_exception, test_exception)
|
49
|
+
evil_connection.instance_eval do
|
50
|
+
def new_push(request)
|
51
|
+
@queue.push(@test_exception)
|
52
|
+
end
|
53
|
+
|
54
|
+
alias old_push push
|
55
|
+
alias push new_push
|
56
|
+
end
|
57
|
+
|
58
|
+
HTTPClient::Connection.stubs(:new).returns(evil_connection)
|
59
|
+
|
60
|
+
begin
|
61
|
+
get_response(default_url)
|
62
|
+
rescue => e
|
63
|
+
raise e unless e == test_exception
|
64
|
+
end
|
65
|
+
|
66
|
+
last_segment = find_last_transaction_segment()
|
67
|
+
assert_equal("External/localhost/HTTPClient/GET", last_segment.metric_name)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -11,11 +11,9 @@ development:
|
|
11
11
|
app_name: test
|
12
12
|
host: 127.0.0.1
|
13
13
|
api_host: 127.0.0.1
|
14
|
-
port: <%= 30_000 + ($$ % 10_000) %>
|
15
14
|
transaction_tracer:
|
16
15
|
record_sql: obfuscated
|
17
16
|
enabled: true
|
18
17
|
stack_trace_threshold: 0.5
|
19
18
|
transaction_threshold: 1.0
|
20
19
|
capture_params: false
|
21
|
-
log_level: debug
|
@@ -9,7 +9,7 @@ require "http_client_test_cases"
|
|
9
9
|
|
10
10
|
require File.join(File.dirname(__FILE__), "..", "..", "..", "agent_helper")
|
11
11
|
|
12
|
-
class NetHttpTest <
|
12
|
+
class NetHttpTest < MiniTest::Unit::TestCase
|
13
13
|
include HttpClientTestCases
|
14
14
|
|
15
15
|
#
|
@@ -23,8 +23,9 @@ class NetHttpTest < Test::Unit::TestCase
|
|
23
23
|
def get_response(url=nil)
|
24
24
|
uri = default_uri
|
25
25
|
uri = URI.parse(url) unless url.nil?
|
26
|
+
path = uri.path.empty? ? '/' : uri.path
|
26
27
|
|
27
|
-
start(uri) { |http| http.get(
|
28
|
+
start(uri) { |http| http.get(path) }
|
28
29
|
end
|
29
30
|
|
30
31
|
def get_response_multi(url, n)
|
@@ -69,8 +70,12 @@ class NetHttpTest < Test::Unit::TestCase
|
|
69
70
|
NewRelic::Agent::HTTPClients::NetHTTPRequest.new(http, request)
|
70
71
|
end
|
71
72
|
|
72
|
-
def response_instance
|
73
|
-
Net::HTTPResponse.new(nil, nil, nil)
|
73
|
+
def response_instance(headers = {})
|
74
|
+
response = Net::HTTPResponse.new(nil, nil, nil)
|
75
|
+
headers.each do |k,v|
|
76
|
+
response[k] = v
|
77
|
+
end
|
78
|
+
response
|
74
79
|
end
|
75
80
|
|
76
81
|
#
|
@@ -6,11 +6,13 @@ gemfile <<-RB
|
|
6
6
|
# Gemspec from rubygems on this version gets illformed warnings on 1.8.7
|
7
7
|
gem 'http_router', '0.11.0', :git => 'git://github.com/joshbuddy/http_router.git'
|
8
8
|
|
9
|
+
gem 'activesupport', '~> 3'
|
9
10
|
gem 'padrino', '~> 0.11.0'
|
10
11
|
gem 'rack-test', :require => 'rack/test'
|
11
12
|
RB
|
12
13
|
|
13
14
|
gemfile <<-RB
|
15
|
+
gem 'activesupport', '~> 3'
|
14
16
|
gem 'padrino', '~> 0.10.0'
|
15
17
|
gem 'rack-test', :require => 'rack/test'
|
16
18
|
RB
|
@@ -10,15 +10,12 @@ development:
|
|
10
10
|
license_key: bootstrap_newrelic_admin_license_key_000
|
11
11
|
developer_mode: false
|
12
12
|
app_name: test
|
13
|
-
sync_startup: true
|
14
13
|
host: 127.0.0.1
|
15
14
|
api_host: 127.0.0.1
|
16
|
-
port: <%= 30_000 + ($$ % 10_000) %>
|
17
15
|
transaction_tracer:
|
18
16
|
record_sql: obfuscated
|
19
17
|
enabled: true
|
20
18
|
stack_trace_threshold: 0.5
|
21
19
|
transaction_threshold: 1.0
|
22
20
|
capture_params: false
|
23
|
-
log_level: debug
|
24
21
|
disable_serialization: false
|
@@ -3,6 +3,7 @@
|
|
3
3
|
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
4
|
|
5
5
|
require File.join(File.dirname(__FILE__), '..', '..', '..', 'agent_helper.rb')
|
6
|
+
require 'multiverse_helpers'
|
6
7
|
|
7
8
|
# Shhhh
|
8
9
|
Padrino::Logger::Config[:development][:stream] = :null
|
@@ -21,16 +22,16 @@ class PadrinoTestApp < Padrino::Application
|
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
24
|
-
class PadrinoRoutesTest <
|
25
|
+
class PadrinoRoutesTest < MiniTest::Unit::TestCase
|
25
26
|
include Rack::Test::Methods
|
26
27
|
|
27
28
|
def app
|
28
29
|
PadrinoTestApp
|
29
30
|
end
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
32
|
+
include MultiverseHelpers
|
33
|
+
|
34
|
+
setup_and_teardown_agent
|
34
35
|
|
35
36
|
def test_basic_route
|
36
37
|
get '/user/login'
|