newrelic_rpm 3.6.4.122 → 3.6.5.130
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 +14 -1
- data/lib/new_relic/agent.rb +8 -7
- data/lib/new_relic/agent/agent.rb +2 -0
- data/lib/new_relic/agent/configuration/defaults.rb +1 -1
- data/lib/new_relic/agent/configuration/server_source.rb +2 -1
- data/lib/new_relic/agent/cross_app_tracing.rb +52 -26
- data/lib/new_relic/agent/event_listener.rb +1 -1
- data/lib/new_relic/agent/http_clients/excon_wrappers.rb +61 -0
- data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +46 -0
- data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +72 -0
- data/lib/new_relic/agent/{uri_util.rb → http_clients/uri_util.rb} +11 -17
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +4 -11
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +1 -1
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +2 -2
- data/lib/new_relic/agent/instrumentation/excon.rb +72 -0
- data/lib/new_relic/agent/instrumentation/excon/connection.rb +33 -0
- data/lib/new_relic/agent/instrumentation/excon/middleware.rb +45 -0
- data/lib/new_relic/agent/instrumentation/net.rb +3 -1
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +73 -0
- data/lib/new_relic/agent/method_tracer.rb +3 -6
- data/lib/new_relic/agent/new_relic_service.rb +1 -1
- data/lib/new_relic/agent/samplers/object_sampler.rb +1 -1
- data/lib/new_relic/agent/stats.rb +12 -10
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +24 -6
- data/lib/new_relic/agent/stats_engine/stats_hash.rb +9 -11
- data/lib/new_relic/agent/transaction.rb +34 -33
- data/lib/new_relic/agent/transaction_sampler.rb +15 -6
- data/lib/new_relic/language_support.rb +8 -0
- data/lib/new_relic/local_environment.rb +10 -14
- data/lib/new_relic/version.rb +1 -1
- data/test/agent_helper.rb +43 -0
- data/test/config/test.cert.crt +14 -0
- data/test/config/test.cert.csr +11 -0
- data/test/config/test.cert.key +15 -0
- data/test/config/testing-privkey.pem +18 -0
- data/test/multiverse/lib/multiverse/color.rb +9 -3
- data/test/multiverse/lib/multiverse/suite.rb +11 -1
- data/test/multiverse/suites/agent_only/audit_log_test.rb +1 -0
- data/test/multiverse/suites/agent_only/config/newrelic.yml +4 -0
- data/test/multiverse/suites/agent_only/http_response_code_test.rb +1 -1
- data/test/multiverse/suites/agent_only/rename_rule_test.rb +2 -1
- data/test/multiverse/suites/agent_only/start_up_test.rb +3 -2
- data/test/multiverse/suites/config_file_loading/Envfile +2 -0
- data/test/multiverse/suites/excon/Envfile +15 -0
- data/test/multiverse/suites/excon/config/newrelic.yml +21 -0
- data/test/multiverse/suites/excon/excon_test.rb +60 -0
- data/test/multiverse/suites/net_http/Envfile +6 -0
- data/test/multiverse/suites/net_http/config/newrelic.yml +21 -0
- data/test/multiverse/suites/net_http/net_http_test.rb +102 -0
- data/test/multiverse/suites/rails/Envfile +1 -1
- data/test/multiverse/suites/rails/view_instrumentation_test.rb +6 -0
- data/test/multiverse/suites/resque/Envfile +0 -9
- data/test/multiverse/suites/resque/instrumentation_test.rb +21 -6
- data/test/multiverse/suites/typhoeus/Envfile +46 -0
- data/test/multiverse/suites/typhoeus/config/newrelic.yml +21 -0
- data/test/multiverse/suites/typhoeus/typhoeus_test.rb +77 -0
- data/test/new_relic/agent/agent_test_controller_test.rb +11 -10
- data/test/new_relic/agent/configuration/server_source_test.rb +23 -9
- data/test/new_relic/agent/database_test.rb +6 -0
- data/test/new_relic/agent/http_clients/uri_util_test.rb +64 -0
- data/test/new_relic/agent/instrumentation/net_instrumentation_test.rb +0 -406
- data/test/new_relic/agent/new_relic_service_test.rb +23 -19
- data/test/new_relic/agent/stats_engine/metric_stats_test.rb +29 -12
- data/test/new_relic/agent/stats_hash_test.rb +24 -3
- data/test/new_relic/agent/stats_test.rb +4 -4
- data/test/new_relic/agent/transaction/pop_test.rb +1 -1
- data/test/new_relic/agent/transaction_sampler_test.rb +18 -0
- data/test/new_relic/agent/transaction_test.rb +64 -69
- data/test/new_relic/agent_test.rb +20 -0
- data/test/new_relic/dependency_detection_test.rb +99 -0
- data/test/new_relic/evil_server.rb +56 -0
- data/test/new_relic/fake_collector.rb +12 -96
- data/test/new_relic/fake_external_server.rb +55 -0
- data/test/new_relic/fake_server.rb +97 -0
- data/test/new_relic/http_client_test_cases.rb +444 -0
- data/test/new_relic/language_support_test.rb +45 -0
- data/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb +25 -4
- metadata +37 -35
- metadata.gz.sig +0 -0
- data/test/multiverse/suites/resque/resque_setup.rb +0 -19
- data/test/new_relic/agent/uri_util_test.rb +0 -75
@@ -0,0 +1,45 @@
|
|
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__),'..','test_helper'))
|
6
|
+
|
7
|
+
class NewRelic::LanguageSupportTest < Test::Unit::TestCase
|
8
|
+
def test_object_space_enabled_true_without_jruby_with_object_space
|
9
|
+
undefine_constant(:JRuby) do
|
10
|
+
define_constant(:ObjectSpace, mock()) do
|
11
|
+
assert_truthy NewRelic::LanguageSupport.object_space_enabled?
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_object_space_enabled_false_without_object_space_without_jruby
|
17
|
+
undefine_constant(:ObjectSpace) do
|
18
|
+
undefine_constant(:JRuby) do
|
19
|
+
assert_falsy NewRelic::LanguageSupport.object_space_enabled?
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_object_space_enabled_true_if_enabled_in_jruby_without_object_space
|
25
|
+
fake_runtime = mock(:is_object_space_enabled => true)
|
26
|
+
fake_jruby = mock(:runtime => fake_runtime)
|
27
|
+
|
28
|
+
define_constant(:JRuby, fake_jruby) do
|
29
|
+
undefine_constant(:ObjectSpace) do
|
30
|
+
assert_truthy NewRelic::LanguageSupport.object_space_enabled?
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_object_space_enabled_false_if_disabled_in_jruby_without_object_space
|
36
|
+
fake_runtime = mock(:is_object_space_enabled => false)
|
37
|
+
fake_jruby = mock(:runtime => fake_runtime)
|
38
|
+
|
39
|
+
define_constant(:JRuby, fake_jruby) do
|
40
|
+
undefine_constant(:ObjectSpace) do
|
41
|
+
assert_falsy NewRelic::LanguageSupport.object_space_enabled?
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -6,15 +6,15 @@ require 'dependency_detection/version'
|
|
6
6
|
module DependencyDetection
|
7
7
|
|
8
8
|
module_function
|
9
|
-
|
9
|
+
@items = []
|
10
10
|
def defer(&block)
|
11
11
|
item = Dependent.new
|
12
12
|
item.instance_eval(&block)
|
13
|
-
|
13
|
+
@items << item
|
14
14
|
end
|
15
15
|
|
16
16
|
def detect!
|
17
|
-
|
17
|
+
@items.each do |item|
|
18
18
|
if item.dependencies_satisfied?
|
19
19
|
item.execute
|
20
20
|
end
|
@@ -22,7 +22,7 @@ module DependencyDetection
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def dependency_by_name(name)
|
25
|
-
|
25
|
+
@items.find {|i| i.name == name }
|
26
26
|
end
|
27
27
|
|
28
28
|
def installed?(name)
|
@@ -30,6 +30,14 @@ module DependencyDetection
|
|
30
30
|
item && item.executed
|
31
31
|
end
|
32
32
|
|
33
|
+
def items
|
34
|
+
@items
|
35
|
+
end
|
36
|
+
|
37
|
+
def items=(new_items)
|
38
|
+
@items = new_items
|
39
|
+
end
|
40
|
+
|
33
41
|
class Dependent
|
34
42
|
attr_reader :executed
|
35
43
|
attr_reader :name
|
@@ -64,6 +72,19 @@ module DependencyDetection
|
|
64
72
|
@dependencies << Proc.new
|
65
73
|
end
|
66
74
|
|
75
|
+
def named(new_name)
|
76
|
+
name = new_name
|
77
|
+
depends_on do
|
78
|
+
key = "disable_#{new_name}".to_sym
|
79
|
+
if (::NewRelic::Agent.config[key] == true)
|
80
|
+
::NewRelic::Agent.logger.debug("Not installing #{new_name} instrumentation because of configuration #{key}")
|
81
|
+
false
|
82
|
+
else
|
83
|
+
true
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
67
88
|
def executes
|
68
89
|
@executes << Proc.new
|
69
90
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic_rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.6.
|
4
|
+
version: 3.6.5.130
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -41,7 +41,7 @@ cert_chain:
|
|
41
41
|
cHUySWFQWE92bTNUOEc0TzZxWnZobkxoL1VpZW4rK0RqOGVGQmVjVFBvTThw
|
42
42
|
VmpLM3BoNQpuL0V3dVpDY0U2Z2h0Q0NNCi0tLS0tRU5EIENFUlRJRklDQVRF
|
43
43
|
LS0tLS0K
|
44
|
-
date: 2013-06-
|
44
|
+
date: 2013-06-27 00:00:00.000000000 Z
|
45
45
|
dependencies: []
|
46
46
|
description: ! 'New Relic is a performance management system, developed by New Relic,
|
47
47
|
|
@@ -112,6 +112,10 @@ files:
|
|
112
112
|
- lib/new_relic/agent/database.rb
|
113
113
|
- lib/new_relic/agent/error_collector.rb
|
114
114
|
- lib/new_relic/agent/event_listener.rb
|
115
|
+
- lib/new_relic/agent/http_clients/excon_wrappers.rb
|
116
|
+
- lib/new_relic/agent/http_clients/net_http_wrappers.rb
|
117
|
+
- lib/new_relic/agent/http_clients/typhoeus_wrappers.rb
|
118
|
+
- lib/new_relic/agent/http_clients/uri_util.rb
|
115
119
|
- lib/new_relic/agent/instrumentation.rb
|
116
120
|
- lib/new_relic/agent/instrumentation/action_controller_subscriber.rb
|
117
121
|
- lib/new_relic/agent/instrumentation/action_view_subscriber.rb
|
@@ -126,6 +130,9 @@ files:
|
|
126
130
|
- lib/new_relic/agent/instrumentation/data_mapper.rb
|
127
131
|
- lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb
|
128
132
|
- lib/new_relic/agent/instrumentation/evented_subscriber.rb
|
133
|
+
- lib/new_relic/agent/instrumentation/excon.rb
|
134
|
+
- lib/new_relic/agent/instrumentation/excon/connection.rb
|
135
|
+
- lib/new_relic/agent/instrumentation/excon/middleware.rb
|
129
136
|
- lib/new_relic/agent/instrumentation/memcache.rb
|
130
137
|
- lib/new_relic/agent/instrumentation/merb/controller.rb
|
131
138
|
- lib/new_relic/agent/instrumentation/merb/errors.rb
|
@@ -152,6 +159,7 @@ files:
|
|
152
159
|
- lib/new_relic/agent/instrumentation/sinatra/ignorer.rb
|
153
160
|
- lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb
|
154
161
|
- lib/new_relic/agent/instrumentation/sunspot.rb
|
162
|
+
- lib/new_relic/agent/instrumentation/typhoeus.rb
|
155
163
|
- lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb
|
156
164
|
- lib/new_relic/agent/method_tracer.rb
|
157
165
|
- lib/new_relic/agent/new_relic_service.rb
|
@@ -183,7 +191,6 @@ files:
|
|
183
191
|
- lib/new_relic/agent/transaction_info.rb
|
184
192
|
- lib/new_relic/agent/transaction_sample_builder.rb
|
185
193
|
- lib/new_relic/agent/transaction_sampler.rb
|
186
|
-
- lib/new_relic/agent/uri_util.rb
|
187
194
|
- lib/new_relic/agent/worker_loop.rb
|
188
195
|
- lib/new_relic/coerce.rb
|
189
196
|
- lib/new_relic/collection_helper.rb
|
@@ -244,7 +251,11 @@ files:
|
|
244
251
|
- test/active_record_fixtures.rb
|
245
252
|
- test/agent_helper.rb
|
246
253
|
- test/config/newrelic.yml
|
254
|
+
- test/config/test.cert.crt
|
255
|
+
- test/config/test.cert.csr
|
256
|
+
- test/config/test.cert.key
|
247
257
|
- test/config/test_control.rb
|
258
|
+
- test/config/testing-privkey.pem
|
248
259
|
- test/fixtures/proc_cpuinfo.txt
|
249
260
|
- test/intentional_fail.rb
|
250
261
|
- test/multiverse/.gitignore
|
@@ -287,6 +298,12 @@ files:
|
|
287
298
|
- test/multiverse/suites/datamapper/Envfile
|
288
299
|
- test/multiverse/suites/datamapper/config/newrelic.yml
|
289
300
|
- test/multiverse/suites/datamapper/datamapper_test.rb
|
301
|
+
- test/multiverse/suites/excon/Envfile
|
302
|
+
- test/multiverse/suites/excon/config/newrelic.yml
|
303
|
+
- test/multiverse/suites/excon/excon_test.rb
|
304
|
+
- test/multiverse/suites/net_http/Envfile
|
305
|
+
- test/multiverse/suites/net_http/config/newrelic.yml
|
306
|
+
- test/multiverse/suites/net_http/net_http_test.rb
|
290
307
|
- test/multiverse/suites/padrino/Envfile
|
291
308
|
- test/multiverse/suites/padrino/config/newrelic.yml
|
292
309
|
- test/multiverse/suites/padrino/padrino_test.rb
|
@@ -309,7 +326,6 @@ files:
|
|
309
326
|
- test/multiverse/suites/resque/Rakefile
|
310
327
|
- test/multiverse/suites/resque/config/newrelic.yml
|
311
328
|
- test/multiverse/suites/resque/instrumentation_test.rb
|
312
|
-
- test/multiverse/suites/resque/resque_setup.rb
|
313
329
|
- test/multiverse/suites/sequel/Envfile
|
314
330
|
- test/multiverse/suites/sequel/config/newrelic.yml
|
315
331
|
- test/multiverse/suites/sequel/sequel_test.rb
|
@@ -327,6 +343,9 @@ files:
|
|
327
343
|
- test/multiverse/suites/sinatra/sinatra_modular_test.rb
|
328
344
|
- test/multiverse/suites/sinatra/sinatra_routes_test.rb
|
329
345
|
- test/multiverse/suites/sinatra/sinatra_test_cases.rb
|
346
|
+
- test/multiverse/suites/typhoeus/Envfile
|
347
|
+
- test/multiverse/suites/typhoeus/config/newrelic.yml
|
348
|
+
- test/multiverse/suites/typhoeus/typhoeus_test.rb
|
330
349
|
- test/multiverse/test/multiverse_test.rb
|
331
350
|
- test/multiverse/test/suite_examples/one/a/Envfile
|
332
351
|
- test/multiverse/test/suite_examples/one/a/a_test.rb
|
@@ -362,6 +381,7 @@ files:
|
|
362
381
|
- test/new_relic/agent/error_collector/notice_error_test.rb
|
363
382
|
- test/new_relic/agent/error_collector_test.rb
|
364
383
|
- test/new_relic/agent/event_listener_test.rb
|
384
|
+
- test/new_relic/agent/http_clients/uri_util_test.rb
|
365
385
|
- test/new_relic/agent/instrumentation/action_controller_subscriber_test.rb
|
366
386
|
- test/new_relic/agent/instrumentation/action_view_subscriber_test.rb
|
367
387
|
- test/new_relic/agent/instrumentation/active_record_helper_test.rb
|
@@ -407,7 +427,6 @@ files:
|
|
407
427
|
- test/new_relic/agent/transaction_sample_builder_test.rb
|
408
428
|
- test/new_relic/agent/transaction_sampler_test.rb
|
409
429
|
- test/new_relic/agent/transaction_test.rb
|
410
|
-
- test/new_relic/agent/uri_util_test.rb
|
411
430
|
- test/new_relic/agent/worker_loop_test.rb
|
412
431
|
- test/new_relic/agent_test.rb
|
413
432
|
- test/new_relic/coerce_test.rb
|
@@ -417,11 +436,17 @@ files:
|
|
417
436
|
- test/new_relic/control/frameworks/rails_test.rb
|
418
437
|
- test/new_relic/control_test.rb
|
419
438
|
- test/new_relic/delayed_job_injection_test.rb
|
439
|
+
- test/new_relic/dependency_detection_test.rb
|
420
440
|
- test/new_relic/dispatcher_test.rb
|
421
441
|
- test/new_relic/environment_report_test.rb
|
442
|
+
- test/new_relic/evil_server.rb
|
422
443
|
- test/new_relic/fake_collector.rb
|
444
|
+
- test/new_relic/fake_external_server.rb
|
445
|
+
- test/new_relic/fake_server.rb
|
423
446
|
- test/new_relic/framework_test.rb
|
424
447
|
- test/new_relic/helper_test.rb
|
448
|
+
- test/new_relic/http_client_test_cases.rb
|
449
|
+
- test/new_relic/language_support_test.rb
|
425
450
|
- test/new_relic/license_test.rb
|
426
451
|
- test/new_relic/load_test.rb
|
427
452
|
- test/new_relic/local_environment_test.rb
|
@@ -531,36 +556,13 @@ files:
|
|
531
556
|
- lib/new_relic/build.rb
|
532
557
|
homepage: http://www.github.com/newrelic/rpm
|
533
558
|
licenses: []
|
534
|
-
post_install_message: ! "# New Relic Ruby Agent Release Notes #\n\n## v3.6.
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
applications using newrelic_rpm were affected by a race condition\n at startup
|
542
|
-
that manifested as an error when model classes with associations\n were first loaded.
|
543
|
-
The cause of these errors has been addressed by moving the\n generation of the
|
544
|
-
agent's EnvironmentReport on startup from a background\n thread to the main thread.\n\n##
|
545
|
-
3.6.3 ##\n\n* Better Sinatra Support\n\n A number of improvements have been made
|
546
|
-
to our Sinatra instrumentation.\n More details: https://newrelic.com/docs/ruby/sinatra-support-in-the-ruby-agent\n\n
|
547
|
-
\ Sinatra instrumentation has been updated to more accurately reflect the final\n
|
548
|
-
\ route that was actually executed, taking pass and conditions into account.\n\n
|
549
|
-
\ New Relic middlewares for error collection, real user monitoring, and cross\n
|
550
|
-
\ application tracing are automatically inserted into the middleware stack.\n\n
|
551
|
-
\ Ignoring routes, similar to functionality available to Rails controllers, is\n
|
552
|
-
\ now available in Sinatra as well.\n\n Routes in 1.4 are properly formatting in
|
553
|
-
transaction names. Thanks Zachary\n Anker for the contribution!\n\n* Padrino Support\n\n
|
554
|
-
\ Along with improving our support of Sinatra, we've also extended that to\n supporting
|
555
|
-
Padrino, a framework that builds on Sinatra. Web transactions\n should show up
|
556
|
-
in New Relic now for Padrino apps automatically. The agent has\n been tested against
|
557
|
-
the latest Padrino in versions 0.11.x and 0.10.x.\n\n* Main overview graph only
|
558
|
-
shows web transactions\n\n In the past database times from background jobs mixed
|
559
|
-
with other web transaction\n metrics in the main overview graph. This often skewed
|
560
|
-
graphs. A common workaround\n was to send background jobs to a separate application,
|
561
|
-
but that should no longer\n be necessary as the overview graphs now only represent
|
562
|
-
web transactions.\n\nSee https://github.com/newrelic/rpm/blob/master/CHANGELOG for
|
563
|
-
a full list of\nchanges.\n"
|
559
|
+
post_install_message: ! "# New Relic Ruby Agent Release Notes #\n\n## v3.6.5 ##\n\n*
|
560
|
+
Rails 4.0 Support\n\n The Ruby agent is all set for the recent general release
|
561
|
+
of Rails 4.0! We've\n been tracking the RC's, and that work paid off. Versions
|
562
|
+
3.6.5 and 3.6.4 of\n the Ruby agent should work fine with Rails 4.0.0.\n\n* Excon
|
563
|
+
and Typhoeus support\n\n The Ruby agent now supports the Excon and Typhoeus HTTP
|
564
|
+
libraries! For more\n details see https://newrelic.com/docs/ruby/ruby-http-clients.\n\nSee
|
565
|
+
https://github.com/newrelic/rpm/blob/master/CHANGELOG for a full list of\nchanges.\n"
|
564
566
|
rdoc_options:
|
565
567
|
- --line-numbers
|
566
568
|
- --inline-source
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,19 +0,0 @@
|
|
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 'resque'
|
6
|
-
require 'newrelic_rpm'
|
7
|
-
|
8
|
-
redis_port = ENV["NEWRELIC_MULTIVERSE_REDIS_PORT"]
|
9
|
-
$redis = Redis.new(:port => redis_port)
|
10
|
-
Resque.redis = $redis
|
11
|
-
|
12
|
-
class JobForTesting
|
13
|
-
@queue = :resque_test
|
14
|
-
|
15
|
-
def self.perform(key, val, sleep_duration=0)
|
16
|
-
sleep sleep_duration
|
17
|
-
$redis.set(key, val)
|
18
|
-
end
|
19
|
-
end
|
@@ -1,75 +0,0 @@
|
|
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__),'..','..','test_helper'))
|
6
|
-
require 'new_relic/agent/agent_logger'
|
7
|
-
require 'new_relic/agent/null_logger'
|
8
|
-
|
9
|
-
class URIUtilTest < Test::Unit::TestCase
|
10
|
-
def setup
|
11
|
-
fixture_tcp_socket(nil)
|
12
|
-
end
|
13
|
-
|
14
|
-
def dummy_request(uri_string, opts={})
|
15
|
-
uri = URI(uri_string)
|
16
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
17
|
-
http.use_ssl = opts.has_key?(:use_ssl) ? opts[:use_ssl] : false
|
18
|
-
req = Net::HTTP::Get.new(opts[:path] || uri.request_uri)
|
19
|
-
[http, req]
|
20
|
-
end
|
21
|
-
|
22
|
-
def filter(uri_string, opts={})
|
23
|
-
NewRelic::Agent::URIUtil.filtered_uri_for(*dummy_request(uri_string, opts))
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_filtered_uri_for
|
27
|
-
uri = "http://foo.com/bar/baz"
|
28
|
-
assert_equal("http://foo.com/bar/baz", filter(uri))
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_filtered_uri_for_custom_port
|
32
|
-
uri = "http://foo.com:1234/bar/baz"
|
33
|
-
assert_equal("http://foo.com:1234/bar/baz", filter(uri))
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_filtered_uri_omits_query_params
|
37
|
-
uri = "http://foo.com/bar/baz?a=1&b=2"
|
38
|
-
assert_equal("http://foo.com/bar/baz", filter(uri))
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_filtered_uri_omits_fragment
|
42
|
-
uri = "http://foo.com/bar/baz#fragment"
|
43
|
-
assert_equal("http://foo.com/bar/baz", filter(uri, :path => '/bar/baz#fragment'))
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_filtered_uri_omits_query_params_and_fragment
|
47
|
-
uri = "http://foo.com/bar/baz?a=1&b=2#fragment"
|
48
|
-
assert_equal("http://foo.com/bar/baz", filter(uri, :path => '/bar/baz?a=1&b=2#fragment'))
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_filtered_uri_reflects_use_of_ssl
|
52
|
-
uri = 'https://foo.com/bar/baz'
|
53
|
-
assert_equal("https://foo.com/bar/baz", filter(uri, :use_ssl => true))
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_filtered_uri_reflects_use_of_ssl_with_custom_port
|
57
|
-
uri = 'https://foo.com:9999/bar/baz'
|
58
|
-
assert_equal("https://foo.com:9999/bar/baz", filter(uri, :use_ssl => true))
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_filtered_uri_for_with_full_uri_request_path
|
62
|
-
uri = "http://foo.com/bar/baz?a=1&b=2#fragment"
|
63
|
-
assert_equal("http://foo.com/bar/baz", filter(uri, :path => uri))
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_filtered_uri_for_with_full_uri_request_path_https
|
67
|
-
uri = "https://foo.com/bar/baz?a=1&b=2#fragment"
|
68
|
-
assert_equal("https://foo.com/bar/baz", filter(uri, :path => uri, :use_ssl => true))
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_strips_credentials_embedded_in_uri
|
72
|
-
uri = "http://user:pass@foo.com/bar/baz"
|
73
|
-
assert_equal("http://foo.com/bar/baz", filter(uri, :path => uri))
|
74
|
-
end
|
75
|
-
end
|