newrelic_rpm 3.14.1.311 → 3.14.2.312
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +174 -11
- data/CHANGELOG +22 -0
- data/Rakefile +5 -0
- data/lib/new_relic/agent/agent.rb +22 -7
- data/lib/new_relic/agent/aws_info.rb +1 -1
- data/lib/new_relic/agent/custom_event_aggregator.rb +19 -44
- data/lib/new_relic/agent/error_event_aggregator.rb +11 -103
- data/lib/new_relic/agent/event_aggregator.rb +130 -0
- data/lib/new_relic/agent/event_buffer.rb +7 -0
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +18 -2
- data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +12 -4
- data/lib/new_relic/agent/new_relic_service.rb +6 -4
- data/lib/new_relic/agent/sampled_buffer.rb +9 -6
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +1 -2
- data/lib/new_relic/agent/stats_engine/stats_hash.rb +2 -1
- data/lib/new_relic/agent/supported_versions.rb +1 -1
- data/lib/new_relic/agent/synthetics_event_aggregator.rb +52 -0
- data/lib/new_relic/agent/synthetics_event_buffer.rb +0 -2
- data/lib/new_relic/agent/transaction.rb +14 -7
- data/lib/new_relic/agent/transaction/request_attributes.rb +7 -2
- data/lib/new_relic/agent/transaction_error_primitive.rb +72 -0
- data/lib/new_relic/agent/transaction_event_aggregator.rb +33 -210
- data/lib/new_relic/agent/transaction_event_primitive.rb +106 -0
- data/lib/new_relic/agent/transaction_event_recorder.rb +48 -0
- data/lib/new_relic/agent/transaction_metrics.rb +9 -1
- data/lib/new_relic/agent/transction_event_recorder.rb +35 -0
- data/lib/new_relic/recipes/capistrano3.rb +1 -1
- data/lib/new_relic/version.rb +1 -1
- data/lib/tasks/versions.html.erb +13 -11
- data/lib/tasks/versions.postface.html +8 -0
- data/lib/tasks/versions.preface.html +3 -0
- data/lib/tasks/versions.rake +15 -5
- data/test/agent_helper.rb +1 -1
- data/test/environments/rails31/Gemfile +2 -0
- data/test/environments/rails32/Gemfile +2 -0
- data/test/environments/rails32/Rakefile +2 -1
- data/test/environments/rails32/config/database.yml +1 -6
- data/test/multiverse/suites/active_record/Envfile +1 -0
- data/test/multiverse/suites/agent_only/agent_attributes_test.rb +18 -0
- data/test/multiverse/suites/agent_only/custom_analytics_events_test.rb +21 -6
- data/test/multiverse/suites/agent_only/error_events_test.rb +14 -6
- data/test/multiverse/suites/agent_only/transaction_events_test.rb +31 -0
- data/test/multiverse/suites/agent_only/utilization_data_collection_test.rb +2 -0
- data/test/multiverse/suites/capistrano/Envfile +9 -3
- data/test/multiverse/suites/capistrano2/Envfile +4 -0
- data/test/multiverse/suites/config_file_loading/Envfile +1 -1
- data/test/multiverse/suites/curb/Envfile +1 -1
- data/test/multiverse/suites/datamapper/Envfile +3 -0
- data/test/multiverse/suites/deferred_instrumentation/sinatra_test.rb +7 -3
- data/test/multiverse/suites/grape/grape_test.rb +2 -0
- data/test/multiverse/suites/padrino/Envfile +4 -3
- data/test/multiverse/suites/padrino/config/newrelic.yml +2 -0
- data/test/multiverse/suites/rack/config/newrelic.yml +18 -0
- data/test/multiverse/suites/rack/nested_non_rack_app_test.rb +1 -1
- data/test/multiverse/suites/rack/puma_rack_builder_test.rb +17 -14
- data/test/multiverse/suites/rack/rack_auto_instrumentation_test.rb +16 -13
- data/test/multiverse/suites/rack/rack_unsupported_version_test.rb +1 -1
- data/test/multiverse/suites/rails/Envfile +5 -0
- data/test/multiverse/suites/rails/parameter_capture_test.rb +9 -0
- data/test/multiverse/suites/rake/Envfile +2 -1
- data/test/multiverse/suites/redis/redis_instrumentation_test.rb +1 -1
- data/test/multiverse/suites/sidekiq/Envfile +18 -0
- data/test/multiverse/suites/sidekiq/sidekiq_instrumentation_test.rb +11 -10
- data/test/multiverse/suites/sidekiq/test_model.rb +12 -0
- data/test/multiverse/suites/sinatra/ignoring_test.rb +43 -25
- data/test/multiverse/suites/sinatra/nested_middleware_test.rb +10 -2
- data/test/multiverse/suites/sinatra/sinatra_classic_test.rb +4 -0
- data/test/multiverse/suites/sinatra/sinatra_metric_explosion_test.rb +8 -2
- data/test/multiverse/suites/sinatra/sinatra_modular_test.rb +4 -0
- data/test/multiverse/suites/sinatra/sinatra_parameter_capture_test.rb +2 -0
- data/test/multiverse/suites/sinatra/sinatra_test_cases.rb +79 -10
- data/test/new_relic/agent/agent_test.rb +3 -3
- data/test/new_relic/agent/aws_info_test.rb +1 -2
- data/test/new_relic/agent/configuration/orphan_configuration_test.rb +2 -0
- data/test/new_relic/agent/custom_event_aggregator_test.rb +43 -4
- data/test/new_relic/agent/error_collector_test.rb +1 -1
- data/test/new_relic/agent/error_event_aggregator_test.rb +13 -81
- data/test/new_relic/agent/event_aggregator_test.rb +178 -0
- data/test/new_relic/agent/event_buffer_test_cases.rb +16 -0
- data/test/new_relic/agent/instrumentation/sinatra/transaction_namer_test.rb +7 -0
- data/test/new_relic/agent/new_relic_service_test.rb +7 -1
- data/test/new_relic/agent/pipe_channel_manager_test.rb +45 -3
- data/test/new_relic/agent/rpm_agent_test.rb +1 -0
- data/test/new_relic/agent/stats_engine/stats_hash_test.rb +2 -2
- data/test/new_relic/agent/synthetics_event_aggregator_test.rb +179 -0
- data/test/new_relic/agent/transaction/request_attributes_test.rb +8 -0
- data/test/new_relic/agent/transaction_error_primitive_test.rb +117 -0
- data/test/new_relic/agent/transaction_event_aggregator_test.rb +148 -374
- data/test/new_relic/agent/transaction_event_primitive_test.rb +195 -0
- data/test/new_relic/agent/transaction_event_recorder_test.rb +80 -0
- data/test/new_relic/agent/transaction_metrics_test.rb +7 -7
- data/test/new_relic/agent/transaction_test.rb +4 -4
- data/test/new_relic/agent/utilization_data_test.rb +7 -7
- data/test/new_relic/fake_collector.rb +10 -17
- data/test/new_relic/license_test.rb +2 -0
- data/test/new_relic/marshalling_test_cases.rb +1 -1
- data/test/nullverse/default_source_require_test.rb +21 -0
- data/test/nullverse/nullverse_helper.rb +10 -0
- data/test/performance/suites/active_record.rb +1 -1
- data/test/performance/suites/sql_obfuscation.rb +7 -6
- data/test/script/ci.sh +10 -165
- data/test/script/install_mongodb.sh +6 -0
- metadata +21 -6
- data/test/script/build_test_gem.sh +0 -57
- data/test/script/ci_agent-tests_runner.sh +0 -82
- data/test/script/ci_bench.sh +0 -52
- data/test/script/ci_multiverse_runner.sh +0 -63
@@ -2,17 +2,23 @@ suite_condition("Capistrano 3 not supported in 1.8.7 and flaky on JRuby") do
|
|
2
2
|
RUBY_VERSION != '1.8.7' && RUBY_PLATFORM != 'java'
|
3
3
|
end
|
4
4
|
|
5
|
+
boilerplate = <<-BOILERPLATE
|
6
|
+
gem 'rack'
|
7
|
+
gem 'net-ssh', '2.9.2' if RUBY_VERSION <= '1.9.3'
|
8
|
+
gem 'i18n', '< 0.7.0' if RUBY_VERSION < '1.9.3'
|
9
|
+
BOILERPLATE
|
10
|
+
|
5
11
|
gemfile <<-RB
|
6
12
|
gem 'capistrano', '~>3.2.1'
|
7
|
-
|
13
|
+
#{boilerplate}
|
8
14
|
RB
|
9
15
|
|
10
16
|
gemfile <<-RB
|
11
17
|
gem 'capistrano', '~>3.1.0'
|
12
|
-
|
18
|
+
#{boilerplate}
|
13
19
|
RB
|
14
20
|
|
15
21
|
gemfile <<-RB
|
16
22
|
gem 'capistrano', '~>3.0.1'
|
17
|
-
|
23
|
+
#{boilerplate}
|
18
24
|
RB
|
@@ -3,7 +3,7 @@ omit_collector!
|
|
3
3
|
gemfile <<-RB
|
4
4
|
# stub file system so we can test that newrelic.yml can be loaded from
|
5
5
|
# various places.
|
6
|
-
gem 'fakefs', :require => 'fakefs/safe'
|
6
|
+
gem 'fakefs', '0.5.4', :require => 'fakefs/safe' # 0.5.4 required for 1.8.7 compatibility.
|
7
7
|
|
8
8
|
# Because we delay the agent, order of jruby-openssl matters
|
9
9
|
gem 'jruby-openssl', '~> 0.9.10', :platforms => [:jruby]
|
@@ -12,7 +12,7 @@ gemfile <<-RB
|
|
12
12
|
gem 'json', :platforms => [:rbx, :mri_18]
|
13
13
|
|
14
14
|
# We try translating URIs through Addressable if it's there, so test with it.
|
15
|
-
gem 'addressable', :require => 'addressable/uri'
|
15
|
+
gem 'addressable', '2.3.8', :require => 'addressable/uri' # addressable >= 2.4.0 does not support Ruby 1.8.7
|
16
16
|
RB
|
17
17
|
|
18
18
|
gemfile <<-RB
|
@@ -12,6 +12,7 @@ gemfile <<-RB
|
|
12
12
|
gem 'json', '>= 1.8.1'
|
13
13
|
gem 'datamapper', '~> 1.2.0', :require => 'data_mapper'
|
14
14
|
gem 'dm-ar-finders', '~> 1.2.0'
|
15
|
+
gem 'addressable', '2.3.8', :require => 'addressable/uri' # addressable >= 2.4.0 does not support Ruby 1.8.7
|
15
16
|
#{adapter_gems}
|
16
17
|
RB
|
17
18
|
|
@@ -19,12 +20,14 @@ if RUBY_VERSION < '2.0.0'
|
|
19
20
|
gemfile <<-RB
|
20
21
|
gem 'datamapper', '~> 1.1.0'
|
21
22
|
gem 'dm-ar-finders', '~> 1.1.0'
|
23
|
+
gem 'addressable', :require => 'addressable/uri'
|
22
24
|
#{adapter_gems}
|
23
25
|
RB
|
24
26
|
|
25
27
|
gemfile <<-RB
|
26
28
|
gem 'datamapper', '~> 1.0.2'
|
27
29
|
gem 'dm-ar-finders', '~> 1.0.2'
|
30
|
+
gem 'addressable', '2.3.8', :require => 'addressable/uri' # addressable >= 2.4.0 does not support Ruby 1.8.7
|
28
31
|
#{adapter_gems}
|
29
32
|
RB
|
30
33
|
end
|
@@ -2,12 +2,12 @@
|
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
3
|
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
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__), '..', '..', '..', 'helpers', 'exceptions'))
|
7
|
-
|
8
5
|
require 'newrelic_rpm'
|
9
6
|
require 'sinatra'
|
10
7
|
|
8
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'sinatra', 'sinatra_test_cases'))
|
9
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'helpers', 'exceptions'))
|
10
|
+
|
11
11
|
class DeferredSinatraTestApp < Sinatra::Base
|
12
12
|
include NewRelic::Agent::Instrumentation::Rack
|
13
13
|
include NewRelic::TestHelpers::Exceptions
|
@@ -25,6 +25,10 @@ class DeferredSinatraTestApp < Sinatra::Base
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
get '/' do
|
29
|
+
"root path"
|
30
|
+
end
|
31
|
+
|
28
32
|
get '/user/login' do
|
29
33
|
"please log in"
|
30
34
|
end
|
@@ -195,8 +195,10 @@ class GrapeTest < Minitest::Test
|
|
195
195
|
post '/grape_ape'
|
196
196
|
|
197
197
|
expected = {
|
198
|
+
"response.headers.contentLength" => last_response.content_length.to_i,
|
198
199
|
"response.headers.contentType" => last_response.content_type,
|
199
200
|
"request.headers.contentLength" => last_request.content_length.to_i,
|
201
|
+
"request.headers.contentType" => last_request.content_type,
|
200
202
|
"request.headers.host" => last_request.host,
|
201
203
|
"request.method" => last_request.request_method
|
202
204
|
}
|
@@ -1,14 +1,15 @@
|
|
1
|
+
if RUBY_VERSION > '1.8.7' # padrino-core 0.11.0 requires http_router 0.11.0 which has syntax errors in 1.8.7.
|
1
2
|
gemfile <<-RB
|
2
|
-
# Gemspec from rubygems on this version gets illformed warnings on 1.8.7
|
3
|
-
gem 'http_router', '0.11.0', :git => 'git://github.com/joshbuddy/http_router.git', :tag => 'v0.11.0'
|
4
|
-
|
5
3
|
gem 'activesupport', '~> 3'
|
6
4
|
gem 'padrino', '~> 0.11.0'
|
7
5
|
gem 'rack-test', :require => 'rack/test'
|
6
|
+
gem 'i18n', '< 0.7' if RUBY_VERSION < '1.9.3' # i18n >= 0.7.0 only works on Ruby 1.9.3 and newer
|
8
7
|
RB
|
8
|
+
end
|
9
9
|
|
10
10
|
gemfile <<-RB
|
11
11
|
gem 'activesupport', '~> 3'
|
12
12
|
gem 'padrino', '~> 0.10.0'
|
13
13
|
gem 'rack-test', :require => 'rack/test'
|
14
|
+
gem 'i18n', '< 0.7' if RUBY_VERSION < '1.9.3' # i18n >= 0.7.0 only works on Ruby 1.9.3 and newer
|
14
15
|
RB
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
development:
|
3
|
+
error_collector:
|
4
|
+
enabled: true
|
5
|
+
apdex_t: 0.5
|
6
|
+
ssl: false
|
7
|
+
monitor_mode: true
|
8
|
+
license_key: bootstrap_newrelic_admin_license_key_000
|
9
|
+
developer_mode: false
|
10
|
+
app_name: test
|
11
|
+
host: 127.0.0.1
|
12
|
+
api_host: 127.0.0.1
|
13
|
+
transaction_tracer:
|
14
|
+
record_sql: obfuscated
|
15
|
+
enabled: true
|
16
|
+
stack_trace_threshold: 0.5
|
17
|
+
transaction_threshold: 1.0
|
18
|
+
capture_params: false
|
@@ -58,7 +58,7 @@ class NestedNonRackAppTest < Minitest::Test
|
|
58
58
|
"Nested/Controller/Rack/NestedNonRackAppTest::RailsishApp/call",
|
59
59
|
["Nested/Controller/Rack/NestedNonRackAppTest::RailsishApp/call", "Controller/NestedNonRackAppTest::RailsishApp/inner"]
|
60
60
|
],
|
61
|
-
:ignore_filter => /^Supportability
|
61
|
+
:ignore_filter => /^Supportability/
|
62
62
|
)
|
63
63
|
end
|
64
64
|
end
|
@@ -62,20 +62,23 @@ class PumaRackBuilderTest < Minitest::Test
|
|
62
62
|
def test_puma_rack_builder_is_auto_instrumented
|
63
63
|
@app.call @env
|
64
64
|
|
65
|
-
assert_metrics_recorded_exclusive
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
65
|
+
assert_metrics_recorded_exclusive(
|
66
|
+
[
|
67
|
+
"Apdex",
|
68
|
+
"ApdexAll",
|
69
|
+
"HttpDispatcher",
|
70
|
+
"Middleware/all",
|
71
|
+
"Apdex/Rack/PumaRackBuilderTest::ExampleApp/call",
|
72
|
+
"Controller/Rack/PumaRackBuilderTest::ExampleApp/call",
|
73
|
+
"Middleware/Rack/PumaRackBuilderTest::MiddlewareOne/call",
|
74
|
+
"Middleware/Rack/PumaRackBuilderTest::MiddlewareTwo/call",
|
75
|
+
"Nested/Controller/Rack/PumaRackBuilderTest::ExampleApp/call",
|
76
|
+
["Middleware/Rack/PumaRackBuilderTest::MiddlewareOne/call", "Controller/Rack/PumaRackBuilderTest::ExampleApp/call"],
|
77
|
+
["Middleware/Rack/PumaRackBuilderTest::MiddlewareTwo/call", "Controller/Rack/PumaRackBuilderTest::ExampleApp/call"],
|
78
|
+
["Nested/Controller/Rack/PumaRackBuilderTest::ExampleApp/call", "Controller/Rack/PumaRackBuilderTest::ExampleApp/call"]
|
79
|
+
],
|
80
|
+
:ignore_filter => /^Supportability/
|
81
|
+
)
|
79
82
|
end
|
80
83
|
end
|
81
84
|
end
|
@@ -77,7 +77,7 @@ class RackAutoInstrumentationTest < Minitest::Test
|
|
77
77
|
["Middleware/Rack/NewRelic::Rack::BrowserMonitoring/call", "Controller/Middleware/Rack/NewRelic::Rack::ErrorCollector/call"],
|
78
78
|
["Middleware/Rack/NewRelic::Rack::AgentHooks/call", "Controller/Middleware/Rack/NewRelic::Rack::ErrorCollector/call"],
|
79
79
|
],
|
80
|
-
:ignore_filter => /^Supportability
|
80
|
+
:ignore_filter => /^Supportability/
|
81
81
|
)
|
82
82
|
end
|
83
83
|
|
@@ -122,18 +122,21 @@ class RackAutoInstrumentationTest < Minitest::Test
|
|
122
122
|
def test_middleware_that_returns_early_records_middleware_rollup_metric
|
123
123
|
get '/?return-early=true'
|
124
124
|
|
125
|
-
assert_metrics_recorded_exclusive(
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
125
|
+
assert_metrics_recorded_exclusive(
|
126
|
+
[
|
127
|
+
"Apdex",
|
128
|
+
"ApdexAll",
|
129
|
+
"HttpDispatcher",
|
130
|
+
"Middleware/all",
|
131
|
+
"Apdex/Middleware/Rack/MiddlewareTwo/call",
|
132
|
+
"Controller/Middleware/Rack/MiddlewareTwo/call",
|
133
|
+
"Middleware/Rack/MiddlewareOne/call",
|
134
|
+
"Middleware/Rack/MiddlewareTwo/call",
|
135
|
+
["Middleware/Rack/MiddlewareOne/call", "Controller/Middleware/Rack/MiddlewareTwo/call"],
|
136
|
+
["Middleware/Rack/MiddlewareTwo/call", "Controller/Middleware/Rack/MiddlewareTwo/call"]
|
137
|
+
],
|
138
|
+
:ignore_filter => /^Supportability/
|
139
|
+
)
|
137
140
|
end
|
138
141
|
|
139
142
|
def test_middleware_that_returns_early_middleware_all_has_correct_call_times
|
@@ -26,6 +26,7 @@ gemfile <<-RB
|
|
26
26
|
gem 'i18n', '~>0.6.11'
|
27
27
|
gem 'haml', '4.0.2' # Getting load issues with haml 4.0.3
|
28
28
|
gem 'minitest_tu_shim', :require => false
|
29
|
+
gem 'rack-cache', '< 1.3' if RUBY_VERSION < '1.9.3' # rack-cache 1.3.0 only supports >= 1.9.3
|
29
30
|
RB
|
30
31
|
|
31
32
|
gemfile <<-RB
|
@@ -34,6 +35,7 @@ gemfile <<-RB
|
|
34
35
|
gem 'sinatra', '~> 1.4.5'
|
35
36
|
gem 'haml', '4.0.2' # Getting load issues with haml 4.0.3
|
36
37
|
gem 'minitest_tu_shim', :require => false
|
38
|
+
gem 'rack-cache', '< 1.3' if RUBY_VERSION < '1.9.3' # rack-cache 1.3.0 only supports >= 1.9.3
|
37
39
|
RB
|
38
40
|
|
39
41
|
gemfile <<-RB
|
@@ -41,12 +43,14 @@ gemfile <<-RB
|
|
41
43
|
gem 'i18n', '~>0.6.11'
|
42
44
|
gem 'haml', '4.0.2' # Getting load issues with haml 4.0.3
|
43
45
|
gem 'minitest_tu_shim', :require => false
|
46
|
+
gem 'rack-cache', '< 1.3' if RUBY_VERSION < '1.9.3' # rack-cache 1.3.0 only supports >= 1.9.3
|
44
47
|
RB
|
45
48
|
|
46
49
|
gemfile <<-RB
|
47
50
|
gem 'rails', '~>3.0.20'
|
48
51
|
gem 'haml', '4.0.2' # Getting load issues with haml 4.0.3
|
49
52
|
gem 'minitest_tu_shim', :require => false
|
53
|
+
gem 'rack-cache', '< 1.3' if RUBY_VERSION < '1.9.3' # rack-cache 1.3.0 only supports >= 1.9.3
|
50
54
|
RB
|
51
55
|
|
52
56
|
if RUBY_VERSION <= '1.9.3' && (!defined?(RUBY_ENGINE) || RUBY_ENGINE != 'jruby')
|
@@ -57,5 +61,6 @@ if RUBY_VERSION <= '1.9.3' && (!defined?(RUBY_ENGINE) || RUBY_ENGINE != 'jruby')
|
|
57
61
|
gem 'minitest_tu_shim', :require => false
|
58
62
|
gem 'sqlite3'
|
59
63
|
gem 'i18n', '0.6.11'
|
64
|
+
gem 'rack-cache', '< 1.3' if RUBY_VERSION < '1.9.3' # rack-cache 1.3.0 only supports >= 1.9.3
|
60
65
|
RB
|
61
66
|
end
|
@@ -225,9 +225,18 @@ class ParameterCaptureTest < RailsMultiverseTest
|
|
225
225
|
expected = {
|
226
226
|
"response.headers.contentType" => "#{response.content_type}; charset=#{response.charset}",
|
227
227
|
"request.headers.contentLength" => request.content_length.to_i,
|
228
|
+
"request.headers.contentType" => request.content_type,
|
228
229
|
"request.headers.host" => request.host,
|
229
230
|
"request.headers.accept" => request.accept
|
230
231
|
}
|
232
|
+
|
233
|
+
# ActionController::IntegrationTest sets this header whereas ActionDispatch::IntegrationTest
|
234
|
+
# does not. Since we test using both we need to conditionally expect content_length to be set.
|
235
|
+
|
236
|
+
unless defined?(ActionDispatch::IntegrationTest)
|
237
|
+
expected["response.headers.contentLength"] = response.content_length
|
238
|
+
end
|
239
|
+
|
231
240
|
actual = agent_attributes_for_single_event_posted_without_ignored_attributes
|
232
241
|
|
233
242
|
# request method may be a symbol or string based on Rails versions
|
@@ -14,6 +14,7 @@ RB
|
|
14
14
|
else
|
15
15
|
gemfile <<-RB
|
16
16
|
gem 'rack'
|
17
|
+
gem 'rack-cache', '1.2' # rack-cache >= 1.3.0 only works on Ruby 1.9.3 and newer
|
17
18
|
gem 'rake', '~> 10.4'
|
18
19
|
gem 'rails', '~> 3.2.21'
|
19
20
|
gem 'i18n', '~>0.6.11'
|
@@ -33,5 +34,5 @@ RB
|
|
33
34
|
gemfile <<-RB
|
34
35
|
gem 'rack'
|
35
36
|
gem 'rake', '~> 10.4'
|
36
|
-
gem 'newrelic-rake' # Can't coexist with third-party instrumentation
|
37
|
+
gem 'newrelic-rake', :require => false # Can't coexist with third-party instrumentation
|
37
38
|
RB
|
@@ -11,7 +11,7 @@ class NewRelic::Agent::Instrumentation::RedisInstrumentationTest < Minitest::Tes
|
|
11
11
|
|
12
12
|
def after_setup
|
13
13
|
super
|
14
|
-
@redis = Redis.new
|
14
|
+
@redis = Redis.new(:timeout => 25) # Default is 5 secs; a flushall takes longer on a busy box (i.e. CI)
|
15
15
|
|
16
16
|
# Creating a new client doesn't actually establish a connection, so make
|
17
17
|
# sure we do that by issuing a dummy get command, and then drop metrics
|
@@ -11,6 +11,24 @@ if RUBY_VERSION >= '2.0.0' || (RUBY_PLATFORM == 'java')
|
|
11
11
|
|
12
12
|
gem 'newrelic_rpm', :require => false, :path => File.expand_path('../../../../')
|
13
13
|
RB
|
14
|
+
|
15
|
+
gemfile <<-RB
|
16
|
+
gem 'json'
|
17
|
+
gem 'sidekiq', '~> 4.0.0'
|
18
|
+
gem 'rack'
|
19
|
+
gem 'newrelic_rpm', :require => false, :path => File.expand_path('../../../../')
|
20
|
+
RB
|
21
|
+
end
|
22
|
+
|
23
|
+
if RUBY_VERSION >= '2.0.0' && RUBY_PLATFORM != 'java'
|
24
|
+
# We skip testing Sidekiq 3.5.3 on JRuby due to an error in Sidekiq's shutdown:
|
25
|
+
# https://github.com/mperham/sidekiq/issues/2703
|
26
|
+
gemfile <<-RB
|
27
|
+
gem 'json'
|
28
|
+
gem 'sidekiq', '~> 3.5.3'
|
29
|
+
gem 'rack'
|
30
|
+
gem 'newrelic_rpm', :require => false, :path => File.expand_path('../../../../')
|
31
|
+
RB
|
14
32
|
end
|
15
33
|
|
16
34
|
gemfile <<-RB
|
@@ -14,6 +14,7 @@ require 'logger'
|
|
14
14
|
require 'stringio'
|
15
15
|
|
16
16
|
require 'fake_collector'
|
17
|
+
require File.join(File.dirname(__FILE__), "test_model")
|
17
18
|
require File.join(File.dirname(__FILE__), "test_worker")
|
18
19
|
|
19
20
|
class SidekiqTest < Minitest::Test
|
@@ -21,7 +22,7 @@ class SidekiqTest < Minitest::Test
|
|
21
22
|
|
22
23
|
ROLLUP_METRIC = 'OtherTransaction/SidekiqJob/all'
|
23
24
|
TRANSACTION_NAME = 'OtherTransaction/SidekiqJob/TestWorker/perform'
|
24
|
-
DELAYED_TRANSACTION_NAME = 'OtherTransaction/SidekiqJob/
|
25
|
+
DELAYED_TRANSACTION_NAME = 'OtherTransaction/SidekiqJob/TestModel/do_work'
|
25
26
|
DELAYED_FAILED_TXN_NAME = 'OtherTransaction/SidekiqJob/Sidekiq::Extensions::DelayedClass/perform'
|
26
27
|
|
27
28
|
include MultiverseHelpers
|
@@ -51,7 +52,7 @@ class SidekiqTest < Minitest::Test
|
|
51
52
|
|
52
53
|
def run_delayed
|
53
54
|
run_and_transmit do |i|
|
54
|
-
|
55
|
+
TestModel.delay(:queue => SidekiqServer.instance.queue_name, :retry => false).do_work
|
55
56
|
end
|
56
57
|
end
|
57
58
|
|
@@ -131,18 +132,18 @@ class SidekiqTest < Minitest::Test
|
|
131
132
|
end
|
132
133
|
|
133
134
|
# In <= 2.x of Sidekiq, internal errors (or potentially errors further out
|
134
|
-
# the middleware stack) wouldn't get noticed, but there was no
|
135
|
-
# to catch it. 3.x+ gives us
|
135
|
+
# the middleware stack) wouldn't get noticed, but there was no proper hook
|
136
|
+
# to catch it. 3.x+ gives us an error_handler, so only add our misbehaving
|
136
137
|
# middleware for those cases.
|
137
138
|
if Sidekiq::VERSION >= '3'
|
138
139
|
def test_captures_sidekiq_internal_errors
|
139
|
-
#
|
140
|
-
#
|
141
|
-
#
|
142
|
-
Redis.any_instance.stubs(:hmset).raises("Uh oh")
|
143
|
-
run_jobs
|
140
|
+
# When testing internal Sidekiq error capturing, we're looking to
|
141
|
+
# ensure Sidekiq properly forwards errors to our custom error handler
|
142
|
+
# in order for us to notice the error.
|
144
143
|
|
145
|
-
|
144
|
+
exception = StandardError.new('foo')
|
145
|
+
NewRelic::Agent.expects(:notice_error).with(exception)
|
146
|
+
Sidekiq::CLI.instance.handle_exception(exception)
|
146
147
|
end
|
147
148
|
end
|
148
149
|
|
@@ -0,0 +1,12 @@
|
|
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
|
+
# This class is used to test Sidekiq's Delayed Extensions
|
6
|
+
# which give the framework an interface like Delayed Job.
|
7
|
+
# The Delayed Extensions cannot be used to operate directly
|
8
|
+
# on a Sidekiq Worker.
|
9
|
+
class TestModel
|
10
|
+
def self.do_work
|
11
|
+
end
|
12
|
+
end
|
@@ -82,23 +82,26 @@ class SinatraIgnoreTest < SinatraTestCase
|
|
82
82
|
|
83
83
|
def test_seen_route
|
84
84
|
get_and_assert_ok '/record'
|
85
|
+
segment = name_for_route 'record'
|
85
86
|
assert_metrics_recorded([
|
86
|
-
"Controller/Sinatra/#{app_name}
|
87
|
-
"Apdex/Sinatra/#{app_name}
|
87
|
+
"Controller/Sinatra/#{app_name}/#{segment}",
|
88
|
+
"Apdex/Sinatra/#{app_name}/#{segment}"])
|
88
89
|
end
|
89
90
|
|
90
91
|
def test_ignores_exact_match
|
91
92
|
get_and_assert_ok '/ignore'
|
93
|
+
segment = name_for_route 'ignore'
|
92
94
|
assert_metrics_not_recorded([
|
93
|
-
"Controller/Sinatra/#{app_name}
|
94
|
-
"Apdex/Sinatra/#{app_name}
|
95
|
+
"Controller/Sinatra/#{app_name}/#{segment}",
|
96
|
+
"Apdex/Sinatra/#{app_name}/#{segment}"])
|
95
97
|
end
|
96
98
|
|
97
99
|
def test_ignores_by_splats
|
98
100
|
get_and_assert_ok '/splattered'
|
101
|
+
segment = name_for_route 'splattered'
|
99
102
|
assert_metrics_not_recorded([
|
100
|
-
"Controller/Sinatra/#{app_name}
|
101
|
-
"Apdex/Sinatra/#{app_name}
|
103
|
+
"Controller/Sinatra/#{app_name}/#{segment}",
|
104
|
+
"Apdex/Sinatra/#{app_name}/#{segment}"])
|
102
105
|
end
|
103
106
|
|
104
107
|
def test_ignores_can_be_declared_in_batches
|
@@ -106,59 +109,74 @@ class SinatraIgnoreTest < SinatraTestCase
|
|
106
109
|
get_and_assert_ok '/v2'
|
107
110
|
get_and_assert_ok '/v3'
|
108
111
|
|
112
|
+
v1_segment = name_for_route 'v1'
|
113
|
+
v2_segment = name_for_route 'v2'
|
114
|
+
v3_segment = name_for_route 'v3'
|
115
|
+
|
109
116
|
assert_metrics_not_recorded([
|
110
|
-
"Controller/Sinatra/#{app_name}
|
111
|
-
"Controller/Sinatra/#{app_name}
|
112
|
-
"Apdex/Sinatra/#{app_name}
|
113
|
-
"Apdex/Sinatra/#{app_name}
|
117
|
+
"Controller/Sinatra/#{app_name}/#{v1_segment}",
|
118
|
+
"Controller/Sinatra/#{app_name}/#{v2_segment}",
|
119
|
+
"Apdex/Sinatra/#{app_name}/#{v1_segment}",
|
120
|
+
"Apdex/Sinatra/#{app_name}/#{v2_segment}"])
|
114
121
|
|
115
122
|
assert_metrics_recorded([
|
116
|
-
"Controller/Sinatra/#{app_name}
|
117
|
-
"Apdex/Sinatra/#{app_name}
|
123
|
+
"Controller/Sinatra/#{app_name}/#{v3_segment}",
|
124
|
+
"Apdex/Sinatra/#{app_name}/#{v3_segment}"])
|
118
125
|
end
|
119
126
|
|
120
127
|
def test_seen_with_regex
|
121
128
|
get_and_assert_ok '/regex_seen'
|
129
|
+
segment = name_for_route 'regex_seen'
|
122
130
|
assert_metrics_recorded([
|
123
|
-
"Controller/Sinatra/#{app_name}
|
124
|
-
"Apdex/Sinatra/#{app_name}
|
131
|
+
"Controller/Sinatra/#{app_name}/#{segment}",
|
132
|
+
"Apdex/Sinatra/#{app_name}/#{segment}"])
|
125
133
|
end
|
126
134
|
|
127
135
|
def test_ignores_by_regex
|
128
136
|
get_and_assert_ok '/skip_regex'
|
137
|
+
segment = name_for_route 'skip_regex'
|
129
138
|
assert_metrics_not_recorded([
|
130
|
-
"Controller/Sinatra/#{app_name}
|
131
|
-
"Apdex/Sinatra/#{app_name}
|
139
|
+
"Controller/Sinatra/#{app_name}/#{segment}",
|
140
|
+
"Apdex/Sinatra/#{app_name}/#{segment}"])
|
132
141
|
end
|
133
142
|
|
134
143
|
def test_ignore_apdex
|
135
144
|
get_and_assert_ok '/no_apdex'
|
136
|
-
|
137
|
-
|
145
|
+
segment = name_for_route 'no_apdex'
|
146
|
+
assert_metrics_recorded(["Controller/Sinatra/#{app_name}/#{segment}"])
|
147
|
+
assert_metrics_not_recorded(["Apdex/Sinatra/#{app_name}/#{segment}"])
|
138
148
|
end
|
139
149
|
|
140
150
|
def test_ignore_enduser_should_only_apply_to_specified_route
|
141
151
|
get_and_assert_ok '/enduser'
|
142
|
-
|
152
|
+
segment = name_for_route 'enduser'
|
143
153
|
refute_enduser_ignored(last_response)
|
144
154
|
assert_metrics_recorded([
|
145
|
-
"Controller/Sinatra/#{app_name}
|
146
|
-
"Apdex/Sinatra/#{app_name}
|
155
|
+
"Controller/Sinatra/#{app_name}/#{segment}",
|
156
|
+
"Apdex/Sinatra/#{app_name}/#{segment}"])
|
147
157
|
end
|
148
158
|
|
149
159
|
def test_ignore_enduser
|
150
160
|
get_and_assert_ok '/no_enduser'
|
151
|
-
|
161
|
+
segment = name_for_route 'no_enduser'
|
152
162
|
assert_enduser_ignored(last_response)
|
153
163
|
assert_metrics_recorded([
|
154
|
-
"Controller/Sinatra/#{app_name}
|
155
|
-
"Apdex/Sinatra/#{app_name}
|
164
|
+
"Controller/Sinatra/#{app_name}/#{segment}",
|
165
|
+
"Apdex/Sinatra/#{app_name}/#{segment}"])
|
156
166
|
end
|
157
167
|
|
158
168
|
def test_ignore_errors_in_ignored_transactions
|
159
169
|
get '/ignored_erroring'
|
160
170
|
assert_metrics_not_recorded(["Errors/all"])
|
161
171
|
end
|
172
|
+
|
173
|
+
def name_for_route path
|
174
|
+
if last_request.env.key? 'sinatra.route'
|
175
|
+
"GET /#{path}"
|
176
|
+
else
|
177
|
+
"GET #{path}"
|
178
|
+
end
|
179
|
+
end
|
162
180
|
end
|
163
181
|
|
164
182
|
# Blanket ignore for whole app if newrelic_ignore called without parameters
|
@@ -198,7 +216,7 @@ class SinatraIgnoreApdexAndEndUserTest < SinatraTestCase
|
|
198
216
|
|
199
217
|
def test_ignores_apdex
|
200
218
|
get_and_assert_ok '/'
|
201
|
-
assert_metrics_not_recorded(["Apdex/Sinatra/#{app.to_s}/GET "])
|
219
|
+
assert_metrics_not_recorded(["Apdex/Sinatra/#{app.to_s}/GET /"])
|
202
220
|
end
|
203
221
|
|
204
222
|
def test_ignores_enduser
|