newrelic_rpm 2.8.11 → 2.9.2
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 +267 -0
- data/LICENSE +1 -1
- data/Manifest +142 -0
- data/README.md +138 -0
- data/Rakefile +10 -28
- data/bin/mongrel_rpm +33 -0
- data/cert/cacert.pem +34 -0
- data/init.rb +38 -0
- data/lib/new_relic/agent/agent.rb +160 -347
- data/lib/new_relic/agent/collection_helper.rb +13 -24
- data/lib/new_relic/agent/error_collector.rb +29 -15
- data/lib/new_relic/agent/instrumentation/active_record_instrumentation.rb +63 -76
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +90 -48
- data/lib/new_relic/agent/instrumentation/dispatcher_instrumentation.rb +72 -47
- data/lib/new_relic/agent/instrumentation/error_instrumentation.rb +14 -0
- data/lib/new_relic/agent/instrumentation/merb/controller.rb +10 -1
- data/lib/new_relic/agent/instrumentation/merb/dispatcher.rb +5 -7
- data/lib/new_relic/agent/instrumentation/merb/errors.rb +3 -1
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +7 -0
- data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +34 -7
- data/lib/new_relic/agent/instrumentation/rails/dispatcher.rb +20 -12
- data/lib/new_relic/agent/instrumentation/rails/errors.rb +5 -4
- data/lib/new_relic/agent/method_tracer.rb +159 -135
- data/lib/new_relic/agent/patch_const_missing.rb +46 -26
- data/lib/new_relic/agent/sampler.rb +12 -0
- data/lib/new_relic/agent/samplers/cpu_sampler.rb +44 -0
- data/lib/new_relic/agent/samplers/memory_sampler.rb +126 -0
- data/lib/new_relic/agent/samplers/mongrel_sampler.rb +22 -0
- data/lib/new_relic/agent/shim_agent.rb +11 -0
- data/lib/new_relic/agent/stats_engine.rb +85 -46
- data/lib/new_relic/agent/transaction_sampler.rb +63 -38
- data/lib/new_relic/agent/worker_loop.rb +8 -18
- data/lib/new_relic/agent.rb +200 -25
- data/lib/new_relic/commands/deployments.rb +9 -9
- data/lib/new_relic/control/merb.rb +22 -0
- data/lib/new_relic/control/rails.rb +141 -0
- data/lib/new_relic/{config → control}/ruby.rb +13 -2
- data/lib/new_relic/control.rb +424 -0
- data/lib/new_relic/local_environment.rb +201 -79
- data/lib/new_relic/metric_data.rb +7 -0
- data/lib/new_relic/metric_parser/action_mailer.rb +9 -0
- data/lib/new_relic/metric_parser/active_merchant.rb +26 -0
- data/lib/new_relic/metric_parser/active_record.rb +11 -0
- data/lib/new_relic/metric_parser/controller.rb +51 -0
- data/lib/new_relic/metric_parser/controller_cpu.rb +38 -0
- data/lib/new_relic/metric_parser/database.rb +23 -0
- data/lib/new_relic/metric_parser/errors.rb +6 -0
- data/lib/new_relic/metric_parser/mem_cache.rb +12 -0
- data/lib/new_relic/metric_parser/view.rb +61 -0
- data/lib/new_relic/metric_parser/web_service.rb +9 -0
- data/lib/new_relic/metric_parser.rb +107 -0
- data/lib/new_relic/metric_spec.rb +5 -0
- data/lib/new_relic/noticed_error.rb +5 -1
- data/lib/new_relic/rack/metric_app.rb +57 -0
- data/lib/new_relic/rack/newrelic.ru +25 -0
- data/lib/new_relic/rack/newrelic.yml +25 -0
- data/lib/new_relic/rack.rb +5 -0
- data/lib/new_relic/recipes.rb +10 -3
- data/lib/new_relic/stats.rb +130 -144
- data/lib/new_relic/transaction_analysis.rb +7 -8
- data/lib/new_relic/transaction_sample.rb +86 -10
- data/lib/new_relic/version.rb +41 -160
- data/lib/new_relic_api.rb +7 -6
- data/lib/newrelic_rpm.rb +30 -17
- data/lib/tasks/{agent_tests.rake → tests.rake} +1 -1
- data/newrelic.yml +115 -62
- data/newrelic_rpm.gemspec +36 -0
- data/test/active_record_fixtures.rb +55 -0
- data/test/config/newrelic.yml +21 -3
- data/test/config/{test_config.rb → test_control.rb} +14 -10
- data/test/new_relic/agent/active_record_instrumentation_test.rb +189 -0
- data/test/new_relic/agent/agent_test.rb +104 -0
- data/test/new_relic/agent/agent_test_controller.rb +18 -1
- data/test/new_relic/agent/classloader_patch_test.rb +56 -0
- data/test/new_relic/agent/{tc_collection_helper.rb → collection_helper_test.rb} +28 -23
- data/test/new_relic/agent/controller_test.rb +107 -0
- data/test/new_relic/agent/dispatcher_instrumentation_test.rb +70 -0
- data/test/new_relic/agent/error_collector_test.rb +155 -0
- data/test/new_relic/agent/{tc_method_tracer.rb → method_tracer_test.rb} +6 -12
- data/test/new_relic/agent/metric_data_test.rb +56 -0
- data/test/new_relic/agent/stats_engine_test.rb +266 -0
- data/test/new_relic/agent/{tc_transaction_sample_builder.rb → transaction_sample_builder_test.rb} +6 -5
- data/test/new_relic/agent/{tc_transaction_sample.rb → transaction_sample_test.rb} +9 -13
- data/test/new_relic/agent/transaction_sampler_test.rb +317 -0
- data/test/new_relic/agent/{tc_worker_loop.rb → worker_loop_test.rb} +1 -1
- data/test/new_relic/control_test.rb +97 -0
- data/test/new_relic/{tc_deployments_api.rb → deployments_api_test.rb} +8 -4
- data/test/new_relic/environment_test.rb +75 -0
- data/test/new_relic/metric_parser_test.rb +142 -0
- data/test/new_relic/{tc_metric_spec.rb → metric_spec_test.rb} +28 -1
- data/test/new_relic/samplers_test.rb +71 -0
- data/test/new_relic/{tc_shim_agent.rb → shim_agent_test.rb} +1 -1
- data/test/new_relic/stats_test.rb +291 -0
- data/test/new_relic/version_number_test.rb +46 -0
- data/test/test_helper.rb +7 -30
- data/test/ui/newrelic_controller_test.rb +14 -0
- data/test/ui/{tc_newrelic_helper.rb → newrelic_helper_test.rb} +16 -7
- data/ui/controllers/newrelic_controller.rb +17 -3
- data/ui/helpers/newrelic_helper.rb +44 -15
- data/ui/views/layouts/newrelic_default.rhtml +7 -8
- data/ui/views/newrelic/_sample.rhtml +5 -2
- data/ui/views/newrelic/_segment.rhtml +1 -1
- data/ui/views/newrelic/_segment_limit_message.rhtml +1 -0
- data/ui/views/newrelic/_segment_row.rhtml +4 -4
- data/ui/views/newrelic/_show_sample_detail.rhtml +3 -1
- data/ui/views/newrelic/_show_sample_sql.rhtml +2 -1
- data/ui/views/newrelic/explain_sql.rhtml +2 -5
- data/ui/views/newrelic/images/file_icon.png +0 -0
- data/ui/views/newrelic/images/new_relic_rpm_desktop.gif +0 -0
- data/ui/views/newrelic/index.rhtml +21 -13
- data/ui/views/newrelic/javascript/prototype-scriptaculous.js +7288 -0
- data/ui/views/newrelic/show_sample.rhtml +18 -3
- data/ui/views/newrelic/stylesheets/style.css +39 -0
- data/ui/views/newrelic/threads.rhtml +52 -0
- metadata +192 -70
- data/README +0 -136
- data/lib/new_relic/agent/instrumentation/rails/rails.rb +0 -6
- data/lib/new_relic/agent/samplers/cpu.rb +0 -29
- data/lib/new_relic/agent/samplers/memory.rb +0 -53
- data/lib/new_relic/agent/samplers/mongrel.rb +0 -26
- data/lib/new_relic/agent/synchronize.rb +0 -40
- data/lib/new_relic/config/merb.rb +0 -35
- data/lib/new_relic/config/rails.rb +0 -114
- data/lib/new_relic/config.rb +0 -279
- data/lib/new_relic/shim_agent.rb +0 -96
- data/test/new_relic/agent/model_fixture.rb +0 -15
- data/test/new_relic/agent/tc_active_record.rb +0 -90
- data/test/new_relic/agent/tc_agent.rb +0 -148
- data/test/new_relic/agent/tc_controller.rb +0 -77
- data/test/new_relic/agent/tc_dispatcher_instrumentation.rb +0 -52
- data/test/new_relic/agent/tc_error_collector.rb +0 -127
- data/test/new_relic/agent/tc_stats_engine.rb +0 -218
- data/test/new_relic/agent/tc_synchronize.rb +0 -37
- data/test/new_relic/agent/tc_transaction_sampler.rb +0 -302
- data/test/new_relic/tc_config.rb +0 -36
- data/test/new_relic/tc_environment.rb +0 -94
- data/test/new_relic/tc_stats.rb +0 -141
data/test/new_relic/tc_stats.rb
DELETED
@@ -1,141 +0,0 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__),'..', 'test_helper'))
|
2
|
-
##require "new_relic/stats"
|
3
|
-
|
4
|
-
class NewRelic::StatsTests < Test::Unit::TestCase
|
5
|
-
|
6
|
-
def test_simple
|
7
|
-
stats = NewRelic::MethodTraceStats.new
|
8
|
-
validate stats, 0, 0, 0, 0
|
9
|
-
|
10
|
-
assert_equal stats.call_count,0
|
11
|
-
stats.trace_call 10
|
12
|
-
stats.trace_call 20
|
13
|
-
stats.trace_call 30
|
14
|
-
|
15
|
-
validate stats, 3, (10+20+30), 10, 30
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_merge
|
19
|
-
s1 = NewRelic::MethodTraceStats.new
|
20
|
-
s2 = NewRelic::MethodTraceStats.new
|
21
|
-
|
22
|
-
s1.trace_call 10
|
23
|
-
s2.trace_call 20
|
24
|
-
s2.freeze
|
25
|
-
|
26
|
-
validate s2, 1, 20, 20, 20
|
27
|
-
s3 = s1.merge s2
|
28
|
-
validate s3, 2, (10+20), 10, 20
|
29
|
-
validate s1, 1, 10, 10, 10
|
30
|
-
validate s2, 1, 20, 20, 20
|
31
|
-
|
32
|
-
s1.merge! s2
|
33
|
-
validate s1, 2, (10+20), 10, 20
|
34
|
-
validate s2, 1, 20, 20, 20
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_merge_with_exclusive
|
38
|
-
s1 = NewRelic::MethodTraceStats.new
|
39
|
-
|
40
|
-
s2 = NewRelic::MethodTraceStats.new
|
41
|
-
|
42
|
-
s1.trace_call 10, 5
|
43
|
-
s2.trace_call 20, 10
|
44
|
-
s2.freeze
|
45
|
-
|
46
|
-
validate s2, 1, 20, 20, 20, 10
|
47
|
-
s3 = s1.merge s2
|
48
|
-
validate s3, 2, (10+20), 10, 20, (10+5)
|
49
|
-
validate s1, 1, 10, 10, 10, 5
|
50
|
-
validate s2, 1, 20, 20, 20, 10
|
51
|
-
|
52
|
-
s1.merge! s2
|
53
|
-
validate s1, 2, (10+20), 10, 20, (5+10)
|
54
|
-
validate s2, 1, 20, 20, 20, 10
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_merge_array
|
58
|
-
s1 = NewRelic::MethodTraceStats.new
|
59
|
-
merges = []
|
60
|
-
merges << (NewRelic::MethodTraceStats.new.trace_call 1)
|
61
|
-
merges << (NewRelic::MethodTraceStats.new.trace_call 1)
|
62
|
-
merges << (NewRelic::MethodTraceStats.new.trace_call 1)
|
63
|
-
|
64
|
-
s1.merge! merges
|
65
|
-
validate s1, 3, 3, 1, 1
|
66
|
-
end
|
67
|
-
|
68
|
-
def test_freeze
|
69
|
-
s1 = NewRelic::MethodTraceStats.new
|
70
|
-
|
71
|
-
s1.trace_call 10
|
72
|
-
s1.freeze
|
73
|
-
|
74
|
-
begin
|
75
|
-
# the following should throw an exception because s1 is frozen
|
76
|
-
s1.trace_call 20
|
77
|
-
assert false
|
78
|
-
rescue StandardError
|
79
|
-
assert s1.frozen?
|
80
|
-
validate s1, 1, 10, 10, 10
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
def test_std_dev
|
85
|
-
s = NewRelic::MethodTraceStats.new
|
86
|
-
|
87
|
-
s.trace_call 10
|
88
|
-
s.trace_call 10
|
89
|
-
s.trace_call 10
|
90
|
-
s.trace_call 10
|
91
|
-
s.trace_call 10
|
92
|
-
s.trace_call 10
|
93
|
-
assert s.standard_deviation == 0
|
94
|
-
|
95
|
-
s = NewRelic::MethodTraceStats.new
|
96
|
-
s.trace_call 4
|
97
|
-
s.trace_call 7
|
98
|
-
s.trace_call 13
|
99
|
-
s.trace_call 16
|
100
|
-
s.trace_call 8
|
101
|
-
s.trace_call 4
|
102
|
-
assert_equal(s.sum_of_squares, 4**2 + 7**2 + 13**2 + 16**2 + 8**2 + 4**2)
|
103
|
-
|
104
|
-
s.trace_call 9
|
105
|
-
s.trace_call 3
|
106
|
-
s.trace_call 1000
|
107
|
-
s.trace_call 4
|
108
|
-
|
109
|
-
# calculated stdev (population, not sample) from a spreadsheet.
|
110
|
-
assert_in_delta(s.standard_deviation, 297.76, 0.01)
|
111
|
-
end
|
112
|
-
|
113
|
-
def test_std_dev_merge
|
114
|
-
s1 = NewRelic::MethodTraceStats.new
|
115
|
-
s1.trace_call 4
|
116
|
-
s1.trace_call 7
|
117
|
-
|
118
|
-
s2 = NewRelic::MethodTraceStats.new
|
119
|
-
s2.trace_call 13
|
120
|
-
s2.trace_call 16
|
121
|
-
|
122
|
-
s3 = s1.merge(s2)
|
123
|
-
|
124
|
-
assert(s1.sum_of_squares, 4*4 + 7*7)
|
125
|
-
assert_in_delta(s1.standard_deviation, 1.5, 0.01)
|
126
|
-
|
127
|
-
assert_in_delta(s2.standard_deviation, 1.5, 0.01)
|
128
|
-
assert_equal(s3.sum_of_squares, 4*4 + 7*7 + 13*13 + 16*16, "check sum of squares")
|
129
|
-
assert_in_delta(s3.standard_deviation, 4.743, 0.01)
|
130
|
-
end
|
131
|
-
|
132
|
-
private
|
133
|
-
def validate (stats, count, total, min, max, exclusive = nil)
|
134
|
-
assert_equal stats.call_count, count
|
135
|
-
assert_equal stats.total_call_time, total
|
136
|
-
assert_equal stats.average_call_time, (count > 0 ? total / count : 0)
|
137
|
-
assert_equal stats.min_call_time, min
|
138
|
-
assert_equal stats.max_call_time, max
|
139
|
-
assert_equal stats.total_exclusive_time, exclusive if exclusive
|
140
|
-
end
|
141
|
-
end
|