newrelic_rpm 2.13.5.beta4 → 2.13.6.beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of newrelic_rpm might be problematic. Click here for more details.
- data/CHANGELOG +8 -0
- data/cert/cacert.pem +21 -0
- data/lib/conditional_vendored_dependency_detection.rb +3 -0
- data/lib/new_relic/agent/agent.rb +14 -1
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +15 -12
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +38 -21
- data/lib/new_relic/agent/instrumentation/authlogic.rb +9 -4
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +364 -364
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +142 -121
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +17 -16
- data/lib/new_relic/agent/instrumentation/memcache.rb +40 -26
- data/lib/new_relic/agent/instrumentation/net.rb +19 -13
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +27 -15
- data/lib/new_relic/agent/instrumentation/rails/active_record_instrumentation.rb +80 -71
- data/lib/new_relic/agent/instrumentation/rails3/active_record_instrumentation.rb +84 -72
- data/lib/new_relic/agent/instrumentation/sequel.rb +84 -70
- data/lib/new_relic/agent/instrumentation/sinatra.rb +44 -37
- data/lib/new_relic/agent/instrumentation/sunspot.rb +18 -12
- data/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb +13 -7
- data/lib/new_relic/agent/method_tracer.rb +1 -1
- data/lib/new_relic/agent/samplers/cpu_sampler.rb +2 -0
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +1 -1
- data/lib/new_relic/control.rb +1 -0
- data/lib/new_relic/control/instrumentation.rb +1 -0
- data/lib/new_relic/delayed_job_injection.rb +23 -14
- data/lib/new_relic/version.rb +2 -2
- data/lib/newrelic_rpm.rb +5 -0
- data/newrelic_rpm.gemspec +25 -23
- data/test/new_relic/agent/{agent_connect_test.rb → agent/connect_test.rb} +2 -2
- data/test/new_relic/agent/{agent_start_test.rb → agent/start_test.rb} +17 -3
- data/test/new_relic/agent/{agent_start_worker_thread_test.rb → agent/start_worker_thread_test.rb} +2 -2
- data/test/new_relic/agent/{agent_controller_test.rb → agent_test_controller_test.rb} +6 -3
- data/test/new_relic/agent/{error_collector_notice_error_test.rb → error_collector/notice_error_test.rb} +2 -2
- data/test/new_relic/agent/{active_record_instrumentation_test.rb → instrumentation/active_record_instrumentation_test.rb} +2 -2
- data/test/new_relic/agent/{metric_frame_test.rb → instrumentation/metric_frame_test.rb} +2 -3
- data/test/new_relic/agent/{net_instrumentation_test.rb → instrumentation/net_instrumentation_test.rb} +4 -4
- data/test/new_relic/agent/{queue_time_test.rb → instrumentation/queue_time_test.rb} +1 -1
- data/test/new_relic/agent/{task_instrumentation_test.rb → instrumentation/task_instrumentation_test.rb} +29 -32
- data/test/new_relic/agent/method_tracer/class_methods/add_method_tracer_test.rb +165 -0
- data/test/new_relic/agent/{method_tracer_trace_execution_scoped_test.rb → method_tracer/instance_methods/trace_execution_scoped_test.rb} +2 -2
- data/test/new_relic/agent/method_tracer_test.rb +31 -3
- data/test/new_relic/agent/rpm_agent_test.rb +8 -3
- data/test/new_relic/{agent/collection_helper_test.rb → collection_helper_test.rb} +4 -4
- data/test/new_relic/{deployments_api_test.rb → command/deployments_test.rb} +3 -5
- data/test/new_relic/control_test.rb +3 -3
- data/test/new_relic/{environment_test.rb → local_environment_test.rb} +2 -5
- data/test/new_relic/metric_spec_test.rb +32 -122
- data/test/new_relic/stats_test.rb +0 -1
- data/test/new_relic/{agent/transaction_sample_subtest_test.rb → transaction_sample_subtest_test.rb} +0 -0
- data/test/new_relic/{agent/transaction_sample_test.rb → transaction_sample_test.rb} +1 -2
- data/test/test_helper.rb +1 -0
- data/vendor/gems/dependency_detection-0.0.1.build/LICENSE +19 -0
- data/vendor/gems/dependency_detection-0.0.1.build/README +0 -0
- data/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb +57 -0
- data/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection/version.rb +3 -0
- metadata +29 -27
- data/test/new_relic/agent/add_method_tracer_test.rb +0 -158
- data/test/new_relic/agent/metric_data_test.rb +0 -53
- data/test/new_relic/agent/testable_agent.rb +0 -13
- data/test/new_relic/shim_agent_test.rb +0 -9
@@ -1,158 +0,0 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
|
2
|
-
|
3
|
-
require 'set'
|
4
|
-
class NewRelic::Agent::AgentStartTest < Test::Unit::TestCase
|
5
|
-
require 'new_relic/agent/method_tracer'
|
6
|
-
include NewRelic::Agent::MethodTracer::ClassMethods::AddMethodTracer
|
7
|
-
|
8
|
-
def test_validate_options_nonhash
|
9
|
-
assert_raise(TypeError) do
|
10
|
-
validate_options([])
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_validate_options_defaults
|
15
|
-
self.expects(:check_for_illegal_keys!)
|
16
|
-
self.expects(:set_deduct_call_time_based_on_metric).with(DEFAULT_SETTINGS)
|
17
|
-
self.expects(:check_for_push_scope_and_metric)
|
18
|
-
validate_options({})
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_validate_options_override
|
22
|
-
opts = {:push_scope => false, :metric => false, :force => true}
|
23
|
-
self.expects(:check_for_illegal_keys!)
|
24
|
-
self.expects(:check_for_push_scope_and_metric)
|
25
|
-
val = validate_options(opts)
|
26
|
-
assert val.is_a?(Hash)
|
27
|
-
assert (val[:push_scope] == false), val.inspect
|
28
|
-
assert (val[:metric] == false), val.inspect
|
29
|
-
assert (val[:force] == true), val.inspect
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_default_metric_name_code
|
33
|
-
self.expects(:name).returns("TEST_CLASS")
|
34
|
-
assert_equal 'Custom/TEST_CLASS/test_method', default_metric_name_code('test_method')
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_method_exists_positive
|
38
|
-
self.expects(:method_defined?).returns(true)
|
39
|
-
assert method_exists?('test_method')
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_method_exists_negative
|
43
|
-
self.expects(:method_defined?).returns(false)
|
44
|
-
self.expects(:private_method_defined?).returns(false)
|
45
|
-
self.expects(:name).returns('TEST_CLASS')
|
46
|
-
fake_log = mock('log')
|
47
|
-
self.expects(:log).returns(fake_log)
|
48
|
-
fake_log.expects(:warn).with("Did not trace TEST_CLASS#test_method because that method does not exist")
|
49
|
-
assert !method_exists?('test_method')
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_set_deduct_call_time_based_on_metric_positive
|
53
|
-
opts = {:metric => true}
|
54
|
-
val = set_deduct_call_time_based_on_metric(opts)
|
55
|
-
assert val.is_a?(Hash)
|
56
|
-
assert val[:deduct_call_time_from_parent]
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_set_deduct_call_time_based_on_metric_negative
|
60
|
-
opts = {:metric => false}
|
61
|
-
val = set_deduct_call_time_based_on_metric(opts)
|
62
|
-
assert val.is_a?(Hash)
|
63
|
-
assert !val[:deduct_call_time_from_parent]
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_set_deduct_call_time_based_on_metric_non_nil
|
67
|
-
opts = {:deduct_call_time_from_parent => true, :metric => false}
|
68
|
-
val = set_deduct_call_time_based_on_metric(opts)
|
69
|
-
assert val.is_a?(Hash)
|
70
|
-
assert val[:deduct_call_time_from_parent]
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_set_deduct_call_time_based_on_metric_opposite
|
74
|
-
opts = {:deduct_call_time_from_parent => false, :metric => true}
|
75
|
-
val = set_deduct_call_time_based_on_metric(opts)
|
76
|
-
assert val.is_a?(Hash)
|
77
|
-
assert !val[:deduct_call_time_from_parent]
|
78
|
-
end
|
79
|
-
|
80
|
-
def test_unrecognized_keys_positive
|
81
|
-
assert_equal [:unrecognized, :keys].to_set, unrecognized_keys([:hello, :world], {:unrecognized => nil, :keys => nil}).to_set
|
82
|
-
end
|
83
|
-
|
84
|
-
def test_unrecognized_keys_negative
|
85
|
-
assert_equal [], unrecognized_keys([:hello, :world], {:hello => nil, :world => nil})
|
86
|
-
end
|
87
|
-
|
88
|
-
def test_any_unrecognized_keys_positive
|
89
|
-
assert any_unrecognized_keys?([:one], {:one => nil, :two => nil})
|
90
|
-
end
|
91
|
-
|
92
|
-
def test_any_unrecognized_keys_negative
|
93
|
-
assert !any_unrecognized_keys?([:one], {:one => nil})
|
94
|
-
end
|
95
|
-
|
96
|
-
def test_check_for_illegal_keys_positive
|
97
|
-
assert_raise(RuntimeError) do
|
98
|
-
check_for_illegal_keys!({:unknown_key => nil})
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
def test_check_for_illegal_keys_negative
|
103
|
-
test_keys = Hash[ALLOWED_KEYS.map {|x| [x, nil]}]
|
104
|
-
check_for_illegal_keys!(test_keys)
|
105
|
-
end
|
106
|
-
|
107
|
-
def test_traced_method_exists_positive
|
108
|
-
self.expects(:_traced_method_name)
|
109
|
-
self.expects(:method_defined?).returns(true)
|
110
|
-
fake_log = mock('log')
|
111
|
-
self.expects(:log).returns(fake_log)
|
112
|
-
fake_log.expects(:warn).with('Attempt to trace a method twice with the same metric: Method = test_method, Metric Name = Custom/Test/test_method')
|
113
|
-
assert traced_method_exists?('test_method', 'Custom/Test/test_method')
|
114
|
-
end
|
115
|
-
|
116
|
-
def test_traced_method_exists_negative
|
117
|
-
self.expects(:_traced_method_name)
|
118
|
-
self.expects(:method_defined?).returns(false)
|
119
|
-
assert !traced_method_exists?(nil, nil)
|
120
|
-
end
|
121
|
-
|
122
|
-
def test_assemble_code_header_forced
|
123
|
-
opts = {:force => true, :code_header => 'CODE HEADER'}
|
124
|
-
assert_equal "CODE HEADER", assemble_code_header('test_method', 'Custom/Test/test_method', opts)
|
125
|
-
end
|
126
|
-
|
127
|
-
def test_assemble_code_header_unforced
|
128
|
-
self.expects(:_untraced_method_name).returns("method_name_without_tracing")
|
129
|
-
opts = {:force => false, :code_header => 'CODE HEADER'}
|
130
|
-
assert_equal "return method_name_without_tracing(*args, &block) unless NewRelic::Agent.is_execution_traced?\nCODE HEADER", assemble_code_header('test_method', 'Custom/Test/test_method', opts)
|
131
|
-
end
|
132
|
-
|
133
|
-
def test_check_for_push_scope_and_metric_positive
|
134
|
-
check_for_push_scope_and_metric({:push_scope => true})
|
135
|
-
check_for_push_scope_and_metric({:metric => true})
|
136
|
-
end
|
137
|
-
|
138
|
-
def test_check_for_push_scope_and_metric_negative
|
139
|
-
assert_raise(RuntimeError) do
|
140
|
-
check_for_push_scope_and_metric({:push_scope => false, :metric => false})
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
def test_code_to_eval_scoped
|
145
|
-
self.expects(:validate_options).returns({:push_scope => true})
|
146
|
-
self.expects(:method_with_push_scope).with('test_method', 'Custom/Test/test_method', {:push_scope => true})
|
147
|
-
code_to_eval('test_method', 'Custom/Test/test_method', {})
|
148
|
-
end
|
149
|
-
|
150
|
-
def test_code_to_eval_unscoped
|
151
|
-
self.expects(:validate_options).returns({:push_scope => false})
|
152
|
-
self.expects(:method_without_push_scope).with('test', 'Custom/Test/test', {:push_scope => false})
|
153
|
-
code_to_eval('test', 'Custom/Test/test', {})
|
154
|
-
end
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
|
2
|
-
|
3
|
-
class NewRelic::Agent::MetricDataTest < Test::Unit::TestCase
|
4
|
-
|
5
|
-
# test to make sure the MetricData class can serialize to json
|
6
|
-
def test_json
|
7
|
-
spec = NewRelic::MetricSpec.new("controller", "metric#find")
|
8
|
-
|
9
|
-
import = ::ActiveSupport::JSON.decode(spec.to_json)
|
10
|
-
|
11
|
-
compare_spec(spec, import)
|
12
|
-
|
13
|
-
stats = NewRelic::MethodTraceStats.new
|
14
|
-
|
15
|
-
import = ::ActiveSupport::JSON.decode(stats.to_json)
|
16
|
-
|
17
|
-
compare_stat(stats, import)
|
18
|
-
|
19
|
-
metric_data = NewRelic::MetricData.new(spec, stats, 10)
|
20
|
-
|
21
|
-
import = ::ActiveSupport::JSON.decode(metric_data.to_json)
|
22
|
-
|
23
|
-
compare_metric_data(metric_data, import)
|
24
|
-
end
|
25
|
-
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def compare_spec(spec, import)
|
30
|
-
assert_equal 2, import.length
|
31
|
-
assert_equal spec.name, import['name']
|
32
|
-
assert_equal spec.scope, import['scope']
|
33
|
-
end
|
34
|
-
|
35
|
-
def compare_stat(stats, import)
|
36
|
-
assert_equal 6, import.length
|
37
|
-
assert_equal stats.total_call_time, import['total_call_time']
|
38
|
-
assert_equal stats.max_call_time, import['max_call_time']
|
39
|
-
assert_equal stats.min_call_time, import['min_call_time']
|
40
|
-
assert_equal stats.sum_of_squares, import['sum_of_squares']
|
41
|
-
assert_equal stats.call_count, import['call_count']
|
42
|
-
assert_equal stats.total_exclusive_time, import['total_exclusive_time']
|
43
|
-
end
|
44
|
-
|
45
|
-
def compare_metric_data(metric_data, import)
|
46
|
-
assert_equal 3, import.length
|
47
|
-
assert_equal metric_data.metric_id, import['metric_id']
|
48
|
-
compare_spec(metric_data.metric_spec, import['metric_spec']) unless metric_data.metric_id
|
49
|
-
compare_stat(metric_data.stats, import['stats'])
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
53
|
-
|