newrelic_rpm 3.10.0.279 → 3.11.0.283
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG +61 -0
- data/lib/new_relic/agent.rb +14 -8
- data/lib/new_relic/agent/agent.rb +43 -28
- data/lib/new_relic/agent/agent_logger.rb +21 -20
- data/lib/new_relic/agent/configuration/default_source.rb +31 -1
- data/lib/new_relic/agent/database.rb +2 -1
- data/lib/new_relic/agent/datastores.rb +177 -0
- data/lib/new_relic/agent/datastores/metric_helper.rb +85 -0
- data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +11 -20
- data/lib/new_relic/agent/deprecator.rb +18 -0
- data/lib/new_relic/agent/instrumentation/active_record.rb +20 -35
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +116 -57
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +11 -20
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +104 -172
- data/lib/new_relic/agent/instrumentation/memcache.rb +104 -52
- data/lib/new_relic/agent/instrumentation/metric_frame.rb +9 -0
- data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +15 -2
- data/lib/new_relic/agent/instrumentation/mongo.rb +5 -18
- data/lib/new_relic/agent/instrumentation/sequel_helper.rb +36 -0
- data/lib/new_relic/agent/new_relic_service.rb +4 -0
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +2 -17
- data/lib/new_relic/agent/threading/backtrace_service.rb +28 -5
- data/lib/new_relic/agent/transaction.rb +63 -34
- data/lib/new_relic/agent/transaction_event_aggregator.rb +0 -4
- data/lib/new_relic/agent/transaction_sampler.rb +11 -5
- data/lib/new_relic/rack/error_collector.rb +0 -1
- data/lib/new_relic/version.rb +1 -1
- data/lib/sequel/extensions/newrelic_instrumentation.rb +28 -56
- data/lib/sequel/plugins/newrelic_instrumentation.rb +28 -45
- data/newrelic_rpm.gemspec +0 -7
- data/test/agent_helper.rb +35 -16
- data/test/environments/rails31/Gemfile +1 -0
- data/test/environments/rails32/Gemfile +1 -0
- data/test/helpers/mongo_metric_builder.rb +2 -3
- data/test/multiverse/lib/multiverse/output_collector.rb +24 -9
- data/test/multiverse/lib/multiverse/suite.rb +5 -0
- data/test/multiverse/suites/active_record/Envfile +6 -4
- data/test/multiverse/suites/active_record/active_record_test.rb +32 -73
- data/test/multiverse/suites/active_record/ar_method_aliasing.rb +0 -1
- data/test/multiverse/suites/activemerchant/activemerchant_test.rb +0 -3
- data/test/multiverse/suites/agent_only/agent_run_id_handling_test.rb +0 -1
- data/test/multiverse/suites/agent_only/audit_log_test.rb +0 -1
- data/test/multiverse/suites/agent_only/collector_exception_handling_test.rb +0 -2
- data/test/multiverse/suites/agent_only/cross_application_tracing_test.rb +0 -1
- data/test/multiverse/suites/agent_only/custom_analytics_events_test.rb +0 -2
- data/test/multiverse/suites/agent_only/custom_queue_time_test.rb +0 -1
- data/test/multiverse/suites/agent_only/encoding_handling_test.rb +0 -2
- data/test/multiverse/suites/agent_only/exclusive_time_test.rb +0 -2
- data/test/multiverse/suites/agent_only/harvest_timestamps_test.rb +0 -1
- data/test/multiverse/suites/agent_only/http_response_code_test.rb +0 -1
- data/test/multiverse/suites/agent_only/keepalive_test.rb +0 -1
- data/test/multiverse/suites/agent_only/key_transactions_test.rb +54 -9
- data/test/multiverse/suites/agent_only/labels_test.rb +0 -2
- data/test/multiverse/suites/agent_only/logging_test.rb +0 -1
- data/test/multiverse/suites/agent_only/marshaling_test.rb +0 -1
- data/test/multiverse/suites/agent_only/pipe_manager_test.rb +0 -2
- data/test/multiverse/suites/agent_only/rename_rule_test.rb +5 -7
- data/test/multiverse/suites/agent_only/rum_instrumentation_test.rb +0 -1
- data/test/multiverse/suites/agent_only/set_transaction_name_test.rb +0 -2
- data/test/multiverse/suites/agent_only/ssl_test.rb +0 -2
- data/test/multiverse/suites/agent_only/synthetics_test.rb +0 -1
- data/test/multiverse/suites/agent_only/testing_app.rb +21 -0
- data/test/multiverse/suites/agent_only/thread_profiling_test.rb +1 -2
- data/test/multiverse/suites/agent_only/transaction_ignoring_test.rb +0 -2
- data/test/multiverse/suites/agent_only/utilization_data_collection_test.rb +0 -1
- data/test/multiverse/suites/agent_only/xray_sessions_test.rb +69 -34
- data/test/multiverse/suites/capistrano/deployment_test.rb +0 -1
- data/test/multiverse/suites/capistrano2/deployment_test.rb +0 -1
- data/test/multiverse/suites/config_file_loading/config_file_loading_test.rb +0 -2
- data/test/multiverse/suites/curb/curb_test.rb +0 -2
- data/test/multiverse/suites/datamapper/Envfile +26 -3
- data/test/multiverse/suites/datamapper/config/newrelic.yml +1 -0
- data/test/multiverse/suites/datamapper/datamapper_test.rb +271 -37
- data/test/multiverse/suites/deferred_instrumentation/sinatra_test.rb +0 -1
- data/test/multiverse/suites/delayed_job/Envfile +31 -8
- data/test/multiverse/suites/delayed_job/delayed_job_sampler_test.rb +0 -3
- data/test/multiverse/suites/delayed_job/unsupported_backend_test.rb +0 -3
- data/test/multiverse/suites/excon/excon_test.rb +0 -2
- data/test/multiverse/suites/grape/grape_test.rb +0 -3
- data/test/multiverse/suites/grape/grape_versioning_test.rb +0 -3
- data/test/multiverse/suites/grape/unsupported_version_test.rb +0 -3
- data/test/multiverse/suites/high_security/high_security_test.rb +0 -1
- data/test/multiverse/suites/httpclient/httpclient_test.rb +0 -2
- data/test/multiverse/suites/json/json_test.rb +0 -1
- data/test/multiverse/suites/marshalling/marshalling_test.rb +0 -1
- data/test/multiverse/suites/memcached/Envfile +52 -0
- data/test/multiverse/suites/memcached/dalli_test.rb +89 -0
- data/test/multiverse/suites/memcached/memcache_client_test.rb +25 -0
- data/test/multiverse/suites/memcached/memcache_test_cases.rb +302 -0
- data/test/multiverse/suites/memcached/memcached_test.rb +159 -0
- data/test/multiverse/suites/mongo/helpers/mongo_operation_tests.rb +26 -17
- data/test/multiverse/suites/mongo/mongo_connection_test.rb +0 -1
- data/test/multiverse/suites/mongo/mongo_instrumentation_test.rb +0 -1
- data/test/multiverse/suites/mongo/mongo_unsupported_version_test.rb +0 -1
- data/test/multiverse/suites/net_http/net_http_test.rb +0 -2
- data/test/multiverse/suites/padrino/padrino_test.rb +0 -3
- data/test/multiverse/suites/rack/http_response_code_test.rb +0 -1
- data/test/multiverse/suites/rack/nested_non_rack_app_test.rb +1 -1
- data/test/multiverse/suites/rack/rack_auto_instrumentation_test.rb +12 -12
- data/test/multiverse/suites/rack/rack_cascade_test.rb +0 -1
- data/test/multiverse/suites/rack/rack_env_mutation_test.rb +0 -1
- data/test/multiverse/suites/rack/rack_parameter_filtering_test.rb +0 -1
- data/test/multiverse/suites/rack/rack_unsupported_version_test.rb +0 -2
- data/test/multiverse/suites/rack/url_map_test.rb +3 -2
- data/test/multiverse/suites/rails/Envfile +3 -0
- data/test/multiverse/suites/rails/activejob_test.rb +0 -1
- data/test/multiverse/suites/rails/app.rb +0 -1
- data/test/multiverse/suites/rails/parameter_capture_test.rb +13 -0
- data/test/multiverse/suites/rails/rails3_app/app_rails3_plus.rb +5 -0
- data/test/multiverse/suites/rails/transaction_ignoring_test.rb +0 -2
- data/test/multiverse/suites/resque/instrumentation_test.rb +0 -2
- data/test/multiverse/suites/resque/resque_marshalling_test.rb +0 -1
- data/test/multiverse/suites/sequel/sequel_extension_test.rb +135 -0
- data/test/multiverse/suites/sequel/sequel_helpers.rb +62 -0
- data/test/multiverse/suites/sequel/sequel_plugin_test.rb +230 -0
- data/test/multiverse/suites/sidekiq/sidekiq_instrumentation_test.rb +0 -2
- data/test/multiverse/suites/sinatra/ignoring_test.rb +0 -2
- data/test/multiverse/suites/sinatra/nested_middleware_test.rb +0 -2
- data/test/multiverse/suites/sinatra/sinatra_classic_test.rb +0 -1
- data/test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb +0 -2
- data/test/multiverse/suites/sinatra/sinatra_metric_explosion_test.rb +14 -12
- data/test/multiverse/suites/sinatra/sinatra_modular_test.rb +0 -1
- data/test/multiverse/suites/sinatra/sinatra_routes_test.rb +0 -2
- data/test/multiverse/suites/sinatra/sinatra_test_cases.rb +0 -2
- data/test/multiverse/suites/typhoeus/typhoeus_test.rb +0 -2
- data/test/multiverse/suites/yajl/yajl_test.rb +0 -1
- data/test/new_relic/agent/agent/start_test.rb +2 -2
- data/test/new_relic/agent/agent_logger_test.rb +6 -3
- data/test/new_relic/agent/datastores/metric_helper_test.rb +61 -0
- data/test/new_relic/agent/datastores/mongo/metric_translator_test.rb +20 -21
- data/test/new_relic/agent/datastores_test.rb +195 -0
- data/test/new_relic/agent/deprecator_test.rb +52 -0
- data/test/new_relic/agent/instrumentation/action_view_subscriber_test.rb +20 -26
- data/test/new_relic/agent/instrumentation/active_record_helper_test.rb +58 -53
- data/test/new_relic/agent/instrumentation/active_record_subscriber_test.rb +7 -20
- data/test/new_relic/agent/instrumentation/middleware_proxy_test.rb +19 -0
- data/test/new_relic/agent/instrumentation/sequel_helper_test.rb +36 -0
- data/test/new_relic/agent/instrumentation/task_instrumentation_test.rb +1 -0
- data/test/new_relic/agent/method_tracer_test.rb +3 -4
- data/test/new_relic/agent/pipe_channel_manager_test.rb +1 -1
- data/test/new_relic/agent/threading/backtrace_service_test.rb +29 -4
- data/test/new_relic/agent/transaction_event_aggregator_test.rb +0 -4
- data/test/new_relic/agent/transaction_test.rb +100 -2
- data/test/new_relic/agent_test.rb +3 -3
- data/test/new_relic/http_client_test_cases.rb +0 -1
- data/test/new_relic/multiverse_helpers.rb +7 -0
- data/test/new_relic/transaction_ignoring_test_cases.rb +0 -2
- data/test/new_relic/transaction_sample_test.rb +11 -2
- data/test/performance/README.md +37 -17
- data/test/performance/lib/performance.rb +1 -0
- data/test/performance/lib/performance/baseline_compare_reporter.rb +11 -7
- data/test/performance/lib/performance/console_reporter.rb +29 -5
- data/test/performance/lib/performance/formatting_helpers.rb +22 -0
- data/test/performance/lib/performance/instrumentation/stackprof.rb +11 -1
- data/test/performance/lib/performance/result.rb +17 -6
- data/test/performance/lib/performance/runner.rb +7 -3
- data/test/performance/lib/performance/test_case.rb +89 -21
- data/test/performance/script/runner +13 -1
- data/test/performance/suites/active_record.rb +47 -0
- data/test/performance/suites/config.rb +4 -48
- data/test/performance/suites/marshalling.rb +20 -30
- data/test/performance/suites/queue_time.rb +1 -1
- data/test/performance/suites/rack_middleware.rb +1 -1
- data/test/performance/suites/rum_autoinsertion.rb +1 -1
- data/test/performance/suites/sql_obfuscation.rb +2 -2
- data/test/performance/suites/startup.rb +1 -1
- data/test/performance/suites/stats_hash.rb +7 -11
- data/test/performance/suites/thread_profiling.rb +20 -25
- data/test/performance/suites/trace_execution_scoped.rb +2 -2
- data/test/performance/suites/transaction_tracing.rb +4 -2
- data/test/test_helper.rb +5 -1
- metadata +53 -100
- data.tar.gz.sig +0 -0
- data/gem-public_cert.pem +0 -20
- data/lib/new_relic/agent/datastores/mongo/metric_generator.rb +0 -33
- data/test/multiverse/suites/sequel/sequel_instrumentation_test.rb +0 -289
- data/test/new_relic/agent/datastores/mongo/metric_generator_test.rb +0 -69
- data/test/new_relic/agent/memcache_instrumentation_test.rb +0 -155
- metadata.gz.sig +0 -2
@@ -0,0 +1,159 @@
|
|
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 "./memcache_test_cases"
|
6
|
+
|
7
|
+
if defined?(Memcached)
|
8
|
+
class MemcachedTest < Minitest::Test
|
9
|
+
include MemcacheTestCases
|
10
|
+
|
11
|
+
def setup
|
12
|
+
@cache = Memcached.new('localhost', :support_cas => true)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_get_in_web
|
16
|
+
if Memcached::VERSION >= '1.8.0'
|
17
|
+
key = set_key_for_testcase
|
18
|
+
|
19
|
+
expected_metrics = expected_web_metrics(:single_get)
|
20
|
+
|
21
|
+
in_web_transaction("Controller/#{self.class}/action") do
|
22
|
+
@cache.get(key)
|
23
|
+
end
|
24
|
+
|
25
|
+
assert_memcache_metrics_recorded expected_metrics
|
26
|
+
else
|
27
|
+
super
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_get_multi_in_web
|
32
|
+
return unless Memcached::VERSION >= '1.8.0'
|
33
|
+
key = set_key_for_testcase
|
34
|
+
|
35
|
+
expected_metrics = expected_web_metrics(:multi_get)
|
36
|
+
|
37
|
+
in_web_transaction("Controller/#{self.class}/action") do
|
38
|
+
@cache.get([key])
|
39
|
+
end
|
40
|
+
|
41
|
+
assert_memcache_metrics_recorded expected_metrics
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_incr_in_web
|
45
|
+
# the memcached gem will raise NotFound error if calling incr on a nonexistent key
|
46
|
+
# this overrides the test in the shared memcache_test_cases file
|
47
|
+
key = set_key_for_testcase(1)
|
48
|
+
expected_metrics = expected_web_metrics(:incr)
|
49
|
+
|
50
|
+
in_web_transaction("Controller/#{self.class}/action") do
|
51
|
+
@cache.incr(key, 1)
|
52
|
+
end
|
53
|
+
|
54
|
+
assert_memcache_metrics_recorded expected_metrics
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_decr_in_web
|
58
|
+
# the memcached gem will raise NotFound error if calling incr on a nonexistent key
|
59
|
+
# this overrides the test in the shared memcache_test_cases file
|
60
|
+
key = set_key_for_testcase(1)
|
61
|
+
expected_metrics = expected_web_metrics(:decr)
|
62
|
+
|
63
|
+
in_web_transaction("Controller/#{self.class}/action") do
|
64
|
+
@cache.decr(key, 1)
|
65
|
+
end
|
66
|
+
|
67
|
+
assert_memcache_metrics_recorded expected_metrics
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_cas_in_web
|
71
|
+
key = set_key_for_testcase(1)
|
72
|
+
|
73
|
+
if Memcached::VERSION >= '1.8.0'
|
74
|
+
expected_metrics = (expected_web_metrics(:single_get) + expected_web_metrics(:single_cas)).uniq
|
75
|
+
else
|
76
|
+
expected_metrics = expected_web_metrics(:cas)
|
77
|
+
end
|
78
|
+
|
79
|
+
in_web_transaction("Controller/#{self.class}/action") do
|
80
|
+
@cache.cas(key) {|val| val += 2}
|
81
|
+
end
|
82
|
+
|
83
|
+
assert_memcache_metrics_recorded expected_metrics
|
84
|
+
assert_equal 3, @cache.get(key)
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_get_in_background
|
88
|
+
if Memcached::VERSION >= '1.8.0'
|
89
|
+
key = set_key_for_testcase
|
90
|
+
|
91
|
+
expected_metrics = expected_bg_metrics(:single_get)
|
92
|
+
|
93
|
+
in_background_transaction("OtherTransaction/Background/#{self.class}/bg_task") do
|
94
|
+
@cache.get(key)
|
95
|
+
end
|
96
|
+
|
97
|
+
assert_memcache_metrics_recorded expected_metrics
|
98
|
+
else
|
99
|
+
super
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_get_multi_in_background
|
104
|
+
return unless Memcached::VERSION >= '1.8.0'
|
105
|
+
|
106
|
+
key = set_key_for_testcase
|
107
|
+
|
108
|
+
expected_metrics = expected_bg_metrics(:multi_get)
|
109
|
+
|
110
|
+
in_background_transaction("OtherTransaction/Background/#{self.class}/bg_task") do
|
111
|
+
@cache.get([key])
|
112
|
+
end
|
113
|
+
|
114
|
+
assert_memcache_metrics_recorded expected_metrics
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_incr_in_background
|
118
|
+
# the memcached gem will raise NotFound error if calling incr on a nonexistent key
|
119
|
+
# this overrides the test in the shared memcache_test_cases file
|
120
|
+
key = set_key_for_testcase(1)
|
121
|
+
expected_metrics = expected_bg_metrics(:incr)
|
122
|
+
|
123
|
+
in_background_transaction("OtherTransaction/Background/#{self.class}/bg_task") do
|
124
|
+
@cache.incr(key, 1)
|
125
|
+
end
|
126
|
+
|
127
|
+
assert_memcache_metrics_recorded expected_metrics
|
128
|
+
end
|
129
|
+
|
130
|
+
def test_decr_in_background
|
131
|
+
# the memcached gem will raise NotFound error if calling decr on a nonexistent key
|
132
|
+
# this overrides the test in the shared memcache_test_cases file
|
133
|
+
key = set_key_for_testcase(1)
|
134
|
+
expected_metrics = expected_bg_metrics(:decr)
|
135
|
+
|
136
|
+
in_background_transaction("OtherTransaction/Background/#{self.class}/bg_task") do
|
137
|
+
@cache.decr(key, 1)
|
138
|
+
end
|
139
|
+
|
140
|
+
assert_memcache_metrics_recorded expected_metrics
|
141
|
+
end
|
142
|
+
|
143
|
+
def test_cas_in_background
|
144
|
+
key = set_key_for_testcase(1)
|
145
|
+
if Memcached::VERSION >= '1.8.0'
|
146
|
+
expected_metrics = (expected_bg_metrics(:single_get) + expected_bg_metrics(:single_cas)).uniq
|
147
|
+
else
|
148
|
+
expected_metrics = expected_bg_metrics(:cas)
|
149
|
+
end
|
150
|
+
|
151
|
+
in_background_transaction("OtherTransaction/Background/#{self.class}/bg_task") do
|
152
|
+
@cache.cas(key) {|val| val += 2}
|
153
|
+
end
|
154
|
+
|
155
|
+
assert_memcache_metrics_recorded expected_metrics
|
156
|
+
assert_equal 3, @cache.get(key)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
@@ -151,7 +151,8 @@ module MongoOperationTests
|
|
151
151
|
metrics = create_index_metrics
|
152
152
|
elsif client_is_1_10_or_later && !server_is_2_6_or_later?
|
153
153
|
metrics = create_index_metrics.merge(create_indexes_metrics)
|
154
|
-
metrics['
|
154
|
+
metrics['Datastore/MongoDB/allWeb'][:call_count] += 1
|
155
|
+
metrics['Datastore/MongoDB/all'][:call_count] += 1
|
155
156
|
metrics['Datastore/allWeb'][:call_count] += 1
|
156
157
|
metrics['Datastore/all'][:call_count] += 1
|
157
158
|
elsif client_is_1_10_or_later && server_is_2_6_or_later?
|
@@ -285,6 +286,24 @@ module MongoOperationTests
|
|
285
286
|
assert_metrics_recorded(expected)
|
286
287
|
end
|
287
288
|
|
289
|
+
def test_web_scoped_metrics
|
290
|
+
in_web_transaction("webby") do
|
291
|
+
@collection.insert(@tribble)
|
292
|
+
end
|
293
|
+
|
294
|
+
metric = statement_metric(:insert)
|
295
|
+
assert_metrics_recorded([[metric, "webby"]])
|
296
|
+
end
|
297
|
+
|
298
|
+
def test_background_scoped_metrics
|
299
|
+
in_background_transaction("backed-up") do
|
300
|
+
@collection.insert(@tribble)
|
301
|
+
end
|
302
|
+
|
303
|
+
metric = statement_metric(:insert)
|
304
|
+
assert_metrics_recorded([[metric, "backed-up"]])
|
305
|
+
end
|
306
|
+
|
288
307
|
def test_notices_nosql
|
289
308
|
segment = nil
|
290
309
|
|
@@ -435,7 +454,7 @@ module MongoOperationTests
|
|
435
454
|
NewRelic::Agent::Transaction.stubs(:recording_web_transaction?).returns(false)
|
436
455
|
@collection.insert(@tribble)
|
437
456
|
|
438
|
-
metrics = build_test_metrics(:insert
|
457
|
+
metrics = build_test_metrics(:insert)
|
439
458
|
expected = metrics_with_attributes(metrics)
|
440
459
|
|
441
460
|
assert_metrics_recorded(expected)
|
@@ -448,21 +467,6 @@ module MongoOperationTests
|
|
448
467
|
assert_metrics_not_recorded(['Datastore/allWeb'])
|
449
468
|
end
|
450
469
|
|
451
|
-
def test_insert_records_instance_metric
|
452
|
-
@collection.insert(@tribble)
|
453
|
-
assert_metrics_recorded(["Datastore/instance/MongoDB/localhost:#{@client.port}/#{@database_name}"])
|
454
|
-
end
|
455
|
-
|
456
|
-
def test_save_records_instance_metric
|
457
|
-
@collection.save(@tribble)
|
458
|
-
assert_metrics_recorded(["Datastore/instance/MongoDB/localhost:#{@client.port}/#{@database_name}"])
|
459
|
-
end
|
460
|
-
|
461
|
-
def test_ensure_index_records_instance_metric
|
462
|
-
@collection.ensure_index([[unique_field_name, Mongo::ASCENDING]])
|
463
|
-
assert_metrics_recorded(["Datastore/instance/MongoDB/localhost:#{@client.port}/#{@database_name}"])
|
464
|
-
end
|
465
|
-
|
466
470
|
def unique_field_name
|
467
471
|
"field#{SecureRandom.hex(10)}"
|
468
472
|
end
|
@@ -477,4 +481,9 @@ module MongoOperationTests
|
|
477
481
|
return false unless client
|
478
482
|
client.respond_to?(:max_wire_version) && client.max_wire_version >= 2
|
479
483
|
end
|
484
|
+
|
485
|
+
def statement_metric(action)
|
486
|
+
metrics = build_test_metrics(action)
|
487
|
+
metrics.select { |m| m.start_with?("Datastore/statement") }.first
|
488
|
+
end
|
480
489
|
end
|
@@ -6,7 +6,6 @@ require 'mongo'
|
|
6
6
|
require 'newrelic_rpm'
|
7
7
|
require 'new_relic/agent/datastores/mongo'
|
8
8
|
require 'securerandom'
|
9
|
-
require File.join(File.dirname(__FILE__), '..', '..', '..', 'agent_helper')
|
10
9
|
|
11
10
|
if NewRelic::Agent::Datastores::Mongo.is_supported_version?
|
12
11
|
require File.join(File.dirname(__FILE__), '..', '..', '..', 'helpers', 'mongo_metric_builder')
|
@@ -6,7 +6,6 @@ require 'mongo'
|
|
6
6
|
require 'newrelic_rpm'
|
7
7
|
require 'new_relic/agent/datastores/mongo'
|
8
8
|
require 'securerandom'
|
9
|
-
require File.join(File.dirname(__FILE__), '..', '..', '..', 'agent_helper')
|
10
9
|
|
11
10
|
if NewRelic::Agent::Datastores::Mongo.is_supported_version?
|
12
11
|
require File.join(File.dirname(__FILE__), '..', '..', '..', 'helpers', 'mongo_metric_builder')
|
@@ -5,7 +5,6 @@
|
|
5
5
|
require 'mongo'
|
6
6
|
require 'newrelic_rpm'
|
7
7
|
require 'new_relic/agent/datastores/mongo'
|
8
|
-
require File.join(File.dirname(__FILE__), '..', '..', '..', 'agent_helper')
|
9
8
|
|
10
9
|
if !NewRelic::Agent::Datastores::Mongo.is_supported_version?
|
11
10
|
require File.join(File.dirname(__FILE__), 'helpers', 'mongo_server')
|
@@ -2,9 +2,6 @@
|
|
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.join(File.dirname(__FILE__), '..', '..', '..', 'agent_helper.rb')
|
6
|
-
require 'multiverse_helpers'
|
7
|
-
|
8
5
|
# Shhhh
|
9
6
|
Padrino::Logger::Config[:development][:stream] = :null
|
10
7
|
|
@@ -2,7 +2,6 @@
|
|
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 'multiverse_helpers'
|
6
5
|
require File.join(File.dirname(__FILE__), 'example_app')
|
7
6
|
require 'new_relic/rack/browser_monitoring'
|
8
7
|
require 'new_relic/rack/agent_hooks'
|
@@ -2,7 +2,6 @@
|
|
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 'multiverse_helpers'
|
6
5
|
require File.join(File.dirname(__FILE__), 'example_app')
|
7
6
|
|
8
7
|
if NewRelic::Agent::Instrumentation::RackHelpers.rack_version_supported?
|
@@ -47,6 +46,7 @@ class NestedNonRackAppTest < Minitest::Test
|
|
47
46
|
assert_metrics_recorded_exclusive(
|
48
47
|
[
|
49
48
|
"Apdex",
|
49
|
+
"ApdexAll",
|
50
50
|
"Apdex/NestedNonRackAppTest::RailsishApp/inner",
|
51
51
|
"Controller/NestedNonRackAppTest::RailsishApp/inner",
|
52
52
|
"HttpDispatcher",
|
@@ -2,7 +2,6 @@
|
|
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 'multiverse_helpers'
|
6
5
|
require File.join(File.dirname(__FILE__), 'example_app')
|
7
6
|
require 'new_relic/rack/browser_monitoring'
|
8
7
|
require 'new_relic/rack/agent_hooks'
|
@@ -58,6 +57,7 @@ class RackAutoInstrumentationTest < Minitest::Test
|
|
58
57
|
assert_metrics_recorded_exclusive(
|
59
58
|
[
|
60
59
|
"Apdex",
|
60
|
+
"ApdexAll",
|
61
61
|
"HttpDispatcher",
|
62
62
|
"Middleware/all",
|
63
63
|
"Apdex/Middleware/Rack/NewRelic::Rack::ErrorCollector/call",
|
@@ -79,6 +79,7 @@ class RackAutoInstrumentationTest < Minitest::Test
|
|
79
79
|
assert_metrics_recorded_exclusive(
|
80
80
|
[
|
81
81
|
"Apdex",
|
82
|
+
"ApdexAll",
|
82
83
|
"HttpDispatcher",
|
83
84
|
"Middleware/all",
|
84
85
|
"Apdex/Rack/ExampleApp/call",
|
@@ -101,20 +102,20 @@ class RackAutoInstrumentationTest < Minitest::Test
|
|
101
102
|
end
|
102
103
|
|
103
104
|
def test_middlewares_record_queue_time
|
104
|
-
|
105
|
-
|
106
|
-
|
105
|
+
t0 = freeze_time
|
106
|
+
advance_time(5.0)
|
107
|
+
get '/', {}, { 'HTTP_X_REQUEST_START' => "t=#{t0.to_f}" }
|
107
108
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
end
|
109
|
+
assert_metrics_recorded(
|
110
|
+
'WebFrontend/QueueTime' => { :total_call_time => 5.0 }
|
111
|
+
)
|
112
112
|
end
|
113
113
|
|
114
114
|
def test_middleware_that_returns_early_records_middleware_rollup_metric
|
115
115
|
get '/?return-early=true'
|
116
116
|
assert_metrics_recorded_exclusive([
|
117
117
|
"Apdex",
|
118
|
+
"ApdexAll",
|
118
119
|
"HttpDispatcher",
|
119
120
|
"Middleware/all",
|
120
121
|
"Apdex/Middleware/Rack/MiddlewareTwo/call",
|
@@ -127,10 +128,9 @@ class RackAutoInstrumentationTest < Minitest::Test
|
|
127
128
|
end
|
128
129
|
|
129
130
|
def test_middleware_that_returns_early_middleware_all_has_correct_call_times
|
130
|
-
freeze_time
|
131
|
-
|
132
|
-
|
133
|
-
end
|
131
|
+
freeze_time
|
132
|
+
get '/?return-early=true'
|
133
|
+
assert_metrics_recorded('Middleware/all' => { :total_exclusive_time => 3.0, :call_count => 2 })
|
134
134
|
end
|
135
135
|
|
136
136
|
def test_middleware_created_with_args_works
|
@@ -2,7 +2,6 @@
|
|
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 'multiverse_helpers'
|
6
5
|
require File.join(File.dirname(__FILE__), 'example_app')
|
7
6
|
require 'new_relic/rack/browser_monitoring'
|
8
7
|
require 'new_relic/rack/agent_hooks'
|
@@ -2,7 +2,6 @@
|
|
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 'multiverse_helpers'
|
6
5
|
require 'new_relic/rack/browser_monitoring'
|
7
6
|
require 'new_relic/rack/agent_hooks'
|
8
7
|
require 'new_relic/rack/error_collector'
|
@@ -2,7 +2,6 @@
|
|
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 'multiverse_helpers'
|
6
5
|
require 'filtering_test_app'
|
7
6
|
|
8
7
|
if NewRelic::Agent::Instrumentation::RackHelpers.rack_version_supported?
|
@@ -2,8 +2,6 @@
|
|
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 'multiverse_helpers'
|
6
|
-
|
7
5
|
if !NewRelic::Agent::Instrumentation::RackHelpers.rack_version_supported?
|
8
6
|
|
9
7
|
class RackUnsupportedVersionTest < Minitest::Test
|
@@ -2,8 +2,6 @@
|
|
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 'multiverse_helpers'
|
6
|
-
|
7
5
|
if NewRelic::Agent::Instrumentation::RackHelpers.rack_version_supported?
|
8
6
|
|
9
7
|
class UrlMapTest < Minitest::Test
|
@@ -64,6 +62,7 @@ class UrlMapTest < Minitest::Test
|
|
64
62
|
|
65
63
|
assert_metrics_recorded_exclusive([
|
66
64
|
'Apdex',
|
65
|
+
'ApdexAll',
|
67
66
|
'HttpDispatcher',
|
68
67
|
'Middleware/all',
|
69
68
|
'Controller/Rack/UrlMapTest::ExampleApp/call',
|
@@ -83,6 +82,7 @@ class UrlMapTest < Minitest::Test
|
|
83
82
|
|
84
83
|
assert_metrics_recorded_exclusive([
|
85
84
|
'Apdex',
|
85
|
+
'ApdexAll',
|
86
86
|
'HttpDispatcher',
|
87
87
|
'Middleware/all',
|
88
88
|
'Controller/Rack/UrlMapTest::PrefixAppOne/call',
|
@@ -101,6 +101,7 @@ class UrlMapTest < Minitest::Test
|
|
101
101
|
|
102
102
|
assert_metrics_recorded_exclusive([
|
103
103
|
'Apdex',
|
104
|
+
'ApdexAll',
|
104
105
|
'HttpDispatcher',
|
105
106
|
'Middleware/all',
|
106
107
|
'Controller/Rack/UrlMapTest::PrefixAppTwo/call',
|
@@ -23,12 +23,14 @@ end
|
|
23
23
|
|
24
24
|
gemfile <<-RB
|
25
25
|
gem 'rails', '~>3.2.20'
|
26
|
+
gem 'i18n', '~>0.6.11'
|
26
27
|
gem 'haml', '4.0.2' # Getting load issues with haml 4.0.3
|
27
28
|
gem 'minitest_tu_shim', :require => false
|
28
29
|
RB
|
29
30
|
|
30
31
|
gemfile <<-RB
|
31
32
|
gem 'rails', '~>3.2.20'
|
33
|
+
gem 'i18n', '~>0.6.11'
|
32
34
|
gem 'sinatra', '~> 1.4.5'
|
33
35
|
gem 'haml', '4.0.2' # Getting load issues with haml 4.0.3
|
34
36
|
gem 'minitest_tu_shim', :require => false
|
@@ -36,6 +38,7 @@ RB
|
|
36
38
|
|
37
39
|
gemfile <<-RB
|
38
40
|
gem 'rails', '~>3.1.12'
|
41
|
+
gem 'i18n', '~>0.6.11'
|
39
42
|
gem 'haml', '4.0.2' # Getting load issues with haml 4.0.3
|
40
43
|
gem 'minitest_tu_shim', :require => false
|
41
44
|
RB
|