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.

Files changed (137) hide show
  1. data/CHANGELOG +267 -0
  2. data/LICENSE +1 -1
  3. data/Manifest +142 -0
  4. data/README.md +138 -0
  5. data/Rakefile +10 -28
  6. data/bin/mongrel_rpm +33 -0
  7. data/cert/cacert.pem +34 -0
  8. data/init.rb +38 -0
  9. data/lib/new_relic/agent/agent.rb +160 -347
  10. data/lib/new_relic/agent/collection_helper.rb +13 -24
  11. data/lib/new_relic/agent/error_collector.rb +29 -15
  12. data/lib/new_relic/agent/instrumentation/active_record_instrumentation.rb +63 -76
  13. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +90 -48
  14. data/lib/new_relic/agent/instrumentation/dispatcher_instrumentation.rb +72 -47
  15. data/lib/new_relic/agent/instrumentation/error_instrumentation.rb +14 -0
  16. data/lib/new_relic/agent/instrumentation/merb/controller.rb +10 -1
  17. data/lib/new_relic/agent/instrumentation/merb/dispatcher.rb +5 -7
  18. data/lib/new_relic/agent/instrumentation/merb/errors.rb +3 -1
  19. data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +7 -0
  20. data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +34 -7
  21. data/lib/new_relic/agent/instrumentation/rails/dispatcher.rb +20 -12
  22. data/lib/new_relic/agent/instrumentation/rails/errors.rb +5 -4
  23. data/lib/new_relic/agent/method_tracer.rb +159 -135
  24. data/lib/new_relic/agent/patch_const_missing.rb +46 -26
  25. data/lib/new_relic/agent/sampler.rb +12 -0
  26. data/lib/new_relic/agent/samplers/cpu_sampler.rb +44 -0
  27. data/lib/new_relic/agent/samplers/memory_sampler.rb +126 -0
  28. data/lib/new_relic/agent/samplers/mongrel_sampler.rb +22 -0
  29. data/lib/new_relic/agent/shim_agent.rb +11 -0
  30. data/lib/new_relic/agent/stats_engine.rb +85 -46
  31. data/lib/new_relic/agent/transaction_sampler.rb +63 -38
  32. data/lib/new_relic/agent/worker_loop.rb +8 -18
  33. data/lib/new_relic/agent.rb +200 -25
  34. data/lib/new_relic/commands/deployments.rb +9 -9
  35. data/lib/new_relic/control/merb.rb +22 -0
  36. data/lib/new_relic/control/rails.rb +141 -0
  37. data/lib/new_relic/{config → control}/ruby.rb +13 -2
  38. data/lib/new_relic/control.rb +424 -0
  39. data/lib/new_relic/local_environment.rb +201 -79
  40. data/lib/new_relic/metric_data.rb +7 -0
  41. data/lib/new_relic/metric_parser/action_mailer.rb +9 -0
  42. data/lib/new_relic/metric_parser/active_merchant.rb +26 -0
  43. data/lib/new_relic/metric_parser/active_record.rb +11 -0
  44. data/lib/new_relic/metric_parser/controller.rb +51 -0
  45. data/lib/new_relic/metric_parser/controller_cpu.rb +38 -0
  46. data/lib/new_relic/metric_parser/database.rb +23 -0
  47. data/lib/new_relic/metric_parser/errors.rb +6 -0
  48. data/lib/new_relic/metric_parser/mem_cache.rb +12 -0
  49. data/lib/new_relic/metric_parser/view.rb +61 -0
  50. data/lib/new_relic/metric_parser/web_service.rb +9 -0
  51. data/lib/new_relic/metric_parser.rb +107 -0
  52. data/lib/new_relic/metric_spec.rb +5 -0
  53. data/lib/new_relic/noticed_error.rb +5 -1
  54. data/lib/new_relic/rack/metric_app.rb +57 -0
  55. data/lib/new_relic/rack/newrelic.ru +25 -0
  56. data/lib/new_relic/rack/newrelic.yml +25 -0
  57. data/lib/new_relic/rack.rb +5 -0
  58. data/lib/new_relic/recipes.rb +10 -3
  59. data/lib/new_relic/stats.rb +130 -144
  60. data/lib/new_relic/transaction_analysis.rb +7 -8
  61. data/lib/new_relic/transaction_sample.rb +86 -10
  62. data/lib/new_relic/version.rb +41 -160
  63. data/lib/new_relic_api.rb +7 -6
  64. data/lib/newrelic_rpm.rb +30 -17
  65. data/lib/tasks/{agent_tests.rake → tests.rake} +1 -1
  66. data/newrelic.yml +115 -62
  67. data/newrelic_rpm.gemspec +36 -0
  68. data/test/active_record_fixtures.rb +55 -0
  69. data/test/config/newrelic.yml +21 -3
  70. data/test/config/{test_config.rb → test_control.rb} +14 -10
  71. data/test/new_relic/agent/active_record_instrumentation_test.rb +189 -0
  72. data/test/new_relic/agent/agent_test.rb +104 -0
  73. data/test/new_relic/agent/agent_test_controller.rb +18 -1
  74. data/test/new_relic/agent/classloader_patch_test.rb +56 -0
  75. data/test/new_relic/agent/{tc_collection_helper.rb → collection_helper_test.rb} +28 -23
  76. data/test/new_relic/agent/controller_test.rb +107 -0
  77. data/test/new_relic/agent/dispatcher_instrumentation_test.rb +70 -0
  78. data/test/new_relic/agent/error_collector_test.rb +155 -0
  79. data/test/new_relic/agent/{tc_method_tracer.rb → method_tracer_test.rb} +6 -12
  80. data/test/new_relic/agent/metric_data_test.rb +56 -0
  81. data/test/new_relic/agent/stats_engine_test.rb +266 -0
  82. data/test/new_relic/agent/{tc_transaction_sample_builder.rb → transaction_sample_builder_test.rb} +6 -5
  83. data/test/new_relic/agent/{tc_transaction_sample.rb → transaction_sample_test.rb} +9 -13
  84. data/test/new_relic/agent/transaction_sampler_test.rb +317 -0
  85. data/test/new_relic/agent/{tc_worker_loop.rb → worker_loop_test.rb} +1 -1
  86. data/test/new_relic/control_test.rb +97 -0
  87. data/test/new_relic/{tc_deployments_api.rb → deployments_api_test.rb} +8 -4
  88. data/test/new_relic/environment_test.rb +75 -0
  89. data/test/new_relic/metric_parser_test.rb +142 -0
  90. data/test/new_relic/{tc_metric_spec.rb → metric_spec_test.rb} +28 -1
  91. data/test/new_relic/samplers_test.rb +71 -0
  92. data/test/new_relic/{tc_shim_agent.rb → shim_agent_test.rb} +1 -1
  93. data/test/new_relic/stats_test.rb +291 -0
  94. data/test/new_relic/version_number_test.rb +46 -0
  95. data/test/test_helper.rb +7 -30
  96. data/test/ui/newrelic_controller_test.rb +14 -0
  97. data/test/ui/{tc_newrelic_helper.rb → newrelic_helper_test.rb} +16 -7
  98. data/ui/controllers/newrelic_controller.rb +17 -3
  99. data/ui/helpers/newrelic_helper.rb +44 -15
  100. data/ui/views/layouts/newrelic_default.rhtml +7 -8
  101. data/ui/views/newrelic/_sample.rhtml +5 -2
  102. data/ui/views/newrelic/_segment.rhtml +1 -1
  103. data/ui/views/newrelic/_segment_limit_message.rhtml +1 -0
  104. data/ui/views/newrelic/_segment_row.rhtml +4 -4
  105. data/ui/views/newrelic/_show_sample_detail.rhtml +3 -1
  106. data/ui/views/newrelic/_show_sample_sql.rhtml +2 -1
  107. data/ui/views/newrelic/explain_sql.rhtml +2 -5
  108. data/ui/views/newrelic/images/file_icon.png +0 -0
  109. data/ui/views/newrelic/images/new_relic_rpm_desktop.gif +0 -0
  110. data/ui/views/newrelic/index.rhtml +21 -13
  111. data/ui/views/newrelic/javascript/prototype-scriptaculous.js +7288 -0
  112. data/ui/views/newrelic/show_sample.rhtml +18 -3
  113. data/ui/views/newrelic/stylesheets/style.css +39 -0
  114. data/ui/views/newrelic/threads.rhtml +52 -0
  115. metadata +192 -70
  116. data/README +0 -136
  117. data/lib/new_relic/agent/instrumentation/rails/rails.rb +0 -6
  118. data/lib/new_relic/agent/samplers/cpu.rb +0 -29
  119. data/lib/new_relic/agent/samplers/memory.rb +0 -53
  120. data/lib/new_relic/agent/samplers/mongrel.rb +0 -26
  121. data/lib/new_relic/agent/synchronize.rb +0 -40
  122. data/lib/new_relic/config/merb.rb +0 -35
  123. data/lib/new_relic/config/rails.rb +0 -114
  124. data/lib/new_relic/config.rb +0 -279
  125. data/lib/new_relic/shim_agent.rb +0 -96
  126. data/test/new_relic/agent/model_fixture.rb +0 -15
  127. data/test/new_relic/agent/tc_active_record.rb +0 -90
  128. data/test/new_relic/agent/tc_agent.rb +0 -148
  129. data/test/new_relic/agent/tc_controller.rb +0 -77
  130. data/test/new_relic/agent/tc_dispatcher_instrumentation.rb +0 -52
  131. data/test/new_relic/agent/tc_error_collector.rb +0 -127
  132. data/test/new_relic/agent/tc_stats_engine.rb +0 -218
  133. data/test/new_relic/agent/tc_synchronize.rb +0 -37
  134. data/test/new_relic/agent/tc_transaction_sampler.rb +0 -302
  135. data/test/new_relic/tc_config.rb +0 -36
  136. data/test/new_relic/tc_environment.rb +0 -94
  137. data/test/new_relic/tc_stats.rb +0 -141
@@ -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