newrelic_rpm 3.9.5.251 → 3.9.6.257
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 +74 -3
- data/GUIDELINES_FOR_CONTRIBUTING.md +19 -15
- data/README.md +1 -1
- data/Rakefile +22 -1
- data/lib/new_relic/agent/agent.rb +17 -5
- data/lib/new_relic/agent/agent_logger.rb +4 -0
- data/lib/new_relic/agent/configuration/default_source.rb +45 -1
- data/lib/new_relic/agent/configuration/manager.rb +43 -7
- data/lib/new_relic/agent/cross_app_monitor.rb +0 -3
- data/lib/new_relic/agent/cross_app_tracing.rb +8 -5
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +4 -1
- data/lib/new_relic/agent/instrumentation/active_job.rb +93 -0
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +2 -1
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +2 -2
- data/lib/new_relic/agent/instrumentation/sinatra.rb +1 -2
- data/lib/new_relic/agent/new_relic_service.rb +1 -1
- data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +20 -1
- data/lib/new_relic/agent/new_relic_service/pruby_marshaller.rb +5 -1
- data/lib/new_relic/agent/pipe_channel_manager.rb +32 -11
- data/lib/new_relic/agent/threading/agent_thread.rb +1 -1
- data/lib/new_relic/agent/threading/backtrace_node.rb +4 -3
- data/lib/new_relic/agent/transaction.rb +27 -6
- data/lib/new_relic/agent/transaction_state.rb +3 -3
- data/lib/new_relic/agent/vm/mri_vm.rb +3 -3
- data/lib/new_relic/control/frameworks/rails3.rb +1 -16
- data/lib/new_relic/control/instance_methods.rb +2 -0
- data/lib/new_relic/json_wrapper.rb +18 -3
- data/lib/new_relic/rack/browser_monitoring.rb +7 -5
- data/lib/new_relic/rack/developer_mode.rb +2 -0
- data/lib/new_relic/rack/error_collector.rb +12 -51
- data/lib/new_relic/transaction_sample.rb +0 -4
- data/lib/new_relic/transaction_sample/segment.rb +0 -4
- data/lib/new_relic/version.rb +1 -1
- data/newrelic_rpm.gemspec +3 -2
- data/test/agent_helper.rb +1 -1
- data/test/config/test.cert.crt +16 -12
- data/test/config/test.cert.key +13 -13
- data/test/environments/lib/environments/runner.rb +3 -0
- data/test/environments/rails30/Gemfile +2 -2
- data/test/environments/rails31/Gemfile +2 -2
- data/test/environments/rails32/Gemfile +2 -2
- data/test/environments/rails40/Gemfile +2 -4
- data/test/environments/rails41/Gemfile +2 -4
- data/test/environments/rails42/Gemfile +2 -4
- data/test/fixtures/cross_agent_tests/attribute_configuration.json +349 -0
- data/test/fixtures/cross_agent_tests/labels.json +31 -2
- data/test/fixtures/cross_agent_tests/postgres_explain_obfuscation/README.md +16 -0
- data/test/fixtures/cross_agent_tests/rum_client_config.json +9 -9
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/empty_head +4 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/no_end_header.html +6 -0
- data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/x_ua_meta_tag_multiple_tags.html +12 -0
- data/test/multiverse/lib/multiverse/runner.rb +33 -1
- data/test/multiverse/lib/multiverse/suite.rb +79 -7
- data/test/multiverse/suites/active_record/Envfile +1 -1
- data/test/multiverse/suites/agent_only/encoding_handling_test.rb +1 -1
- data/test/multiverse/suites/agent_only/labels_test.rb +2 -1
- data/test/multiverse/suites/agent_only/set_transaction_name_test.rb +2 -3
- data/test/multiverse/suites/agent_only/thread_profiling_test.rb +6 -6
- data/test/multiverse/suites/capistrano/Envfile +2 -2
- data/test/multiverse/suites/capistrano2/Envfile +4 -0
- data/test/multiverse/suites/curb/Envfile +4 -0
- data/test/multiverse/suites/high_security/config/newrelic.yml +5 -2
- data/test/multiverse/suites/high_security/high_security_test.rb +10 -8
- data/test/multiverse/suites/json/Envfile +23 -0
- data/test/multiverse/suites/json/config/newrelic.yml +22 -0
- data/test/multiverse/suites/json/json_test.rb +17 -0
- data/test/multiverse/suites/marshalling/marshalling_test.rb +2 -45
- data/test/multiverse/suites/rails/Envfile +3 -3
- data/test/multiverse/suites/rails/activejob_test.rb +137 -0
- data/test/multiverse/suites/rails/error_tracing_test.rb +15 -8
- data/test/multiverse/suites/rails/parameter_capture_test.rb +39 -19
- data/test/multiverse/suites/sequel/Envfile +5 -5
- data/test/multiverse/suites/sidekiq/Envfile +2 -2
- data/test/multiverse/suites/sinatra/Envfile +2 -1
- data/test/multiverse/suites/yajl/Envfile +13 -0
- data/test/multiverse/suites/yajl/config/newrelic.yml +21 -0
- data/test/multiverse/suites/yajl/yajl_test.rb +19 -0
- data/test/new_relic/agent/agent_logger_test.rb +10 -0
- data/test/new_relic/agent/agent_test.rb +7 -1
- data/test/new_relic/agent/configuration/default_source_test.rb +24 -0
- data/test/new_relic/agent/configuration/manager_test.rb +60 -2
- data/test/new_relic/agent/configuration/orphan_configuration_test.rb +25 -13
- data/test/new_relic/agent/cross_app_tracing_test.rb +10 -1
- data/test/new_relic/agent/instrumentation/active_job_test.rb +20 -0
- data/test/new_relic/agent/instrumentation/active_record_test.rb +10 -17
- data/test/new_relic/agent/instrumentation/controller_instrumentation_test.rb +15 -0
- data/test/new_relic/agent/instrumentation/sinatra_test.rb +1 -1
- data/test/new_relic/agent/new_relic_service_test.rb +24 -0
- data/test/new_relic/agent/pipe_channel_manager_test.rb +44 -2
- data/test/new_relic/agent/threading/agent_thread_test.rb +1 -2
- data/test/new_relic/agent/threading/backtrace_node_test.rb +12 -0
- data/test/new_relic/agent/transaction_state_test.rb +3 -6
- data/test/new_relic/agent/transaction_test.rb +163 -0
- data/test/new_relic/agent_test.rb +13 -1
- data/test/new_relic/fake_collector.rb +5 -5
- data/test/new_relic/fake_server.rb +5 -3
- data/test/new_relic/http_client_test_cases.rb +0 -4
- data/test/new_relic/marshalling_test_cases.rb +54 -0
- data/test/new_relic/multiverse_helpers.rb +2 -2
- data/test/new_relic/rack/browser_monitoring_test.rb +6 -0
- data/test/new_relic/rack/developer_mode_test.rb +8 -0
- data/test/new_relic/rack/error_collector_test.rb +0 -41
- data/test/new_relic/transaction_sample/segment_test.rb +0 -13
- data/test/new_relic/transaction_sample_test.rb +1 -11
- data/test/performance/lib/performance/instrumentation/perf_tools.rb +1 -1
- data/test/performance/lib/performance/runner.rb +1 -1
- data/test/performance/script/runner +2 -1
- data/test/performance/suites/rum_autoinsertion.rb +12 -2
- metadata +24 -11
- metadata.gz.sig +0 -0
- data/test/config/test.cert.csr +0 -11
- data/test/config/testing-privkey.pem +0 -18
@@ -0,0 +1,6 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
3
|
+
<head>EXPECTED_RUM_LOADER_LOCATION<body>
|
4
|
+
Cribbed from the Java agent
|
5
|
+
</body>
|
6
|
+
</html>
|
data/test/fixtures/cross_agent_tests/rum_loader_insertion_location/x_ua_meta_tag_multiple_tags.html
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>im a title</title>
|
4
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>EXPECTED_RUM_LOADER_LOCATION
|
5
|
+
<meta name="keywords" content="testing,rum,insertion" >
|
6
|
+
<script>
|
7
|
+
junk
|
8
|
+
</script>
|
9
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
|
10
|
+
</head>
|
11
|
+
<body>im some body text</body>
|
12
|
+
</html>
|
@@ -62,7 +62,7 @@ module Multiverse
|
|
62
62
|
full_path = File.join(SUITES_DIRECTORY, dir)
|
63
63
|
|
64
64
|
next if dir =~ /\A\./
|
65
|
-
next unless
|
65
|
+
next unless passes_filter?(dir, filter)
|
66
66
|
next unless File.exists?(File.join(full_path, "Envfile"))
|
67
67
|
|
68
68
|
begin
|
@@ -80,5 +80,37 @@ module Multiverse
|
|
80
80
|
OutputCollector.overall_report
|
81
81
|
exit exit_status
|
82
82
|
end
|
83
|
+
|
84
|
+
GROUPS = {
|
85
|
+
"agent" => ["agent_only", "bare", "config_file_loading",
|
86
|
+
"deferred_instrumentation", "high_security"],
|
87
|
+
"background" => ["resque", "sidekiq"],
|
88
|
+
"database" => ["datamapper", "mongo", "sequel"],
|
89
|
+
"httpclients" => ["curb", "excon", "httpclient", "typhoeus", "net_http"],
|
90
|
+
"rails" => ["active_record", "rails"],
|
91
|
+
"serialization" => ["json", "marshalling", "yajl"],
|
92
|
+
"sinatra" => ["sinatra", "padrino"],
|
93
|
+
|
94
|
+
"rest" => [] # Specially handled below
|
95
|
+
}
|
96
|
+
|
97
|
+
def passes_filter?(dir, filter)
|
98
|
+
return true if filter.nil?
|
99
|
+
|
100
|
+
if filter.include?("group=")
|
101
|
+
key = filter.sub("group=", "")
|
102
|
+
group = GROUPS[key]
|
103
|
+
if group.nil?
|
104
|
+
puts red("Unrecognized group '#{key}'. Stopping!")
|
105
|
+
exit 1
|
106
|
+
elsif group.any?
|
107
|
+
GROUPS[key].include?(dir)
|
108
|
+
else
|
109
|
+
!GROUPS.values.flatten.include?(dir)
|
110
|
+
end
|
111
|
+
else
|
112
|
+
dir.include?(filter)
|
113
|
+
end
|
114
|
+
end
|
83
115
|
end
|
84
116
|
end
|
@@ -8,6 +8,8 @@
|
|
8
8
|
# Rubies starting with 1.9.x
|
9
9
|
require 'rubygems'
|
10
10
|
require 'base64'
|
11
|
+
require 'fileutils'
|
12
|
+
require 'digest'
|
11
13
|
|
12
14
|
require File.expand_path(File.join(File.dirname(__FILE__), 'environment'))
|
13
15
|
|
@@ -46,6 +48,10 @@ module Multiverse
|
|
46
48
|
opts.fetch(:names, [])
|
47
49
|
end
|
48
50
|
|
51
|
+
def use_cache?
|
52
|
+
!opts.fetch(:nocache, false)
|
53
|
+
end
|
54
|
+
|
49
55
|
def filter_env
|
50
56
|
value = opts.fetch(:env, nil)
|
51
57
|
value = value.to_i if value
|
@@ -60,11 +66,14 @@ module Multiverse
|
|
60
66
|
FileUtils.rm_rf File.join(directory, "Gemfile.#{env_index}.lock")
|
61
67
|
end
|
62
68
|
|
69
|
+
def envfile_path
|
70
|
+
File.join(directory, 'Envfile')
|
71
|
+
end
|
63
72
|
|
64
73
|
def environments
|
65
74
|
@environments ||= (
|
66
75
|
Dir.chdir directory
|
67
|
-
Envfile.new(
|
76
|
+
Envfile.new(envfile_path)
|
68
77
|
)
|
69
78
|
end
|
70
79
|
|
@@ -74,30 +83,93 @@ module Multiverse
|
|
74
83
|
clean_gemfiles(env_index)
|
75
84
|
begin
|
76
85
|
generate_gemfile(gemfile_text, env_index)
|
77
|
-
|
86
|
+
ensure_bundle(env_index)
|
78
87
|
rescue => e
|
79
88
|
puts "#{e.class}: #{e}"
|
80
89
|
puts "Fast local bundle failed. Attempting to install from rubygems.org"
|
81
90
|
clean_gemfiles(env_index)
|
82
91
|
generate_gemfile(gemfile_text, env_index, false)
|
83
|
-
|
92
|
+
ensure_bundle(env_index)
|
84
93
|
end
|
85
94
|
print_environment if should_print
|
86
95
|
end
|
87
96
|
|
88
|
-
def
|
97
|
+
def bundling_lock_file
|
98
|
+
File.join(Bundler.bundle_path, 'multiverse-bundler.lock')
|
99
|
+
end
|
100
|
+
|
101
|
+
def bundler_cache_dir
|
102
|
+
File.join(Bundler.bundle_path, 'multiverse-cache')
|
103
|
+
end
|
104
|
+
|
105
|
+
# Running the bundle should only happen one at a time per Ruby version or
|
106
|
+
# we occasionally get compilation errors. With the groups and parallelizing
|
107
|
+
# things out more, this is more of an issue, so start locking it down.
|
108
|
+
def exclusive_bundle
|
109
|
+
bundler_out = nil
|
110
|
+
File.open(bundling_lock_file, File::RDWR|File::CREAT) do |f|
|
111
|
+
puts "Waiting on '#{bundling_lock_file}' for our chance to bundle" if verbose?
|
112
|
+
f.flock(File::LOCK_EX)
|
113
|
+
puts "Let's get ready to BUNDLE!" if verbose?
|
114
|
+
bundler_out = `bundle`
|
115
|
+
end
|
116
|
+
bundler_out
|
117
|
+
end
|
118
|
+
|
119
|
+
def ensure_bundle(env_index)
|
89
120
|
require 'rubygems'
|
90
121
|
require 'bundler'
|
91
|
-
|
122
|
+
if use_cache?
|
123
|
+
ensure_bundle_cached(env_index) || ensure_bundle_uncached(env_index)
|
124
|
+
else
|
125
|
+
ensure_bundle_uncached(env_index)
|
126
|
+
end
|
127
|
+
Bundler.require
|
128
|
+
end
|
129
|
+
|
130
|
+
def envfile_hash
|
131
|
+
Digest::MD5.hexdigest(File.read(envfile_path))
|
132
|
+
end
|
133
|
+
|
134
|
+
def cached_gemfile_lock_filename(env_index)
|
135
|
+
"Gemfile.#{suite}.#{env_index}.#{envfile_hash}.lock"
|
136
|
+
end
|
137
|
+
|
138
|
+
def cache_gemfile_lock(env_index)
|
139
|
+
filename = cached_gemfile_lock_filename(env_index)
|
140
|
+
dst_path = File.join(bundler_cache_dir, filename)
|
141
|
+
src_path = File.join(directory, "Gemfile.#{env_index}.lock")
|
142
|
+
puts "Caching Gemfile.lock from #{src_path} to #{dst_path}" if verbose?
|
143
|
+
FileUtils.cp(src_path, dst_path)
|
144
|
+
end
|
145
|
+
|
146
|
+
def ensure_bundle_cached(env_index)
|
147
|
+
cache_dir = bundler_cache_dir
|
148
|
+
FileUtils.mkdir_p(cache_dir)
|
149
|
+
filename = cached_gemfile_lock_filename(env_index)
|
150
|
+
path = File.join(cache_dir, filename)
|
151
|
+
|
152
|
+
if File.exist?(path)
|
153
|
+
dst_path = File.join(directory, "Gemfile.#{env_index}.lock")
|
154
|
+
puts "Using cached Gemfile.lock from #{path} at #{dst_path}" if verbose?
|
155
|
+
FileUtils.cp(path, dst_path)
|
156
|
+
true
|
157
|
+
else
|
158
|
+
false
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def ensure_bundle_uncached(env_index)
|
163
|
+
bundler_out = exclusive_bundle
|
92
164
|
puts bundler_out if verbose? || $? != 0
|
93
165
|
raise "bundle command failed with (#{$?})" unless $? == 0
|
94
|
-
|
166
|
+
cache_gemfile_lock(env_index)
|
95
167
|
end
|
96
168
|
|
97
169
|
def generate_gemfile(gemfile_text, env_index, local = true)
|
98
170
|
gemfile = File.join(Dir.pwd, "Gemfile.#{env_index}")
|
99
171
|
File.open(gemfile,'w') do |f|
|
100
|
-
f.puts ' source
|
172
|
+
f.puts ' source "https://rubygems.org"' unless local
|
101
173
|
f.print gemfile_text
|
102
174
|
f.puts newrelic_gemfile_line unless gemfile_text =~ /^\s*gem .newrelic_rpm./
|
103
175
|
f.puts jruby_openssl_line unless gemfile_text =~ /^\s*gem .jruby-openssl./
|
@@ -88,7 +88,7 @@ class EncodingHandlingTest < Minitest::Test
|
|
88
88
|
|
89
89
|
def assert_endpoint_received_string(endpoint, string)
|
90
90
|
agent.send(:transmit_data)
|
91
|
-
agent.send(:
|
91
|
+
agent.send(:transmit_event_data)
|
92
92
|
requests = $collector.calls_for(endpoint)
|
93
93
|
assert_equal(1, requests.size)
|
94
94
|
request = requests.first
|
@@ -79,6 +79,7 @@ class LabelsTest < Minitest::Test
|
|
79
79
|
|
80
80
|
def assert_connect_had_labels(expected)
|
81
81
|
result = $collector.calls_for('connect').last['labels']
|
82
|
-
assert_equal expected,
|
82
|
+
assert_equal expected.sort_by { |h| h['label_type']},
|
83
|
+
result.sort_by { |h| h['label_type']}
|
83
84
|
end
|
84
85
|
end
|
@@ -41,9 +41,8 @@ class SetTransactionNameTest < Minitest::Test
|
|
41
41
|
|
42
42
|
assert_metrics_recorded([
|
43
43
|
'Controller/TestTransactor/parent',
|
44
|
-
'OtherTransaction/Background/TestTransactor/child',
|
45
|
-
['OtherTransaction/Background/TestTransactor/child',
|
46
|
-
'Controller/TestTransactor/parent'],
|
44
|
+
'Nested/OtherTransaction/Background/TestTransactor/child',
|
45
|
+
['Nested/OtherTransaction/Background/TestTransactor/child', 'Controller/TestTransactor/parent'],
|
47
46
|
'Apdex/TestTransactor/parent'])
|
48
47
|
end
|
49
48
|
|
@@ -61,8 +61,8 @@ class ThreadProfilingTest < Minitest::Test
|
|
61
61
|
# go only let a few cycles through, so we check less than 10
|
62
62
|
|
63
63
|
def test_thread_profiling
|
64
|
-
run_transaction_in_thread(:
|
65
|
-
run_transaction_in_thread(:
|
64
|
+
run_transaction_in_thread(:controller)
|
65
|
+
run_transaction_in_thread(:task)
|
66
66
|
|
67
67
|
issue_command(START_COMMAND)
|
68
68
|
|
@@ -80,8 +80,8 @@ class ThreadProfilingTest < Minitest::Test
|
|
80
80
|
|
81
81
|
def test_thread_profiling_with_pruby_marshaller
|
82
82
|
with_config(:marshaller => 'pruby') do
|
83
|
-
run_transaction_in_thread(:
|
84
|
-
run_transaction_in_thread(:
|
83
|
+
run_transaction_in_thread(:controller)
|
84
|
+
run_transaction_in_thread(:task)
|
85
85
|
|
86
86
|
issue_command(START_COMMAND)
|
87
87
|
|
@@ -118,11 +118,11 @@ class ThreadProfilingTest < Minitest::Test
|
|
118
118
|
end
|
119
119
|
|
120
120
|
# Runs a thread we expect to span entire test and be killed at the end
|
121
|
-
def run_transaction_in_thread(
|
121
|
+
def run_transaction_in_thread(category)
|
122
122
|
q = Queue.new
|
123
123
|
@threads ||= []
|
124
124
|
@threads << Thread.new do
|
125
|
-
in_transaction(
|
125
|
+
in_transaction(:category => category) do
|
126
126
|
q.push('.')
|
127
127
|
sleep # sleep until explicitly woken in join_background_threads
|
128
128
|
end
|
@@ -21,8 +21,12 @@ gemfile <<-RB
|
|
21
21
|
gem 'json', :platforms => [:rbx, :mri_18]
|
22
22
|
RB
|
23
23
|
|
24
|
+
# Older curb's than 0.8.6 don't build against Ruby 2.2.0-preview1
|
25
|
+
# Recheck on later RC's, but for now, just skip this env for Ruby 2.2.0
|
26
|
+
if RUBY_VERSION < "2.2.0"
|
24
27
|
gemfile <<-RB
|
25
28
|
gem 'curb', '0.8.1'
|
26
29
|
gem 'rack'
|
27
30
|
gem 'json', :platforms => [:rbx, :mri_18]
|
28
31
|
RB
|
32
|
+
end
|
@@ -20,8 +20,11 @@ development:
|
|
20
20
|
license_key: bootstrap_newrelic_admin_license_key_000
|
21
21
|
developer_mode: false
|
22
22
|
app_name: test
|
23
|
-
host:
|
24
|
-
api_host:
|
23
|
+
host: localhost
|
24
|
+
api_host: localhost
|
25
25
|
port: <%= $collector && $collector.port %>
|
26
26
|
browser_monitoring:
|
27
27
|
auto_instrument: true
|
28
|
+
|
29
|
+
# Fake collector uses SSL, and we want agent to trust its self-signed cert.
|
30
|
+
ca_bundle_path: ../../../config/test.cert.crt
|
@@ -3,6 +3,7 @@
|
|
3
3
|
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'multiverse_helpers'
|
6
|
+
require 'fake_server'
|
6
7
|
|
7
8
|
# These tests are designed to work in conjunction with a local newrelic.yml
|
8
9
|
# file set with "insecure" settings and the server returning "insecure" values,
|
@@ -12,12 +13,11 @@ class HighSecurityTest < Minitest::Test
|
|
12
13
|
|
13
14
|
include MultiverseHelpers
|
14
15
|
|
15
|
-
setup_and_teardown_agent do |
|
16
|
-
|
17
|
-
|
18
|
-
Net::HTTPSession.any_instance.expects('use_ssl=').with(true).at_least_once
|
16
|
+
setup_and_teardown_agent do |_collector|
|
17
|
+
$collector = nil
|
18
|
+
setup_collector(true)
|
19
19
|
|
20
|
-
collector.stub('connect', {
|
20
|
+
$collector.stub('connect', {
|
21
21
|
"agent_run_id" => 1,
|
22
22
|
"listen_to_server_config" => true,
|
23
23
|
|
@@ -28,9 +28,11 @@ class HighSecurityTest < Minitest::Test
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def test_connects_via_ssl_no_matter_what
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
assert_equal 1, $collector.calls_for('connect').size
|
32
|
+
|
33
|
+
trigger_agent_reconnect(:ssl => false)
|
34
|
+
|
35
|
+
assert_equal 2, $collector.calls_for('connect').size
|
34
36
|
end
|
35
37
|
|
36
38
|
def test_sends_high_security_flag_in_connect
|
@@ -0,0 +1,23 @@
|
|
1
|
+
all_versions = [ '~> 1.8.1', '~> 1.7.7', '~> 1.6.8', '~> 1.5.5' ]
|
2
|
+
before_2_0_0 = [ '~> 1.4.6', '~> 1.2.4', '~> 1.1.9' ]
|
3
|
+
before_1_9_2 = [ '1.1.2' ]
|
4
|
+
|
5
|
+
json_gems = all_versions.dup
|
6
|
+
json_gems += before_2_0_0 if RUBY_VERSION < '2.0.0'
|
7
|
+
json_gems += before_1_9_2 if RUBY_VERSION < '1.9.2'
|
8
|
+
|
9
|
+
if defined?(RUBY_ENGINE) && RUBY_ENGINE == "rbx"
|
10
|
+
json_gems.delete('~> 1.7.7')
|
11
|
+
end
|
12
|
+
|
13
|
+
if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
|
14
|
+
json_gems.delete('~> 1.2.4')
|
15
|
+
json_gems.delete('~> 1.1.9')
|
16
|
+
end
|
17
|
+
|
18
|
+
json_gems.each do |version|
|
19
|
+
gemfile <<-RB
|
20
|
+
gem 'rack'
|
21
|
+
gem 'json', '#{version}'
|
22
|
+
RB
|
23
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
development:
|
3
|
+
error_collector:
|
4
|
+
enabled: true
|
5
|
+
apdex_t: 0.24
|
6
|
+
ssl: false
|
7
|
+
log_level: debug
|
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
|
+
port: <%= $collector && $collector.port %>
|
15
|
+
transaction_tracer:
|
16
|
+
record_sql: obfuscated
|
17
|
+
enabled: true
|
18
|
+
stack_trace_threshold: 0.5
|
19
|
+
capture_params: false
|
20
|
+
browser_monitoring:
|
21
|
+
auto_instrument: true
|
22
|
+
marshaller: json
|
@@ -0,0 +1,17 @@
|
|
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 'multiverse_helpers'
|
6
|
+
require File.join(File.dirname(__FILE__), '..', '..', '..', 'new_relic', 'marshalling_test_cases')
|
7
|
+
|
8
|
+
# This is intended as a sanity check for our serialization to JSON via the
|
9
|
+
# json gem across various Ruby versions.
|
10
|
+
class JsonTest < Minitest::Test
|
11
|
+
|
12
|
+
include MultiverseHelpers
|
13
|
+
include MarshallingTestCases
|
14
|
+
|
15
|
+
setup_and_teardown_agent
|
16
|
+
|
17
|
+
end
|
@@ -3,58 +3,15 @@
|
|
3
3
|
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'multiverse_helpers'
|
6
|
+
require File.join(File.dirname(__FILE__), '..', '..', '..', 'new_relic', 'marshalling_test_cases')
|
6
7
|
|
7
8
|
# These tests are intended to exercise the basic marshalling functionality of
|
8
9
|
# the agent in it's different permutations (Ruby and JSON)
|
9
10
|
class MarshallingTest < Minitest::Test
|
10
11
|
|
11
12
|
include MultiverseHelpers
|
13
|
+
include MarshallingTestCases
|
12
14
|
|
13
15
|
setup_and_teardown_agent
|
14
16
|
|
15
|
-
def test_sends_metrics
|
16
|
-
NewRelic::Agent.record_metric('Boo', 42)
|
17
|
-
|
18
|
-
transmit_data
|
19
|
-
|
20
|
-
result = $collector.calls_for('metric_data')
|
21
|
-
assert_equal 1, result.length
|
22
|
-
assert_includes result.first.metric_names, 'Boo'
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_sends_errors
|
26
|
-
NewRelic::Agent.notice_error(StandardError.new("Boom"))
|
27
|
-
|
28
|
-
transmit_data
|
29
|
-
|
30
|
-
result = $collector.calls_for('error_data')
|
31
|
-
assert_equal 1, result.length
|
32
|
-
assert_equal 1, result.first.errors.length
|
33
|
-
assert_equal "StandardError", result.first.errors.first.exception_class_name
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_sends_transaction_traces
|
37
|
-
with_config(:'transaction_tracer.transaction_threshold' => -1.0) do
|
38
|
-
Transactioner.new.do_it
|
39
|
-
end
|
40
|
-
|
41
|
-
transmit_data
|
42
|
-
|
43
|
-
result = $collector.calls_for('transaction_sample_data')
|
44
|
-
assert_equal 1, result.length
|
45
|
-
assert_equal "Controller/MarshallingTest::Transactioner/do_it", result.first.metric_name
|
46
|
-
end
|
47
|
-
|
48
|
-
class Transactioner
|
49
|
-
include NewRelic::Agent::Instrumentation::ControllerInstrumentation
|
50
|
-
|
51
|
-
def do_it
|
52
|
-
end
|
53
|
-
|
54
|
-
add_transaction_tracer :do_it
|
55
|
-
end
|
56
|
-
|
57
|
-
def transmit_data
|
58
|
-
NewRelic::Agent.instance.send(:transmit_data)
|
59
|
-
end
|
60
17
|
end
|