newrelic_rpm 4.0.0.332 → 4.1.0.333

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +0 -1
  3. data/CHANGELOG.md +22 -0
  4. data/LICENSE +1 -27
  5. data/README.md +4 -57
  6. data/lib/new_relic/agent.rb +0 -1
  7. data/lib/new_relic/agent/attribute_filter.rb +0 -1
  8. data/lib/new_relic/agent/configuration/default_source.rb +3 -32
  9. data/lib/new_relic/agent/error_collector.rb +0 -2
  10. data/lib/new_relic/agent/http_clients/curb_wrappers.rb +1 -1
  11. data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +1 -1
  12. data/lib/new_relic/agent/http_clients/uri_util.rb +12 -7
  13. data/lib/new_relic/agent/stats.rb +0 -14
  14. data/lib/new_relic/agent/stats_engine.rb +171 -3
  15. data/lib/new_relic/agent/supported_versions.rb +9 -9
  16. data/lib/new_relic/agent/traced_method_stack.rb +1 -1
  17. data/lib/new_relic/agent/transaction/attributes.rb +0 -2
  18. data/lib/new_relic/agent/transaction/external_request_segment.rb +1 -5
  19. data/lib/new_relic/agent/transaction/trace_node.rb +0 -10
  20. data/lib/new_relic/agent/transaction_sample_builder.rb +0 -3
  21. data/lib/new_relic/agent/transaction_sampler.rb +3 -13
  22. data/lib/new_relic/collection_helper.rb +0 -18
  23. data/lib/new_relic/control/frameworks/rails.rb +1 -21
  24. data/lib/new_relic/control/frameworks/rails3.rb +1 -1
  25. data/lib/new_relic/noticed_error.rb +1 -0
  26. data/lib/new_relic/version.rb +1 -1
  27. data/newrelic.yml +0 -4
  28. data/newrelic_rpm.gemspec +1 -1
  29. data/test/config/newrelic.yml +1 -1
  30. data/test/multiverse/lib/multiverse/runner.rb +9 -1
  31. data/test/multiverse/suites/active_record/config/newrelic.yml +0 -1
  32. data/test/multiverse/suites/agent_only/config/newrelic.yml +0 -1
  33. data/test/multiverse/suites/capistrano/config/newrelic.yml +0 -1
  34. data/test/multiverse/suites/capistrano2/config/newrelic.yml +0 -1
  35. data/test/multiverse/suites/curb/config/newrelic.yml +0 -1
  36. data/test/multiverse/suites/datamapper/config/newrelic.yml +0 -1
  37. data/test/multiverse/suites/deferred_instrumentation/config/newrelic.yml +0 -1
  38. data/test/multiverse/suites/delayed_job/config/newrelic.yml +0 -1
  39. data/test/multiverse/suites/excon/config/newrelic.yml +0 -1
  40. data/test/multiverse/suites/grape/config/newrelic.yml +0 -1
  41. data/test/multiverse/suites/high_security/config/newrelic.yml +0 -1
  42. data/test/multiverse/suites/httpclient/config/newrelic.yml +0 -1
  43. data/test/multiverse/suites/httprb/config/newrelic.yml +0 -1
  44. data/test/multiverse/suites/json/config/newrelic.yml +0 -1
  45. data/test/multiverse/suites/marshalling/config/newrelic.yml +0 -1
  46. data/test/multiverse/suites/mongo/config/newrelic.yml +0 -1
  47. data/test/multiverse/suites/net_http/config/newrelic.yml +0 -1
  48. data/test/multiverse/suites/padrino/config/newrelic.yml +0 -1
  49. data/test/multiverse/suites/rack/config/newrelic.yml +0 -1
  50. data/test/multiverse/suites/rails/config/newrelic.yml +0 -1
  51. data/test/multiverse/suites/rake/config/newrelic.yml +0 -1
  52. data/test/multiverse/suites/redis/config/newrelic.yml +0 -1
  53. data/test/multiverse/suites/resque/config/newrelic.yml +0 -1
  54. data/test/multiverse/suites/sequel/config/newrelic.yml +0 -1
  55. data/test/multiverse/suites/sidekiq/config/newrelic.yml +0 -1
  56. data/test/multiverse/suites/sinatra/config/newrelic.yml +0 -1
  57. data/test/multiverse/suites/typhoeus/config/newrelic.yml +0 -1
  58. data/test/multiverse/suites/yajl/config/newrelic.yml +0 -1
  59. data/test/multiverse/test/suite_examples/one/a/config/newrelic.yml +0 -1
  60. data/test/multiverse/test/suite_examples/one/b/config/newrelic.yml +0 -1
  61. data/test/new_relic/agent/agent/connect_test.rb +3 -12
  62. data/test/new_relic/agent/agent/start_test.rb +4 -2
  63. data/test/new_relic/agent/busy_calculator_test.rb +13 -5
  64. data/test/new_relic/agent/pipe_channel_manager_test.rb +3 -4
  65. data/test/new_relic/agent/stats_engine_test.rb +313 -1
  66. data/test/new_relic/agent/stats_test.rb +0 -20
  67. data/test/new_relic/agent/traced_method_stack_test.rb +2 -5
  68. data/test/new_relic/agent/transaction/external_request_segment_test.rb +5 -0
  69. data/test/new_relic/agent/transaction/trace_node_test.rb +0 -19
  70. data/test/new_relic/agent/transaction_sampler_test.rb +3 -6
  71. data/test/new_relic/collection_helper_test.rb +0 -39
  72. data/test/new_relic/control_test.rb +2 -4
  73. data/test/new_relic/license_test.rb +4 -14
  74. data/test/performance/suites/external_segment.rb +0 -2
  75. data/test/performance/suites/rack_middleware.rb +1 -3
  76. data/test/performance/suites/transaction_tracing.rb +0 -1
  77. metadata +2 -94
  78. data/lib/conditional_vendored_metric_parser.rb +0 -9
  79. data/lib/new_relic/agent/instrumentation/rubyprof.rb +0 -26
  80. data/lib/new_relic/agent/stats_engine/metric_stats.rb +0 -188
  81. data/lib/new_relic/agent/transaction/developer_mode_sample_buffer.rb +0 -62
  82. data/lib/new_relic/merbtasks.rb +0 -10
  83. data/lib/new_relic/rack/developer_mode.rb +0 -321
  84. data/lib/new_relic/rack/developer_mode/segment_summary.rb +0 -56
  85. data/test/new_relic/agent/stats_engine/metric_stats_test.rb +0 -328
  86. data/test/new_relic/agent/transaction/developer_mode_sample_buffer_test.rb +0 -75
  87. data/test/new_relic/metric_parser/metric_parser_test.rb +0 -17
  88. data/test/new_relic/rack/developer_mode/segment_summary_test.rb +0 -96
  89. data/test/new_relic/rack/developer_mode_helper_test.rb +0 -136
  90. data/test/new_relic/rack/developer_mode_test.rb +0 -96
  91. data/ui/helpers/developer_mode_helper.rb +0 -325
  92. data/ui/helpers/google_pie_chart.rb +0 -54
  93. data/ui/views/layouts/newrelic_default.rhtml +0 -48
  94. data/ui/views/newrelic/_explain_plans.rhtml +0 -27
  95. data/ui/views/newrelic/_sample.rhtml +0 -20
  96. data/ui/views/newrelic/_segment.rhtml +0 -28
  97. data/ui/views/newrelic/_segment_limit_message.rhtml +0 -1
  98. data/ui/views/newrelic/_segment_row.rhtml +0 -12
  99. data/ui/views/newrelic/_show_sample_detail.rhtml +0 -24
  100. data/ui/views/newrelic/_show_sample_sql.rhtml +0 -24
  101. data/ui/views/newrelic/_show_sample_summary.rhtml +0 -3
  102. data/ui/views/newrelic/_sql_row.rhtml +0 -16
  103. data/ui/views/newrelic/_stack_trace.rhtml +0 -15
  104. data/ui/views/newrelic/_table.rhtml +0 -12
  105. data/ui/views/newrelic/explain_sql.rhtml +0 -43
  106. data/ui/views/newrelic/file/images/arrow-close.png +0 -0
  107. data/ui/views/newrelic/file/images/arrow-open.png +0 -0
  108. data/ui/views/newrelic/file/images/blue_bar.gif +0 -0
  109. data/ui/views/newrelic/file/images/file_icon.png +0 -0
  110. data/ui/views/newrelic/file/images/gray_bar.gif +0 -0
  111. data/ui/views/newrelic/file/images/new-relic-rpm-desktop.gif +0 -0
  112. data/ui/views/newrelic/file/images/new_relic_rpm_desktop.gif +0 -0
  113. data/ui/views/newrelic/file/images/textmate.png +0 -0
  114. data/ui/views/newrelic/file/javascript/jquery-1.4.2.js +0 -6243
  115. data/ui/views/newrelic/file/javascript/transaction_sample.js +0 -123
  116. data/ui/views/newrelic/file/stylesheets/style.css +0 -490
  117. data/ui/views/newrelic/index.rhtml +0 -70
  118. data/ui/views/newrelic/sample_not_found.rhtml +0 -2
  119. data/ui/views/newrelic/show_sample.rhtml +0 -81
  120. data/ui/views/newrelic/threads.rhtml +0 -45
  121. data/vendor/gems/metric_parser-0.1.0.pre1/.specification +0 -116
  122. data/vendor/gems/metric_parser-0.1.0.pre1/lib/metric_parser.rb +0 -5
  123. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser.rb +0 -70
  124. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/action_mailer.rb +0 -18
  125. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/active_merchant.rb +0 -35
  126. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/active_record.rb +0 -37
  127. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/apdex.rb +0 -93
  128. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/background_transaction.rb +0 -11
  129. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/client.rb +0 -50
  130. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb +0 -71
  131. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller_cpu.rb +0 -47
  132. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller_ext.rb +0 -21
  133. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/database.rb +0 -52
  134. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/database_pool.rb +0 -28
  135. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/dot_net.rb +0 -32
  136. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/dot_net_parser.rb +0 -21
  137. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/errors.rb +0 -15
  138. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/external.rb +0 -59
  139. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/frontend.rb +0 -44
  140. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/gc.rb +0 -24
  141. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/hibernate_session.rb +0 -11
  142. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/java.rb +0 -35
  143. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/java_parser.rb +0 -21
  144. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/jsp.rb +0 -38
  145. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/jsp_tag.rb +0 -11
  146. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/mem_cache.rb +0 -56
  147. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/metric_parser.rb +0 -138
  148. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/middleware.rb +0 -33
  149. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/nested.rb +0 -23
  150. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/orm.rb +0 -31
  151. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/other_transaction.rb +0 -44
  152. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet.rb +0 -11
  153. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet_context_listener.rb +0 -11
  154. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet_filter.rb +0 -11
  155. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet_init.rb +0 -11
  156. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/solr.rb +0 -31
  157. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/solr_request_handler.rb +0 -19
  158. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/spring.rb +0 -58
  159. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/spring_controller.rb +0 -10
  160. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/spring_view.rb +0 -10
  161. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/struts_action.rb +0 -24
  162. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/struts_result.rb +0 -24
  163. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/version.rb +0 -9
  164. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb +0 -74
  165. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_frontend.rb +0 -22
  166. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_service.rb +0 -18
  167. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_transaction.rb +0 -137
@@ -1,17 +0,0 @@
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 'conditional_vendored_metric_parser'
6
-
7
- require File.expand_path(File.join(File.dirname(__FILE__),'..', '..', 'test_helper'))
8
- class NewRelic::MetricParser::MetricParserTest < Minitest::Test
9
- class ::AnApplicationClass
10
- end
11
-
12
- def test_metric_parser_does_not_instantiate_non_metric_parsing_classes
13
- assert NewRelic::MetricParser::MetricParser.for_metric_named('AnApplicationClass/Foo/Bar').
14
- is_a? NewRelic::MetricParser::MetricParser
15
- end
16
-
17
- end
@@ -1,96 +0,0 @@
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 File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..','test_helper'))
6
- require 'new_relic/rack/developer_mode'
7
- require 'new_relic/rack/developer_mode/segment_summary'
8
-
9
- class SegmentSummaryTest < Minitest::Test
10
- def setup
11
- @sample = mock('sample')
12
- @ss = NewRelic::Rack::DeveloperMode::SegmentSummary.new('Controller/foo', @sample)
13
- end
14
-
15
- # these are mostly stub tests just making sure that the API doesn't
16
- # change if anyone ever needs to modify it.
17
-
18
- def test_insert
19
- segment = mock('segment')
20
- segment.expects(:metric_name).returns('Controller/foo')
21
- segment.expects(:duration).returns(0.1)
22
- segment.expects(:exclusive_duration).returns(0.1)
23
- @ss << segment
24
- assert_equal 0.1, @ss.total_time
25
- assert_equal 0.1, @ss.exclusive_time
26
- assert_equal 1, @ss.call_count
27
- end
28
-
29
- def test_insert_error
30
- segment = mock('segment')
31
- segment.expects(:metric_name).returns('Controller/bar').twice
32
- assert_raises(ArgumentError) do
33
- @ss << segment
34
- end
35
- end
36
-
37
- def test_average_time
38
- @ss.total_time = 0.1
39
- @ss.call_count = 2
40
- assert_equal 0.05, @ss.average_time
41
- end
42
-
43
- def test_average_exclusive_time
44
- @ss.exclusive_time = 0.1
45
- @ss.call_count = 2
46
- assert_equal 0.05, @ss.average_exclusive_time
47
- end
48
-
49
- def test_exclusive_time_percentage_nil
50
- @ss.exclusive_time = nil
51
- assert_equal 0, @ss.exclusive_time_percentage
52
- end
53
-
54
- def test_exclusive_time_percentage
55
- @ss.exclusive_time = 0.05
56
- @sample.expects(:duration).returns(0.1).times(3)
57
- assert_equal 0.5, @ss.exclusive_time_percentage
58
- end
59
-
60
- def test_total_time_percentage_nil
61
- @ss.total_time = nil
62
- assert_equal 0, @ss.total_time_percentage
63
- end
64
-
65
- def test_total_time_percentage
66
- @ss.total_time = 0.05
67
- @sample.expects(:duration).returns(0.1).times(3)
68
- assert_equal 0.5, @ss.total_time_percentage
69
- end
70
-
71
- def test_nesting_total_time
72
- segment = mock('segment')
73
- segment.expects(:metric_name).twice.returns('Controller/foo')
74
- segment.expects(:duration).returns(0.1)
75
- segment.expects(:exclusive_duration).returns(0)
76
- @ss << segment
77
- segment.expects(:exclusive_duration).returns(0.1)
78
- @ss.current_nest_count += 1
79
- @ss << segment
80
- assert_equal 0.1, @ss.total_time
81
- assert_equal 0.1, @ss.exclusive_time
82
- assert_equal 2, @ss.call_count
83
- end
84
-
85
- def test_ui_name_default
86
- @ss.metric_name = 'Remainder'
87
- assert_equal 'Remainder', @ss.ui_name
88
- end
89
-
90
- def test_ui_name_lookup
91
- mocked_object = mock('metric parser obj')
92
- mocked_object.expects(:developer_name).returns('Developer Name')
93
- NewRelic::MetricParser::MetricParser.expects(:parse).with('Controller/foo').returns(mocked_object)
94
- assert_equal 'Developer Name', @ss.ui_name
95
- end
96
- end
@@ -1,136 +0,0 @@
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 File.expand_path(File.join(File.dirname(__FILE__),'..', '..',
6
- 'test_helper'))
7
- require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','ui',
8
- 'helpers','developer_mode_helper.rb'))
9
-
10
- ENV['RACK_ENV'] = 'test'
11
- class DeveloperModeTest < Minitest::Test
12
- include NewRelic::DeveloperModeHelper
13
-
14
-
15
- def test_application_caller
16
- assert_equal "/opt/ruby/lib/ruby/1.8/net/protocol.rb:135:in `rbuf_fill'", application_caller(Fixtures::NORMAL_TRACE)
17
- assert_equal "c:/Ruby192/lib/ruby/1.9.1/erb.rb:753:in `eval'", application_caller(Fixtures::WINDOWS_TRACE)
18
- end
19
-
20
- def test_application_stack_trace
21
- trace = application_stack_trace(Fixtures::NORMAL_TRACE)
22
- assert_equal 29, trace.size
23
- trace = application_stack_trace(Fixtures::WINDOWS_TRACE)
24
- assert_equal 14, trace.size
25
- end
26
-
27
- private
28
- def params; {} end
29
- module Fixtures
30
- WINDOWS_TRACE = <<-EOF.split("\n")
31
- newrelic_rpm (3.1.1) ui/helpers/developer_mode_helper.rb:234:in `file_and_line'
32
- newrelic_rpm (3.1.1) ui/helpers/developer_mode_helper.rb:30:in `block in application_caller'
33
- newrelic_rpm (3.1.1) ui/helpers/developer_mode_helper.rb:29:in `each'
34
- newrelic_rpm (3.1.1) ui/helpers/developer_mode_helper.rb:29:in `application_caller'
35
- newrelic_rpm (3.1.1) ui/helpers/developer_mode_helper.rb:111:in `link_to_source'
36
- (erb):5:in `render'
37
- c:/Ruby192/lib/ruby/1.9.1/erb.rb:753:in `eval'
38
- c:/Ruby192/lib/ruby/1.9.1/erb.rb:753:in `result'
39
- newrelic_rpm (3.1.1) lib/new_relic/rack/developer_mode.rb:155:in `render_without_layout'
40
- newrelic_rpm (3.1.1) lib/new_relic/rack/developer_mode.rb:136:in `render'
41
- newrelic_rpm (3.1.1) lib/new_relic/rack/developer_mode.rb:121:in `block in render'
42
- newrelic_rpm (3.1.1) lib/new_relic/rack/developer_mode.rb:120:in `map'
43
- newrelic_rpm (3.1.1) lib/new_relic/rack/developer_mode.rb:120:in `render'
44
- (erb):22:in `render'
45
- c:/Ruby192/lib/ruby/1.9.1/erb.rb:753:in `eval'
46
- c:/Ruby192/lib/ruby/1.9.1/erb.rb:753:in `result'
47
- newrelic_rpm (3.1.1) lib/new_relic/rack/developer_mode.rb:155:in `render_without_layout'
48
- newrelic_rpm (3.1.1) lib/new_relic/rack/developer_mode.rb:136:in `render'
49
- (erb):77:in `block in render'
50
- (erb):74:in `collect'
51
- (erb):74:in `render'
52
- c:/Ruby192/lib/ruby/1.9.1/erb.rb:753:in `eval'
53
- c:/Ruby192/lib/ruby/1.9.1/erb.rb:753:in `result'
54
- newrelic_rpm (3.1.1) lib/new_relic/rack/developer_mode.rb:155:in `render_without_layout'
55
- newrelic_rpm (3.1.1) lib/new_relic/rack/developer_mode.rb:133:in `block in render'
56
- (erb):38:in `render_with_layout'
57
- c:/Ruby192/lib/ruby/1.9.1/erb.rb:753:in `eval'
58
- c:/Ruby192/lib/ruby/1.9.1/erb.rb:753:in `result'
59
- newrelic_rpm (3.1.1) lib/new_relic/rack/developer_mode.rb:149:in `render_with_layout'
60
- newrelic_rpm (3.1.1) lib/new_relic/rack/developer_mode.rb:132:in `render'
61
- newrelic_rpm (3.1.1) lib/new_relic/rack/developer_mode.rb:232:in `show_sample_data'
62
- newrelic_rpm (3.1.1) lib/new_relic/rack/developer_mode.rb:47:in `_call'
63
- newrelic_rpm (3.1.1) lib/new_relic/rack/developer_mode.rb:25:in `call'
64
- warden (1.0.5) lib/warden/manager.rb:35:in `block in call'
65
- warden (1.0.5) lib/warden/manager.rb:34:in `catch'
66
- warden (1.0.5) lib/warden/manager.rb:34:in `call'
67
- actionpack (3.0.9) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
68
- actionpack (3.0.9) lib/action_dispatch/middleware/head.rb:14:in `call'
69
- rack (1.2.3) lib/rack/methodoverride.rb:24:in `call'
70
- actionpack (3.0.9) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
71
- actionpack (3.0.9) lib/action_dispatch/middleware/flash.rb:182:in `call'
72
- actionpack (3.0.9) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
73
- actionpack (3.0.9) lib/action_dispatch/middleware/cookies.rb:302:in `call'
74
- activerecord (3.0.9) lib/active_record/query_cache.rb:32:in `block in call'
75
- activerecord (3.0.9) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
76
- activerecord (3.0.9) lib/active_record/query_cache.rb:12:in `cache'
77
- activerecord (3.0.9) lib/active_record/query_cache.rb:31:in `call'
78
- activerecord (3.0.9) lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call'
79
- actionpack (3.0.9) lib/action_dispatch/middleware/callbacks.rb:46:in `block in call'
80
- activesupport (3.0.9) lib/active_support/callbacks.rb:416:in `_run_call_callbacks'
81
- actionpack (3.0.9) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
82
- rack (1.2.3) lib/rack/sendfile.rb:107:in `call'
83
- actionpack (3.0.9) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
84
- actionpack (3.0.9) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
85
- railties (3.0.9) lib/rails/rack/logger.rb:13:in `call'
86
- rack (1.2.3) lib/rack/runtime.rb:17:in `call'
87
- activesupport (3.0.9) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
88
- rack (1.2.3) lib/rack/lock.rb:11:in `block in call'
89
- <internal:prelude>:10:in `synchronize'
90
- rack (1.2.3) lib/rack/lock.rb:11:in `call'
91
- actionpack (3.0.9) lib/action_dispatch/middleware/static.rb:30:in `call'
92
- railties (3.0.9) lib/rails/application.rb:168:in `call'
93
- railties (3.0.9) lib/rails/application.rb:77:in `method_missing'
94
- railties (3.0.9) lib/rails/rack/log_tailer.rb:14:in `call'
95
- rack (1.2.3) lib/rack/content_length.rb:13:in `call'
96
- rack (1.2.3) lib/rack/handler/webrick.rb:52:in `service'
97
- c:/Ruby192/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
98
- c:/Ruby192/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
99
- c:/Ruby192/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
100
- EOF
101
-
102
- NORMAL_TRACE = <<-EOF.split("\n")
103
- /opt/ruby/lib/ruby/1.8/net/protocol.rb:135:in `rbuf_fill'
104
- /opt/ruby/lib/ruby/1.8/timeout.rb:101:in `timeout'
105
- /opt/ruby/lib/ruby/1.8/net/protocol.rb:126:in `readline'
106
- /opt/ruby/lib/ruby/1.8/net/http.rb:2028:in `read_status_line'
107
- /opt/ruby/lib/ruby/1.8/net/http.rb:1051:in `request_without_newrelic_trace'
108
- /opt/bundler/gems/ruby_agent-705a7cf29207/lib/new_relic/agent/instrumentation/net.rb:20:in `request_without_fakeweb'
109
- /opt/bundler/gems/ruby_agent-705a7cf29207/lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'
110
- /opt/bundler/gems/ruby_agent-705a7cf29207/lib/new_relic/agent/instrumentation/net.rb:19:in `request_without_fakeweb'
111
- /opt/ruby/gems/fakeweb-1.3.0/lib/fake_web/ext/net_http.rb:50:in `request'
112
- /opt/ruby/lib/ruby/1.8/net/http.rb:1037:in `request_without_newrelic_trace'
113
- /opt/ruby/lib/ruby/1.8/net/http.rb:543:in `start'
114
- /opt/ruby/lib/ruby/1.8/net/http.rb:1035:in `request_without_newrelic_trace'
115
- /opt/bundler/gems/ruby_agent-705a7cf29207/lib/new_relic/agent/instrumentation/net.rb:20:in `request_without_fakeweb'
116
- /opt/bundler/gems/ruby_agent-705a7cf29207/lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'
117
- /opt/bundler/gems/ruby_agent-705a7cf29207/lib/new_relic/agent/instrumentation/net.rb:19:in `request_without_fakeweb'
118
- /opt/ruby/gems/fakeweb-1.3.0/lib/fake_web/ext/net_http.rb:50:in `request'
119
- /opt/ruby/lib/ruby/1.8/net/http.rb:992:in `post2'
120
- /opt/ruby/gems/rforce-0.4.1/lib/rforce/binding.rb:141:in `call_remote'
121
- /opt/ruby/gems/rforce-0.4.1/lib/rforce/binding.rb:208:in `method_missing'
122
- /Users/joe/dev/workspace/lib/lead_lover/base.rb:135:in `update'
123
- /Users/joe/dev/workspace/lib/lead_lover/base.rb:123:in `update_filtered_attributes'
124
- /Users/joe/dev/workspace/lib/lead_lover/lead.rb:62:in `assign_to_owner'
125
- /Users/joe/dev/workspace/app/models/account.rb:1968:in `link_to_leadlover_lead'
126
- /Users/joe/dev/workspace/app/models/account.rb:1956:in `link_to_leadlover'
127
- /opt/ruby/gems/activerecord-2.3.14/lib/active_record/associations/association_proxy.rb:215:in `send'
128
- /opt/ruby/gems/activerecord-2.3.14/lib/active_record/associations/association_proxy.rb:215:in `method_missing'
129
- /Users/joe/dev/workspace/app/models/subscription.rb:883:in `link_to_leadlover'
130
- /opt/ruby/gems/delayed_job-2.0.6/lib/delayed/performable_method.rb:35:in `send'
131
- /opt/ruby/gems/delayed_job-2.0.6/lib/delayed/performable_method.rb:35:in `perform'
132
- /Users/joe/dev/workspace/config/initializers/delayed_job_with_shards.rb:17:in `perform'
133
- /opt/ruby/gems/delayed_job-2.0.6/lib/delayed/backend/base.rb:74:in `invoke_job'
134
- EOF
135
- end
136
- end
@@ -1,96 +0,0 @@
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
- if defined?(::Rails)
6
-
7
- require File.expand_path(File.join(File.dirname(__FILE__),'..', '..',
8
- 'test_helper'))
9
- require 'rack/test'
10
- require 'new_relic/rack/developer_mode'
11
-
12
- ENV['RACK_ENV'] = 'test'
13
-
14
- class DeveloperModeTest < Minitest::Test
15
- include Rack::Test::Methods
16
- include TransactionSampleTestHelper
17
-
18
- def app
19
- mock_app = lambda { |env| [500, {}, "Don't touch me!"] }
20
- NewRelic::Rack::DeveloperMode.new(mock_app)
21
- end
22
-
23
- def setup
24
- @test_config = { :developer_mode => true, :disable_harvest_thread => true }
25
- NewRelic::Agent.config.add_config_for_testing(@test_config)
26
- run_sample_trace('/here')
27
- run_sample_trace('/there')
28
- run_sample_trace('/somewhere')
29
- @sampler = NewRelic::Agent.instance.transaction_sampler
30
- end
31
-
32
- def teardown
33
- NewRelic::Agent.config.remove_config(@test_config)
34
- end
35
-
36
- def test_index_displays_all_samples
37
- get '/newrelic'
38
-
39
- assert last_response.ok?
40
- assert last_response.body.include?('/here')
41
- assert last_response.body.include?('/there')
42
- assert last_response.body.include?('/somewhere')
43
- end
44
-
45
- def test_show_sample_summary_displays_sample_details
46
- get "/newrelic/show_sample_summary?id=#{@sampler.dev_mode_sample_buffer.samples[0].sample_id}"
47
-
48
- assert last_response.ok?
49
- assert last_response.body.include?('/here')
50
- assert last_response.body.include?('SandwichesController')
51
- assert last_response.body.include?('index')
52
- end
53
-
54
- def test_explain_sql_displays_query_plan
55
- sample = @sampler.dev_mode_sample_buffer.samples[0]
56
- sql_segment = app.send(:sql_segments, sample)[0]
57
- explain_results = [["Id", "Select Type", "Table", "Type", "Possible Keys", "Key", "Key Length",
58
- "Ref", "Rows", "Extra"],
59
- [["1", "SIMPLE", "sandwiches", "range", "PRIMARY", "PRIMARY", "4", "", "1",
60
- "Using index"]]]
61
- NewRelic::Agent::Transaction::TraceNode.any_instance.expects(:explain_sql).returns(explain_results)
62
-
63
- get "/newrelic/explain_sql?id=#{sample.sample_id}&segment=#{sql_segment.object_id}"
64
-
65
- assert last_response.ok?
66
- assert last_response.body.include?('PRIMARY')
67
- assert last_response.body.include?('Key Length')
68
- assert last_response.body.include?('Using index')
69
- end
70
-
71
- def test_doesnt_record_transaction
72
- NewRelic::Agent.instance.transaction_sampler.dev_mode_sample_buffer.reset!
73
-
74
- get "/newrelic"
75
-
76
- assert_empty NewRelic::Agent.instance.transaction_sampler.dev_mode_sample_buffer.samples
77
- end
78
-
79
- def test_request_attributes
80
- attributes = NewRelic::Agent::Transaction::Attributes.new(NewRelic::Agent.instance.attribute_filter)
81
- attributes.add_agent_attribute("request.parameters.foo", "bar", NewRelic::Agent::AttributeFilter::DST_ALL)
82
- attributes.add_agent_attribute(:"request.headers.referer", "/somewhere", NewRelic::Agent::AttributeFilter::DST_ALL)
83
- sample = stub(:attributes => attributes)
84
-
85
- expected = {
86
- "request.parameters.foo" => "bar"
87
- }
88
-
89
- result = app.send(:request_attributes_for, sample)
90
- assert_equal expected, result
91
- end
92
- end
93
-
94
- else
95
- puts "Skipping tests in #{__FILE__} because Rails is unavailable"
96
- end
@@ -1,325 +0,0 @@
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 'pathname'
6
- require File.expand_path('../google_pie_chart', __FILE__)
7
- require 'new_relic/collection_helper'
8
- require 'new_relic/metric_parser/metric_parser'
9
- module NewRelic::DeveloperModeHelper
10
- include NewRelic::CollectionHelper
11
-
12
- private
13
-
14
- # limit of how many detail/SQL rows we display - very large data sets (~10000+) crash browsers
15
- def trace_row_display_limit
16
- 2000
17
- end
18
-
19
- def trace_row_display_limit_reached
20
- (defined?(@detail_node_count) && !@detail_node_count.nil? && (@detail_node_count > trace_row_display_limit)) ||
21
- sql_segments(@sample).length > trace_row_display_limit
22
- end
23
-
24
- # return the highest level in the call stack for the trace that is not rails or
25
- # newrelic agent code
26
- def application_caller(trace)
27
- trace = strip_nr_from_backtrace(trace) unless params[:show_nr]
28
- trace.each do |trace_line|
29
- file, _line, gem = file_and_line(trace_line)
30
- unless file && exclude_file_from_stack_trace?(file, false, gem)
31
- return trace_line
32
- end
33
- end
34
- trace.last
35
- end
36
-
37
- def application_stack_trace(trace, include_rails = false)
38
- trace = strip_nr_from_backtrace(trace) unless params[:show_nr]
39
- trace.reject do |trace_line|
40
- file, _line, gem = file_and_line(trace_line)
41
- file && exclude_file_from_stack_trace?(file, include_rails, gem)
42
- end
43
- end
44
-
45
- def render_backtrace
46
- if @segment[:backtrace]
47
- content_tag('h3', 'Application Stack Trace') +
48
- render(:partial => 'stack_trace')
49
- end
50
- end
51
-
52
- def h(text)
53
- text
54
- end
55
-
56
- def agent_views_path(path)
57
- path
58
- end
59
-
60
- def dev_name(metric_name)
61
- NewRelic::MetricParser::MetricParser.parse(metric_name).developer_name
62
- end
63
-
64
- # write the metric label for a segment metric in the detail view
65
- def write_segment_label(segment)
66
- link_to_function(dev_name(segment.metric_name), "toggle_row_class($(this).closest('td').find('a')[0])")
67
- end
68
-
69
- # write the metric label for a segment metric in the summary table of metrics
70
- def write_summary_segment_label(segment)
71
- dev_name(segment.metric_name)
72
- end
73
-
74
- def write_stack_trace_line(trace_line)
75
- trace_line
76
- end
77
-
78
- # print the formatted timestamp for a segment
79
- def timestamp(segment)
80
- sprintf("%1.3f", segment.entry_timestamp)
81
- end
82
-
83
- def format_timestamp(time)
84
- time.strftime("%H:%M:%S")
85
- end
86
-
87
- def colorize(value, yellow_threshold = 0.05, red_threshold = 0.15, s=to_ms(value))
88
- if value > yellow_threshold
89
- color = (value > red_threshold ? 'red' : 'orange')
90
- "<font color=#{color}>#{s}</font>"
91
- else
92
- "#{s}"
93
- end
94
- end
95
-
96
- def expanded_image_path()
97
- '/newrelic/file/images/arrow-open.png'
98
- end
99
-
100
- def collapsed_image_path()
101
- '/newrelic/file/images/arrow-close.png'
102
- end
103
-
104
- def explain_sql_url(segment)
105
- "explain_sql?id=#{@sample.sample_id}&amp;segment=#{segment.object_id}"
106
- end
107
-
108
- def segment_duration_value(segment)
109
- link_to colorize(segment.duration, 0.05, 0.15, "#{with_delimiter(to_ms(segment.duration))} ms"), explain_sql_url(segment)
110
- end
111
-
112
- def line_wrap_sql(sql)
113
- sql.gsub(/\,/,', ').squeeze(' ') if sql
114
- end
115
-
116
- def render_sample_details(sample)
117
- @indentation_depth=0
118
- # skip past the root segments to the first child, which is always the controller
119
- first_segment = sample.root_node.called_nodes.first
120
-
121
- # render the segments, then the css classes to indent them
122
- render_segment_details(first_segment).to_s + render_indentation_classes(@indentation_depth).to_s
123
- end
124
-
125
- # the rows logger plugin disables the sql tracing functionality of the NewRelic agent -
126
- # notify the user about this
127
- def rows_logger_present?
128
- File.exist?(File.join(File.dirname(__FILE__), "../../../rows_logger/init.rb"))
129
- end
130
-
131
- def expand_segment_image(segment, depth)
132
- if depth > 0
133
- if !segment.called_nodes.empty?
134
- row_class =segment_child_row_class(segment)
135
- link_to_function("<img src=\"#{collapsed_image_path}\" id=\"image_#{row_class}\" class_for_children=\"#{row_class}\" class=\"#{(!segment.called_nodes.empty?) ? 'parent_segment_image' : 'child_segment_image'}\" />", "toggle_row_class(this)")
136
- end
137
- end
138
- end
139
-
140
- def segment_child_row_class(segment)
141
- "segment#{segment.object_id}"
142
- end
143
-
144
- def summary_pie_chart(sample, width, height)
145
- pie_chart = GooglePieChart.new
146
- pie_chart.color, pie_chart.width, pie_chart.height = '6688AA', width, height
147
-
148
- chart_data = breakdown_data(sample, 6)
149
- chart_data.each { |s| pie_chart.add_data_point dev_name(s.metric_name), to_ms(s.exclusive_time) }
150
-
151
- pie_chart.render
152
- end
153
-
154
- def segment_row_classes(segment, depth)
155
- classes = []
156
-
157
- classes << "segment#{segment.parent_node.object_id}" if depth > 1
158
- classes << "view_segment" if segment.metric_name.index('View') == 0
159
-
160
- classes.join(' ')
161
- end
162
-
163
- # render_segment_details should be called before calling this method
164
- def render_indentation_classes(depth)
165
- styles = []
166
- (1..depth).each do |d|
167
- styles << ".segment_indent_level#{d} { display: inline-block; margin-left: #{(d-1)*20}px }"
168
- end
169
- content_tag("style", styles.join(' '))
170
- end
171
-
172
- def sql_link_mouseover_options(segment)
173
- { :onmouseover => "sql_mouse_over(#{segment.object_id})", :onmouseout => "sql_mouse_out(#{segment.object_id})"}
174
- end
175
-
176
- def explain_sql_link(segment, child_sql = false)
177
- link_to 'SQL', explain_sql_url(segment)+ '"' + sql_link_mouseover_options(segment).map {|k,v| "#{k}=\"#{v}\""}.join(' ')+ 'fake=\"'
178
- end
179
-
180
- def explain_sql_links(segment)
181
- if segment[:sql]
182
- explain_sql_link segment
183
- else
184
- links = []
185
- segment.called_nodes.each do |child|
186
- if child[:sql]
187
- links << explain_sql_link(child, true)
188
- end
189
- end
190
- links[0..1].join(', ') + (links.length > 2?', ...':'')
191
- end
192
- end
193
-
194
- private
195
- # return three objects, the file path, the line in the file, and the gem the file belongs to
196
- # if found
197
- def file_and_line(stack_trace_line)
198
- if stack_trace_line =~ /^(?:(\w+) \([\d.]*\) )?(.*):(\d+)/
199
- return $2, $3, $1
200
- else
201
- return nil
202
- end
203
- end
204
-
205
- def render_segment_details(segment, depth=0)
206
- @detail_node_count ||= 0
207
- @detail_node_count += 1
208
-
209
- return '' if @detail_node_count > trace_row_display_limit
210
-
211
- @indentation_depth = depth if depth > @indentation_depth
212
- repeat = nil
213
- html = render(:partial => 'segment', :object => [segment, depth, repeat])
214
- depth += 1
215
-
216
- segment.called_nodes.each do |child|
217
- html << render_segment_details(child, depth)
218
- end
219
-
220
- html
221
- end
222
-
223
- def exclude_file_from_stack_trace?(file, include_rails, gem=nil)
224
- return false if include_rails
225
- return true if file !~ /\.(rb|java)/
226
- return true if %w[rack activerecord activeresource activesupport actionpack railties].include? gem
227
- %w[/actionmailer/
228
- /activerecord
229
- /activeresource
230
- /activesupport
231
- /lib/mongrel
232
- /actionpack
233
- /passenger/
234
- /railties
235
- benchmark.rb].each { |s| return true if file.include? s }
236
- false
237
- end
238
-
239
- def show_view_link(title, page_name)
240
- link_to_function("[#{title}]", "show_view('#{page_name}')");
241
- end
242
-
243
-
244
- def link_to(name, location)
245
- location = "/newrelic/#{location}" unless /:\/\// =~ location
246
- "<a href=\"#{location}\">#{name}</a>"
247
- end
248
-
249
- def link_to_if(predicate, text, location="")
250
- if predicate
251
- link_to(text, location)
252
- else
253
- text
254
- end
255
- end
256
-
257
- def link_to_unless_current(text, hash)
258
- unless params[hash.keys[0].to_s]
259
- link_to(text,"?#{hash.keys[0]}=#{hash.values[0]}")
260
- else
261
- text
262
- end
263
- end
264
-
265
- def cycle(even, odd)
266
- @cycle ||= 'a'
267
- if @cycle == 'a'
268
- @cycle = 'b'
269
- even
270
- else
271
- @cycle = 'a'
272
- odd
273
- end
274
- end
275
-
276
- def link_to_function(title, javascript)
277
- "<a href=\"#\" onclick=\"#{javascript}; return false;\">#{title}</a>"
278
- end
279
-
280
- def mime_type_from_extension(extension)
281
- extension = extension[/[^.]*$/].dncase
282
- case extension
283
- when 'png'; 'image/png'
284
- when 'gif'; 'image/gif'
285
- when 'jpg'; 'image/jpg'
286
- when 'css'; 'text/css'
287
- when 'js'; 'text/javascript'
288
- else 'text/plain'
289
- end
290
- end
291
- def to_ms(number)
292
- (number*1000).round
293
- end
294
- def to_percentage(value)
295
- (value * 100).round if value
296
- end
297
- def with_delimiter(val)
298
- return '0' if val.nil?
299
- parts = val.to_s.split('.')
300
- parts[0].gsub!(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1,")
301
- parts.join '.'
302
- end
303
-
304
- SORT_REPLACEMENTS = {
305
- "Total" => :total_time,
306
- "Self" => :self_time,
307
- "Child" => :children_time,
308
- "Wait" => :wait_time
309
- }
310
-
311
- def profile_table(sample, options)
312
- out = StringIO.new
313
- printer = RubyProf::GraphHtmlPrinter.new(sample.profile)
314
- printer.print(out, options)
315
- out = out.string[/<body>(.*)<\/body>/im, 0].gsub('<table>', '<table class=profile>')
316
- SORT_REPLACEMENTS.each do |text, param|
317
- replacement = (options[:sort_method] == param) ?
318
- "<th> #{text}&nbsp;&darr;</th>" :
319
- "<th>#{link_to text, "show_sample_summary?id=#{sample.sample_id}&sort=#{param}"}</th>"
320
-
321
- out.gsub!(/<th> +#{text}<\/th>/, replacement)
322
- end
323
- out
324
- end
325
- end