newrelic_rpm 3.9.0.229 → 3.9.1.236
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +4 -1
- data/CHANGELOG +73 -0
- data/install.rb +2 -2
- data/lib/new_relic/agent/agent.rb +8 -1
- data/lib/new_relic/agent/browser_token.rb +10 -7
- data/lib/new_relic/agent/configuration/default_source.rb +8 -1
- data/lib/new_relic/agent/configuration/high_security_source.rb +56 -0
- data/lib/new_relic/agent/configuration/manager.rb +35 -28
- data/lib/new_relic/agent/cross_app_monitor.rb +23 -0
- data/lib/new_relic/agent/cross_app_tracing.rb +34 -26
- data/lib/new_relic/agent/database.rb +7 -6
- data/lib/new_relic/agent/instrumentation/active_record.rb +18 -18
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/curb.rb +18 -15
- data/lib/new_relic/agent/instrumentation/excon/connection.rb +1 -1
- data/lib/new_relic/agent/instrumentation/excon/middleware.rb +7 -4
- data/lib/new_relic/agent/instrumentation/httpclient.rb +1 -1
- data/lib/new_relic/agent/instrumentation/memcache.rb +9 -2
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +1 -1
- data/lib/new_relic/agent/instrumentation/net.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails3/errors.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails4/errors.rb +1 -1
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +6 -4
- data/lib/new_relic/agent/javascript_instrumentor.rb +9 -1
- data/lib/new_relic/agent/new_relic_service.rb +7 -0
- data/lib/new_relic/agent/obfuscator.rb +3 -2
- data/lib/new_relic/agent/request_sampler.rb +17 -1
- data/lib/new_relic/agent/sql_sampler.rb +10 -6
- data/lib/new_relic/agent/traced_method_stack.rb +0 -12
- data/lib/new_relic/agent/transaction.rb +98 -10
- data/lib/new_relic/agent/transaction_sampler.rb +10 -3
- data/lib/new_relic/agent/transaction_state.rb +2 -12
- data/lib/new_relic/control/frameworks/sinatra.rb +0 -3
- data/lib/new_relic/control/instance_methods.rb +5 -0
- data/lib/new_relic/json_wrapper.rb +7 -1
- data/lib/new_relic/rack/browser_monitoring.rb +25 -4
- data/lib/new_relic/version.rb +1 -1
- data/newrelic_rpm.gemspec +0 -1
- data/test/agent_helper.rb +76 -0
- data/test/fixtures/cross_agent_tests/cat_map.json +299 -0
- data/test/multiverse/suites/agent_only/collector_exception_handling_test.rb +16 -0
- data/test/multiverse/suites/agent_only/cross_application_tracing_test.rb +30 -0
- data/test/multiverse/suites/agent_only/marshaling_test.rb +17 -17
- data/test/multiverse/suites/agent_only/testing_app.rb +10 -1
- data/test/multiverse/suites/deferred_instrumentation/config/newrelic.yml +0 -1
- data/test/multiverse/suites/high_security/Envfile +3 -0
- data/test/multiverse/suites/high_security/config/newrelic.yml +27 -0
- data/test/multiverse/suites/high_security/high_security_test.rb +64 -0
- data/test/multiverse/suites/rails/action_controller_live_rum_test.rb +39 -0
- data/test/multiverse/suites/rails/bad_instrumentation_test.rb +3 -1
- data/test/multiverse/suites/rails/parameter_capture_test.rb +0 -20
- data/test/new_relic/agent/agent/connect_test.rb +5 -10
- data/test/new_relic/agent/agent_test.rb +11 -0
- data/test/new_relic/agent/browser_token_test.rb +10 -6
- data/test/new_relic/agent/configuration/default_source_test.rb +6 -0
- data/test/new_relic/agent/configuration/high_security_source_test.rb +83 -0
- data/test/new_relic/agent/configuration/manager_test.rb +7 -2
- data/test/new_relic/agent/cross_app_monitor_test.rb +17 -1
- data/test/new_relic/agent/cross_app_tracing_test.rb +11 -10
- data/test/new_relic/agent/hostname_test.rb +1 -1
- data/test/new_relic/agent/instrumentation/controller_instrumentation_test.rb +22 -0
- data/test/new_relic/agent/instrumentation/middleware_tracing_test.rb +37 -0
- data/test/new_relic/agent/instrumentation/net_instrumentation_test.rb +4 -2
- data/test/new_relic/agent/javascript_instrumentor_test.rb +42 -0
- data/test/new_relic/agent/memcache_instrumentation_test.rb +11 -5
- data/test/new_relic/agent/request_sampler_test.rb +9 -0
- data/test/new_relic/agent/sql_sampler_test.rb +46 -0
- data/test/new_relic/agent/stats_engine/gc_profiler_test.rb +1 -0
- data/test/new_relic/agent/transaction_sampler_test.rb +64 -4
- data/test/new_relic/agent/transaction_state_test.rb +0 -75
- data/test/new_relic/agent/transaction_test.rb +142 -0
- data/test/new_relic/control/instance_methods_test.rb +24 -4
- data/test/new_relic/fake_collector.rb +6 -13
- data/test/new_relic/fake_external_server.rb +14 -1
- data/test/new_relic/http_client_test_cases.rb +69 -21
- data/test/new_relic/json_wrapper_test.rb +10 -5
- data/test/performance/suites/rack_middleware.rb +2 -1
- data/test/performance/suites/rum_autoinsertion.rb +17 -3
- data/test/script/path_hash.rb +49 -0
- data/test/test_helper.rb +0 -10
- metadata +12 -52
- metadata.gz.sig +0 -0
@@ -17,14 +17,34 @@ class NewRelic::Control::InstanceMethodsTest < Minitest::Test
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def test_configure_agent_adds_the_yaml_config
|
20
|
-
|
20
|
+
refute_has_config NewRelic::Agent::Configuration::YamlSource
|
21
21
|
@test.configure_agent('test', {})
|
22
|
-
|
22
|
+
assert_has_config NewRelic::Agent::Configuration::YamlSource
|
23
23
|
end
|
24
24
|
|
25
25
|
def test_configure_agent_adds_the_manual_config
|
26
|
-
|
26
|
+
refute_has_config NewRelic::Agent::Configuration::ManualSource
|
27
27
|
@test.configure_agent('test', {})
|
28
|
-
|
28
|
+
assert_has_config NewRelic::Agent::Configuration::ManualSource
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_no_high_security_config_by_default
|
32
|
+
refute_has_config NewRelic::Agent::Configuration::HighSecuritySource
|
33
|
+
@test.configure_agent('test', {:high_security => false})
|
34
|
+
refute_has_config NewRelic::Agent::Configuration::HighSecuritySource
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_high_security_config_added_if_requested
|
38
|
+
refute_has_config NewRelic::Agent::Configuration::HighSecuritySource
|
39
|
+
@test.configure_agent('test', {:high_security => true})
|
40
|
+
assert_has_config NewRelic::Agent::Configuration::HighSecuritySource
|
41
|
+
end
|
42
|
+
|
43
|
+
def refute_has_config(clazz)
|
44
|
+
refute NewRelic::Agent.config.config_classes_for_testing.include? clazz
|
45
|
+
end
|
46
|
+
|
47
|
+
def assert_has_config(clazz)
|
48
|
+
assert NewRelic::Agent.config.config_classes_for_testing.include? clazz
|
29
49
|
end
|
30
50
|
end
|
@@ -128,6 +128,10 @@ module NewRelic
|
|
128
128
|
body = JSON.load(raw_body)
|
129
129
|
else
|
130
130
|
body = Marshal.load(raw_body)
|
131
|
+
|
132
|
+
# Symbols remain in Ruby-marshalled data, so tidy up so tests can
|
133
|
+
# rely on strings to compare against in fake collector results.
|
134
|
+
body = NewRelic::JSONWrapper.normalize(body)
|
131
135
|
end
|
132
136
|
rescue => err
|
133
137
|
body = "UNABLE TO DECODE BODY: #{raw_body}"
|
@@ -279,22 +283,11 @@ module NewRelic
|
|
279
283
|
end
|
280
284
|
|
281
285
|
def request_params
|
282
|
-
|
286
|
+
@body[1]
|
283
287
|
end
|
284
288
|
|
285
289
|
def custom_params
|
286
|
-
|
287
|
-
end
|
288
|
-
|
289
|
-
# Pruby marshalled stuff ends up with symbol keys. JSON ends up with
|
290
|
-
# strings. This makes writing tests on the params annoying. Normalize
|
291
|
-
# it all to string keys.
|
292
|
-
def normalize_params(params)
|
293
|
-
result = {}
|
294
|
-
@body[2].each do |k,v|
|
295
|
-
result[k.to_s] = v
|
296
|
-
end
|
297
|
-
result
|
290
|
+
@body[2]
|
298
291
|
end
|
299
292
|
end
|
300
293
|
|
@@ -14,6 +14,8 @@ module NewRelic
|
|
14
14
|
STATUS_MESSAGE = "<html><head><title>FakeExternalServer status</title></head>" +
|
15
15
|
"<body>The FakeExternalServer is rockin'</body></html>"
|
16
16
|
|
17
|
+
attr_reader :overridden_response_headers
|
18
|
+
|
17
19
|
def initialize( * )
|
18
20
|
super
|
19
21
|
@requests = []
|
@@ -36,10 +38,21 @@ module NewRelic
|
|
36
38
|
|
37
39
|
def reset
|
38
40
|
@requests.clear
|
41
|
+
@overridden_response_headers = {}
|
42
|
+
end
|
43
|
+
|
44
|
+
def override_response_headers(headers)
|
45
|
+
@overridden_response_headers.merge!(headers)
|
39
46
|
end
|
40
47
|
|
41
48
|
def app
|
42
|
-
NewRelic::Rack::AgentHooks.new(self)
|
49
|
+
inner_app = NewRelic::Rack::AgentHooks.new(self)
|
50
|
+
server = self
|
51
|
+
Proc.new do |env|
|
52
|
+
result = inner_app.call(env)
|
53
|
+
result[1].merge!(server.overridden_response_headers)
|
54
|
+
result
|
55
|
+
end
|
43
56
|
end
|
44
57
|
|
45
58
|
def fallback_port
|
@@ -31,20 +31,9 @@ module HttpClientTestCases
|
|
31
31
|
$fake_secure_server.reset
|
32
32
|
$fake_secure_server.run
|
33
33
|
|
34
|
-
NewRelic::Agent.instance.events.clear
|
35
|
-
NewRelic::Agent.instance.cross_app_monitor.register_event_listeners
|
36
34
|
NewRelic::Agent.instance.events.notify(:finished_configuring)
|
37
35
|
|
38
|
-
@nr_header = nil
|
39
|
-
# Don't use destructuring on result array with ignores since it fails
|
40
|
-
# on Rubinius: https://github.com/rubinius/rubinius/issues/2678
|
41
|
-
NewRelic::Agent.instance.events.subscribe(:after_call) do |_, result|
|
42
|
-
headers = result[1]
|
43
|
-
headers[ NR_APPDATA_HEADER ] = @nr_header unless @nr_header.nil?
|
44
|
-
end
|
45
|
-
|
46
36
|
@engine = NewRelic::Agent.instance.stats_engine
|
47
|
-
NewRelic::Agent::Transaction.any_instance.stubs(:guid).returns(TRANSACTION_GUID)
|
48
37
|
end
|
49
38
|
|
50
39
|
# Helpers to support shared tests
|
@@ -257,6 +246,28 @@ module HttpClientTestCases
|
|
257
246
|
end
|
258
247
|
end
|
259
248
|
|
249
|
+
def test_adds_newrelic_transaction_header
|
250
|
+
with_config(:cross_application_tracing => true) do
|
251
|
+
guid = nil
|
252
|
+
path_hash = nil
|
253
|
+
in_transaction do |txn|
|
254
|
+
guid = txn.guid
|
255
|
+
path_hash = txn.cat_path_hash(NewRelic::Agent::TransactionState.tl_get)
|
256
|
+
get_response
|
257
|
+
end
|
258
|
+
|
259
|
+
transaction_data = server.requests.last["HTTP_X_NEWRELIC_TRANSACTION"]
|
260
|
+
refute_empty(transaction_data)
|
261
|
+
|
262
|
+
decoded = decode_payload(transaction_data)
|
263
|
+
|
264
|
+
assert_equal(guid, decoded[0])
|
265
|
+
assert_equal(false, decoded[1])
|
266
|
+
assert_equal(guid, decoded[2])
|
267
|
+
assert_equal(path_hash, decoded[3])
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
260
271
|
def test_agent_doesnt_add_a_request_header_to_outgoing_requests_if_xp_disabled
|
261
272
|
get_response
|
262
273
|
assert_equal false, server.requests.last.keys.any? {|k| k =~ /NEWRELIC_ID/}
|
@@ -279,7 +290,7 @@ module HttpClientTestCases
|
|
279
290
|
end
|
280
291
|
|
281
292
|
def test_instrumentation_with_crossapp_enabled_records_normal_metrics_if_no_header_present
|
282
|
-
|
293
|
+
$fake_server.override_response_headers('X-NewRelic-App-Data' => '')
|
283
294
|
|
284
295
|
with_config(:"cross_application_tracer.enabled" => true) do
|
285
296
|
in_transaction("test") do
|
@@ -292,8 +303,8 @@ module HttpClientTestCases
|
|
292
303
|
end
|
293
304
|
|
294
305
|
def test_instrumentation_with_crossapp_disabled_records_normal_metrics_even_if_header_is_present
|
295
|
-
|
296
|
-
make_app_data_payload( "18#1884", "txn-name", 2, 8, 0, TRANSACTION_GUID )
|
306
|
+
$fake_server.override_response_headers('X-NewRelic-App-Data' =>
|
307
|
+
make_app_data_payload( "18#1884", "txn-name", 2, 8, 0, TRANSACTION_GUID ))
|
297
308
|
|
298
309
|
in_transaction("test") do
|
299
310
|
get_response
|
@@ -304,8 +315,8 @@ module HttpClientTestCases
|
|
304
315
|
end
|
305
316
|
|
306
317
|
def test_instrumentation_with_crossapp_enabled_records_crossapp_metrics_if_header_present
|
307
|
-
|
308
|
-
make_app_data_payload( "18#1884", "txn-name", 2, 8, 0, TRANSACTION_GUID )
|
318
|
+
$fake_server.override_response_headers('X-NewRelic-App-Data' =>
|
319
|
+
make_app_data_payload( "18#1884", "txn-name", 2, 8, 0, TRANSACTION_GUID ))
|
309
320
|
|
310
321
|
with_config(:"cross_application_tracer.enabled" => true) do
|
311
322
|
in_transaction("test") do
|
@@ -328,8 +339,8 @@ module HttpClientTestCases
|
|
328
339
|
end
|
329
340
|
|
330
341
|
def test_crossapp_metrics_allow_valid_utf8_characters
|
331
|
-
|
332
|
-
make_app_data_payload( "12#1114", "世界線航跡蔵", 18.0, 88.1, 4096, TRANSACTION_GUID )
|
342
|
+
$fake_server.override_response_headers('X-NewRelic-App-Data' =>
|
343
|
+
make_app_data_payload( "12#1114", "世界線航跡蔵", 18.0, 88.1, 4096, TRANSACTION_GUID ))
|
333
344
|
|
334
345
|
with_config(:"cross_application_tracer.enabled" => true) do
|
335
346
|
in_transaction("test") do
|
@@ -352,8 +363,8 @@ module HttpClientTestCases
|
|
352
363
|
end
|
353
364
|
|
354
365
|
def test_crossapp_metrics_ignores_crossapp_header_with_malformed_crossprocess_id
|
355
|
-
|
356
|
-
make_app_data_payload( "88#88#88", "invalid", 1, 2, 4096, TRANSACTION_GUID )
|
366
|
+
$fake_server.override_response_headers('X-NewRelic-App-Data' =>
|
367
|
+
make_app_data_payload( "88#88#88", "invalid", 1, 2, 4096, TRANSACTION_GUID ))
|
357
368
|
|
358
369
|
with_config(:"cross_application_tracer.enabled" => true) do
|
359
370
|
in_transaction("test") do
|
@@ -440,7 +451,6 @@ module HttpClientTestCases
|
|
440
451
|
end
|
441
452
|
end
|
442
453
|
|
443
|
-
|
444
454
|
def test_still_records_tt_node_when_request_fails
|
445
455
|
# This test does not work on older versions of Typhoeus, because the
|
446
456
|
# on_complete callback is not reliably invoked. That said, it's a corner
|
@@ -470,11 +480,49 @@ module HttpClientTestCases
|
|
470
480
|
end
|
471
481
|
end
|
472
482
|
|
483
|
+
load_cross_agent_test("cat_map").each do |test_case|
|
484
|
+
# Test cases that don't involve outgoing calls are done elsewhere
|
485
|
+
if test_case['outgoingTxnNames']
|
486
|
+
define_method("test_#{test_case['name']}") do
|
487
|
+
config = {
|
488
|
+
:app_name => test_case['appName'],
|
489
|
+
:'cross_application_tracer.enabled' => true
|
490
|
+
}
|
491
|
+
with_config(config) do
|
492
|
+
in_transaction do
|
493
|
+
state = NewRelic::Agent::TransactionState.tl_get
|
494
|
+
state.referring_transaction_info = test_case['referringPayload']
|
495
|
+
stub_transaction_guid(test_case['transactionGuid'])
|
496
|
+
test_case['outgoingTxnNames'].each do |name|
|
497
|
+
set_explicit_transaction_name(name)
|
498
|
+
get_response
|
499
|
+
end
|
500
|
+
set_explicit_transaction_name(test_case['transactionName'])
|
501
|
+
end
|
502
|
+
end
|
503
|
+
|
504
|
+
event = get_last_analytics_event
|
505
|
+
assert_event_attributes(event, test_case['name'], test_case['expectedAttributes'], test_case['nonExpectedAttributes'])
|
506
|
+
end
|
507
|
+
end
|
508
|
+
end
|
509
|
+
|
473
510
|
def make_app_data_payload( *args )
|
474
511
|
obfuscator = NewRelic::Agent::Obfuscator.new('gringletoes')
|
475
512
|
return obfuscator.obfuscate( args.to_json ) + "\n"
|
476
513
|
end
|
477
514
|
|
515
|
+
def decode_payload(payload)
|
516
|
+
obfuscator = NewRelic::Agent::Obfuscator.new('gringletoes')
|
517
|
+
NewRelic::JSONWrapper.load(obfuscator.deobfuscate(payload))
|
518
|
+
end
|
519
|
+
|
520
|
+
def set_explicit_transaction_name(name)
|
521
|
+
parts = name.split("/")
|
522
|
+
category = parts.shift
|
523
|
+
NewRelic::Agent.set_transaction_name(parts.join('/'), :category => category)
|
524
|
+
end
|
525
|
+
|
478
526
|
def assert_externals_recorded_for(host, meth, opts={})
|
479
527
|
txn_type = opts.fetch(:transaction_type, "Other")
|
480
528
|
counts = opts.fetch(:counts, nil)
|
@@ -20,6 +20,16 @@ class JSONWrapperTest < Minitest::Test
|
|
20
20
|
assert(obj == copy)
|
21
21
|
end
|
22
22
|
|
23
|
+
def test_normalize_converts_symbol_values_to_strings
|
24
|
+
result = NewRelic::JSONWrapper.normalize([:foo, :bar])
|
25
|
+
assert_equal(['foo', 'bar'], result)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_normalize_converts_symbols_in_hash_to_strings
|
29
|
+
result = NewRelic::JSONWrapper.normalize({:key => :value})
|
30
|
+
assert_equal({'key' => 'value'}, result)
|
31
|
+
end
|
32
|
+
|
23
33
|
if NewRelic::LanguageSupport.supports_string_encodings?
|
24
34
|
def test_normalize_string_returns_input_if_correctly_encoded_utf8
|
25
35
|
string = "i want a pony"
|
@@ -72,10 +82,5 @@ class JSONWrapperTest < Minitest::Test
|
|
72
82
|
expected = [string.dup.force_encoding('ISO-8859-1').encode('UTF-8')]
|
73
83
|
assert_equal(expected, decoded)
|
74
84
|
end
|
75
|
-
|
76
|
-
def test_normalize_converts_symbols_to_strings
|
77
|
-
result = NewRelic::JSONWrapper.normalize([:foo, :bar])
|
78
|
-
assert_equal(['foo', 'bar'], result)
|
79
|
-
end
|
80
85
|
end
|
81
86
|
end
|
@@ -53,7 +53,8 @@ class RackMiddleware < Performance::TestCase
|
|
53
53
|
:application_id => '5, 6', # collector can return app multiple ids
|
54
54
|
:'rum.enabled' => true,
|
55
55
|
:episodes_file => 'this_is_my_file',
|
56
|
-
:license_key => 'a' * 40
|
56
|
+
:license_key => 'a' * 40,
|
57
|
+
:developer_mode => false
|
57
58
|
}
|
58
59
|
NewRelic::Agent.config.add_config_for_testing(@config)
|
59
60
|
|
@@ -19,7 +19,8 @@ class RumAutoInsertion < Performance::TestCase
|
|
19
19
|
:application_id => '5, 6', # collector can return app multiple ids
|
20
20
|
:'rum.enabled' => true,
|
21
21
|
:episodes_file => 'this_is_my_file',
|
22
|
-
:license_key => 'a' * 40
|
22
|
+
:license_key => 'a' * 40,
|
23
|
+
:js_agent_loader => 'loader'
|
23
24
|
}
|
24
25
|
NewRelic::Agent.config.add_config_for_testing(@config)
|
25
26
|
|
@@ -27,6 +28,17 @@ class RumAutoInsertion < Performance::TestCase
|
|
27
28
|
@html = "<html><head>#{'<script>alert("boo");</script>' * 1_000}</head><body></body></html>"
|
28
29
|
@html_with_meta = "<html><head><meta http-equiv='X-UA-Compatible' content='IE=7'/>#{'<script>alert("boo");</script>' * 1_000}</head><body></body></html>"
|
29
30
|
@html_with_meta_after = "<html><head>#{'<script>alert("boo");</script>' * 1_000}<meta http-equiv='X-UA-Compatible' content='IE=7'/></head><body></body></html>"
|
31
|
+
|
32
|
+
host_class = Class.new do
|
33
|
+
include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation
|
34
|
+
|
35
|
+
def run
|
36
|
+
yield
|
37
|
+
end
|
38
|
+
add_transaction_tracer :run
|
39
|
+
end
|
40
|
+
|
41
|
+
@host = host_class.new
|
30
42
|
end
|
31
43
|
|
32
44
|
def teardown
|
@@ -46,8 +58,10 @@ class RumAutoInsertion < Performance::TestCase
|
|
46
58
|
end
|
47
59
|
|
48
60
|
def run_autoinstrument_source(text)
|
49
|
-
|
50
|
-
|
61
|
+
@host.run do
|
62
|
+
iterations.times do
|
63
|
+
browser_monitor.autoinstrument_source([text], {})
|
64
|
+
end
|
51
65
|
end
|
52
66
|
end
|
53
67
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
# This file is distributed under New Relic's license terms.
|
4
|
+
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
5
|
+
|
6
|
+
require 'digest'
|
7
|
+
|
8
|
+
path = ARGV
|
9
|
+
|
10
|
+
def usage
|
11
|
+
$stderr.puts "Usage: path_hash.rb '<app_name>;<txn_name>' ['<app_name>;<txn_name>'...]"
|
12
|
+
exit
|
13
|
+
end
|
14
|
+
|
15
|
+
usage unless path.size > 0
|
16
|
+
|
17
|
+
path_hash = 0
|
18
|
+
path.each do |hop|
|
19
|
+
app_name, transaction_name = hop.split(';')
|
20
|
+
|
21
|
+
if !app_name || !transaction_name
|
22
|
+
$stderr.puts ''
|
23
|
+
$stderr.puts "Error: Malformed transaction identifier '#{hop}'."
|
24
|
+
usage
|
25
|
+
end
|
26
|
+
|
27
|
+
identifier = "#{app_name};#{transaction_name}"
|
28
|
+
md5sum = Digest::MD5.digest(identifier)
|
29
|
+
low4_of_md5 = md5sum.unpack("@12N").first
|
30
|
+
|
31
|
+
rotated_path_hash = ((path_hash << 1) | (path_hash >> 31)) & 0xffffffff
|
32
|
+
|
33
|
+
xor_result = rotated_path_hash ^ low4_of_md5
|
34
|
+
|
35
|
+
puts '--'
|
36
|
+
puts "A: txnIdentifier: '#{identifier}'"
|
37
|
+
puts "B: MD5(A): #{Digest::MD5.hexdigest(identifier)}"
|
38
|
+
puts "C: Low 4 bytes of B: 0x#{low4_of_md5.to_s(16).rjust(8, '0')} (0b#{low4_of_md5.to_s(2).rjust(32, '0')})"
|
39
|
+
puts ''
|
40
|
+
puts "D: Input path_hash: 0x#{path_hash.to_s(16).rjust(8, '0')} (0b#{path_hash.to_s(2).rjust(32, '0')})"
|
41
|
+
puts "E: Rotated E: 0x#{rotated_path_hash.to_s(16).rjust(8, '0')} (0b#{rotated_path_hash.to_s(2).rjust(32, '0')})"
|
42
|
+
puts ""
|
43
|
+
puts "F: XOR(D, F): 0x#{xor_result.to_s(16).rjust(8, '0')} (0b#{xor_result.to_s(2).rjust(32, '0')})"
|
44
|
+
puts '--'
|
45
|
+
|
46
|
+
path_hash = xor_result
|
47
|
+
end
|
48
|
+
|
49
|
+
puts "Final result: 0x#{path_hash.to_s(16).rjust(8, '0')}"
|
data/test/test_helper.rb
CHANGED
@@ -161,16 +161,6 @@ def fixture_tcp_socket( response )
|
|
161
161
|
return socket
|
162
162
|
end
|
163
163
|
|
164
|
-
def cross_agent_tests_dir
|
165
|
-
File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'cross_agent_tests'))
|
166
|
-
end
|
167
|
-
|
168
|
-
def load_cross_agent_test(name)
|
169
|
-
test_file_path = File.join(cross_agent_tests_dir, "#{name}.json")
|
170
|
-
data = File.read(test_file_path)
|
171
|
-
NewRelic::JSONWrapper.load(data)
|
172
|
-
end
|
173
|
-
|
174
164
|
def dummy_mysql_explain_result(hash=nil)
|
175
165
|
hash ||= {
|
176
166
|
'Id' => '1',
|
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.9.
|
4
|
+
version: 3.9.1.236
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -41,7 +41,7 @@ cert_chain:
|
|
41
41
|
K0ZZTXduQWIrVm1OT2h2MVMrc0poYmpaMzBQS2d6NnZMaFQ2dW5pZUNqTGs5
|
42
42
|
d0dHbWxTSwpZamJudkE5cXJhTExhalNqCi0tLS0tRU5EIENFUlRJRklDQVRF
|
43
43
|
LS0tLS0K
|
44
|
-
date: 2014-
|
44
|
+
date: 2014-07-28 00:00:00.000000000 Z
|
45
45
|
dependencies:
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: rake
|
@@ -271,6 +271,7 @@ files:
|
|
271
271
|
- lib/new_relic/agent/configuration.rb
|
272
272
|
- lib/new_relic/agent/configuration/default_source.rb
|
273
273
|
- lib/new_relic/agent/configuration/environment_source.rb
|
274
|
+
- lib/new_relic/agent/configuration/high_security_source.rb
|
274
275
|
- lib/new_relic/agent/configuration/manager.rb
|
275
276
|
- lib/new_relic/agent/configuration/mask_defaults.rb
|
276
277
|
- lib/new_relic/agent/configuration/server_source.rb
|
@@ -544,6 +545,7 @@ files:
|
|
544
545
|
- test/environments/rails41/config/environment.rb
|
545
546
|
- test/environments/rails41/db/schema.rb
|
546
547
|
- test/fixtures/cross_agent_tests/README.md
|
548
|
+
- test/fixtures/cross_agent_tests/cat_map.json
|
547
549
|
- test/fixtures/cross_agent_tests/postgres_explain_obfuscation/basic_where.colon_obfuscated.txt
|
548
550
|
- test/fixtures/cross_agent_tests/postgres_explain_obfuscation/basic_where.explain.txt
|
549
551
|
- test/fixtures/cross_agent_tests/postgres_explain_obfuscation/basic_where.obfuscated.txt
|
@@ -748,6 +750,9 @@ files:
|
|
748
750
|
- test/multiverse/suites/excon/Envfile
|
749
751
|
- test/multiverse/suites/excon/config/newrelic.yml
|
750
752
|
- test/multiverse/suites/excon/excon_test.rb
|
753
|
+
- test/multiverse/suites/high_security/Envfile
|
754
|
+
- test/multiverse/suites/high_security/config/newrelic.yml
|
755
|
+
- test/multiverse/suites/high_security/high_security_test.rb
|
751
756
|
- test/multiverse/suites/httpclient/Envfile
|
752
757
|
- test/multiverse/suites/httpclient/config/newrelic.yml
|
753
758
|
- test/multiverse/suites/httpclient/httpclient_test.rb
|
@@ -774,6 +779,7 @@ files:
|
|
774
779
|
- test/multiverse/suites/rack/rack_unsupported_version_test.rb
|
775
780
|
- test/multiverse/suites/rack/url_map_test.rb
|
776
781
|
- test/multiverse/suites/rails/Envfile
|
782
|
+
- test/multiverse/suites/rails/action_controller_live_rum_test.rb
|
777
783
|
- test/multiverse/suites/rails/app.rb
|
778
784
|
- test/multiverse/suites/rails/app/views/foos/_foo.html.haml
|
779
785
|
- test/multiverse/suites/rails/app/views/views/_a_partial.html.erb
|
@@ -866,6 +872,7 @@ files:
|
|
866
872
|
- test/new_relic/agent/commands/xray_session_test.rb
|
867
873
|
- test/new_relic/agent/configuration/default_source_test.rb
|
868
874
|
- test/new_relic/agent/configuration/environment_source_test.rb
|
875
|
+
- test/new_relic/agent/configuration/high_security_source_test.rb
|
869
876
|
- test/new_relic/agent/configuration/manager_test.rb
|
870
877
|
- test/new_relic/agent/configuration/orphan_configuration_test.rb
|
871
878
|
- test/new_relic/agent/configuration/server_source_test.rb
|
@@ -893,6 +900,7 @@ files:
|
|
893
900
|
- test/new_relic/agent/instrumentation/instrumentation_test.rb
|
894
901
|
- test/new_relic/agent/instrumentation/metric_frame_test.rb
|
895
902
|
- test/new_relic/agent/instrumentation/middleware_proxy_test.rb
|
903
|
+
- test/new_relic/agent/instrumentation/middleware_tracing_test.rb
|
896
904
|
- test/new_relic/agent/instrumentation/net_instrumentation_test.rb
|
897
905
|
- test/new_relic/agent/instrumentation/queue_time_test.rb
|
898
906
|
- test/new_relic/agent/instrumentation/rack_test.rb
|
@@ -1032,6 +1040,7 @@ files:
|
|
1032
1040
|
- test/script/ci_agent-tests_runner.sh
|
1033
1041
|
- test/script/ci_bench.sh
|
1034
1042
|
- test/script/ci_multiverse_runner.sh
|
1043
|
+
- test/script/path_hash.rb
|
1035
1044
|
- test/test_helper.rb
|
1036
1045
|
- ui/helpers/developer_mode_helper.rb
|
1037
1046
|
- ui/helpers/google_pie_chart.rb
|
@@ -1118,56 +1127,7 @@ licenses:
|
|
1118
1127
|
- New Relic
|
1119
1128
|
- MIT
|
1120
1129
|
- Ruby
|
1121
|
-
post_install_message:
|
1122
|
-
Rack middleware instrumentation\n\n The Ruby agent now automatically instruments
|
1123
|
-
Rack middlewares!\n\n This means that the agent can now give you a more complete
|
1124
|
-
picture of your\n application's response time, including time spent in middleware.
|
1125
|
-
It also means\n that requests which previously weren't captured by the agent because
|
1126
|
-
they\n never made it to the bottom of your middleware stack (usually a Rails or\n
|
1127
|
-
\ Sinatra application) will now be captured.\n\n After installing this version
|
1128
|
-
of the Ruby agent, you'll see a new 'Middleware'\n band on your application's overview
|
1129
|
-
graph, and individual middlewares will\n appear in transaction breakdown charts
|
1130
|
-
and transaction traces.\n\n The agent can instrument middlewares that are added
|
1131
|
-
from a config.ru file via\n Rack::Builder, or via Rails' middleware stack in Rails
|
1132
|
-
3.0+.\n\n This instrumentation may be disabled with the\n disable_middlware_instrumentation
|
1133
|
-
configuration setting.\n\n For more details, see the documentation for this feature:\n\n
|
1134
|
-
\ - http://docs.newrelic.com/docs/ruby/rack-middlewares\n - http://docs.newrelic.com/docs/ruby/middleware-upgrade-changes\n\n*
|
1135
|
-
Capistrano 3.x support\n\n Recording application deployments using Capistrano 3.x
|
1136
|
-
is now supported.\n\n Many thanks to Jennifer Page for the contribution!\n\n* Better
|
1137
|
-
support for Sidekiq's Delayed extensions\n\n Sidekiq jobs executed via the Delayed
|
1138
|
-
extensions (e.g. the #delay method) will\n now be named after the actual class
|
1139
|
-
that #delay was invoked against, and will\n have their job arguments correctly
|
1140
|
-
captured if the sidekiq.capture_params\n configuration setting is enabled.\n\n
|
1141
|
-
\ Many thanks to printercu for the contribution!\n\n* Improved Apdex calculation
|
1142
|
-
with ignored error classes\n\n Previously, a transaction resulting in an exception
|
1143
|
-
that bubbled up to the top\n level would always be counted as failing for the purposes
|
1144
|
-
of Apdex\n calculations (unless the transaction name was ignored entirely). Now,\n
|
1145
|
-
\ exceptions whose classes have been ignored by the\n error_collector.ignore_errors
|
1146
|
-
configuration setting will not cause a\n transaction to be automatically counted
|
1147
|
-
as failing.\n\n* Allow URIs that are not parseable by stdlib's URI if addressable
|
1148
|
-
is present\n\n There are some URIs that are valid by RFC 3986, but not parseable
|
1149
|
-
by Ruby's\n stdlib URI class. The Ruby agent will now attempt to use the addressable
|
1150
|
-
gem\n to parse URIs if it is present, allowing requests against these problematic\n
|
1151
|
-
\ URIs to be instrumented.\n\n Many thanks to Craig R Webster and Amir Yalon for
|
1152
|
-
their help with this issue!\n\n* More robust error collection from Resque processes\n\n
|
1153
|
-
\ Previously, traced errors where the exception class was defined in the Resque\n
|
1154
|
-
\ worker but not in the Resque master process would not be correctly handled by\n
|
1155
|
-
\ the agent. This has been fixed.\n\n* Allow Sinatra apps to set the New Relic environment
|
1156
|
-
without setting RACK_ENV\n\n The NEW_RELIC_ENV environment variable may now be
|
1157
|
-
used to specify the\n environment the agent should use from its configuration file,
|
1158
|
-
independently of\n RACK_ENV.\n\n Many thanks to Mario Izquierdo for the contribution!\n\n*
|
1159
|
-
Better error handling in Browser Application Monitoring injection\n\n The agent
|
1160
|
-
middleware that injects the JavaScript code necessary for Browser\n Application
|
1161
|
-
Monitoring now does a better job of catching errors that might\n occur during the
|
1162
|
-
injection process.\n\n* Allow disabling of Net::HTTP instrumentation\n\n Most instrumentation
|
1163
|
-
in the Ruby agent can be disabled easily via a\n configuration setting. Our Net::HTTP
|
1164
|
-
instrumentation was previously an\n exception, but now it can also be disabled
|
1165
|
-
with the disable_net_http\n configuration setting.\n\n* Make Rails constant presence
|
1166
|
-
check more defensive\n\n The Ruby agent now guards against the (rare) case where
|
1167
|
-
an application has a\n Rails constant defined, but no Rails::VERSION constant (because
|
1168
|
-
Rails is not\n actually present).\n\n Many thanks to Vladimir Kiselev for the
|
1169
|
-
contribution!\n\n See https://github.com/newrelic/rpm/blob/master/CHANGELOG for
|
1170
|
-
a full list of\n changes.\n"
|
1130
|
+
post_install_message:
|
1171
1131
|
rdoc_options: []
|
1172
1132
|
require_paths:
|
1173
1133
|
- lib
|