ghazel-newrelic_rpm 3.1.0.1 → 3.4.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. data/CHANGELOG +120 -35
  2. data/LICENSE +29 -2
  3. data/README.rdoc +2 -2
  4. data/bin/mongrel_rpm +0 -0
  5. data/bin/newrelic +0 -0
  6. data/bin/newrelic_cmd +0 -0
  7. data/lib/new_relic/agent.rb +50 -38
  8. data/lib/new_relic/agent/agent.rb +459 -337
  9. data/lib/new_relic/agent/beacon_configuration.rb +71 -11
  10. data/lib/new_relic/agent/browser_monitoring.rb +73 -14
  11. data/lib/new_relic/agent/busy_calculator.rb +11 -3
  12. data/lib/new_relic/agent/chained_call.rb +2 -2
  13. data/lib/new_relic/agent/database.rb +223 -0
  14. data/lib/new_relic/agent/error_collector.rb +231 -183
  15. data/lib/new_relic/agent/instrumentation.rb +2 -2
  16. data/lib/new_relic/agent/instrumentation/active_merchant.rb +10 -2
  17. data/lib/new_relic/agent/instrumentation/active_record.rb +138 -0
  18. data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +7 -1
  19. data/lib/new_relic/agent/instrumentation/authlogic.rb +6 -0
  20. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +46 -14
  21. data/lib/new_relic/agent/instrumentation/data_mapper.rb +8 -2
  22. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +11 -3
  23. data/lib/new_relic/agent/instrumentation/memcache.rb +49 -25
  24. data/lib/new_relic/agent/instrumentation/merb/controller.rb +7 -2
  25. data/lib/new_relic/agent/instrumentation/merb/errors.rb +7 -1
  26. data/lib/new_relic/agent/instrumentation/metric_frame.rb +31 -4
  27. data/lib/new_relic/agent/instrumentation/metric_frame/pop.rb +1 -5
  28. data/lib/new_relic/agent/instrumentation/net.rb +8 -2
  29. data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +5 -2
  30. data/lib/new_relic/agent/instrumentation/queue_time.rb +1 -1
  31. data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +66 -35
  32. data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +7 -1
  33. data/lib/new_relic/agent/instrumentation/rails/errors.rb +7 -1
  34. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +121 -1
  35. data/lib/new_relic/agent/instrumentation/rails3/errors.rb +7 -1
  36. data/lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb +21 -0
  37. data/lib/new_relic/agent/instrumentation/resque.rb +80 -0
  38. data/lib/new_relic/agent/instrumentation/sinatra.rb +46 -20
  39. data/lib/new_relic/agent/instrumentation/sunspot.rb +6 -0
  40. data/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb +7 -2
  41. data/lib/new_relic/agent/method_tracer.rb +205 -99
  42. data/lib/new_relic/agent/new_relic_service.rb +221 -0
  43. data/lib/new_relic/agent/pipe_channel_manager.rb +161 -0
  44. data/lib/new_relic/agent/pipe_service.rb +54 -0
  45. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +89 -0
  46. data/lib/new_relic/agent/samplers/memory_sampler.rb +6 -7
  47. data/lib/new_relic/agent/shim_agent.rb +5 -5
  48. data/lib/new_relic/agent/sql_sampler.rb +282 -0
  49. data/lib/new_relic/agent/stats_engine.rb +2 -0
  50. data/lib/new_relic/agent/stats_engine/gc_profiler.rb +123 -0
  51. data/lib/new_relic/agent/stats_engine/metric_stats.rb +35 -30
  52. data/lib/new_relic/agent/stats_engine/samplers.rb +10 -4
  53. data/lib/new_relic/agent/stats_engine/transactions.rb +28 -87
  54. data/lib/new_relic/agent/transaction_info.rb +74 -0
  55. data/lib/new_relic/agent/transaction_sample_builder.rb +18 -3
  56. data/lib/new_relic/agent/transaction_sampler.rb +108 -20
  57. data/lib/new_relic/agent/worker_loop.rb +14 -6
  58. data/lib/new_relic/collection_helper.rb +19 -11
  59. data/lib/new_relic/command.rb +1 -1
  60. data/lib/new_relic/commands/deployments.rb +2 -2
  61. data/lib/new_relic/commands/install.rb +2 -13
  62. data/lib/new_relic/control.rb +2 -3
  63. data/lib/new_relic/control/class_methods.rb +12 -6
  64. data/lib/new_relic/control/configuration.rb +57 -8
  65. data/lib/new_relic/control/frameworks.rb +10 -0
  66. data/lib/new_relic/control/frameworks/external.rb +4 -4
  67. data/lib/new_relic/control/frameworks/merb.rb +2 -1
  68. data/lib/new_relic/control/frameworks/rails.rb +35 -22
  69. data/lib/new_relic/control/frameworks/rails3.rb +12 -7
  70. data/lib/new_relic/control/frameworks/ruby.rb +5 -5
  71. data/lib/new_relic/control/frameworks/sinatra.rb +1 -4
  72. data/lib/new_relic/control/instance_methods.rb +38 -12
  73. data/lib/new_relic/control/instrumentation.rb +23 -4
  74. data/lib/new_relic/control/logging_methods.rb +70 -15
  75. data/lib/new_relic/control/server_methods.rb +22 -9
  76. data/lib/new_relic/delayed_job_injection.rb +16 -3
  77. data/lib/new_relic/helper.rb +21 -0
  78. data/lib/new_relic/language_support.rb +95 -0
  79. data/lib/new_relic/local_environment.rb +92 -48
  80. data/lib/new_relic/metric_data.rb +7 -2
  81. data/lib/new_relic/metric_spec.rb +12 -9
  82. data/lib/new_relic/noticed_error.rb +6 -1
  83. data/lib/new_relic/rack/browser_monitoring.rb +18 -19
  84. data/lib/new_relic/rack/developer_mode.rb +3 -2
  85. data/lib/new_relic/recipes.rb +8 -4
  86. data/lib/new_relic/stats.rb +17 -60
  87. data/lib/new_relic/transaction_analysis.rb +2 -1
  88. data/lib/new_relic/transaction_analysis/segment_summary.rb +4 -2
  89. data/lib/new_relic/transaction_sample.rb +60 -75
  90. data/lib/new_relic/transaction_sample/segment.rb +31 -79
  91. data/lib/new_relic/version.rb +2 -2
  92. data/lib/newrelic_rpm.rb +1 -1
  93. data/newrelic.yml +2 -2
  94. data/newrelic_rpm.gemspec +46 -54
  95. data/test/active_record_fixtures.rb +3 -3
  96. data/test/config/newrelic.yml +1 -1
  97. data/test/fixtures/proc_cpuinfo.txt +575 -0
  98. data/test/new_relic/agent/agent/connect_test.rb +128 -25
  99. data/test/new_relic/agent/agent/start_test.rb +9 -94
  100. data/test/new_relic/agent/agent/start_worker_thread_test.rb +2 -4
  101. data/test/new_relic/agent/agent_test.rb +51 -78
  102. data/test/new_relic/agent/agent_test_controller.rb +1 -1
  103. data/test/new_relic/agent/agent_test_controller_test.rb +49 -33
  104. data/test/new_relic/agent/beacon_configuration_test.rb +12 -5
  105. data/test/new_relic/agent/browser_monitoring_test.rb +99 -50
  106. data/test/new_relic/agent/database_test.rb +161 -0
  107. data/test/new_relic/agent/error_collector_test.rb +47 -23
  108. data/test/new_relic/agent/instrumentation/active_record_instrumentation_test.rb +96 -42
  109. data/test/new_relic/agent/instrumentation/controller_instrumentation_test.rb +0 -2
  110. data/test/new_relic/agent/instrumentation/instrumentation_test.rb +1 -1
  111. data/test/new_relic/agent/instrumentation/metric_frame/pop_test.rb +3 -11
  112. data/test/new_relic/agent/instrumentation/net_instrumentation_test.rb +9 -9
  113. data/test/new_relic/agent/instrumentation/queue_time_test.rb +6 -11
  114. data/test/new_relic/agent/memcache_instrumentation_test.rb +54 -18
  115. data/test/new_relic/agent/method_tracer/class_methods/add_method_tracer_test.rb +1 -1
  116. data/test/new_relic/agent/method_tracer/instance_methods/trace_execution_scoped_test.rb +1 -1
  117. data/test/new_relic/agent/method_tracer_test.rb +3 -2
  118. data/test/new_relic/agent/new_relic_service_test.rb +151 -0
  119. data/test/new_relic/agent/pipe_channel_manager_test.rb +114 -0
  120. data/test/new_relic/agent/pipe_service_test.rb +113 -0
  121. data/test/new_relic/agent/rpm_agent_test.rb +4 -31
  122. data/test/new_relic/agent/sql_sampler_test.rb +192 -0
  123. data/test/new_relic/agent/stats_engine/metric_stats_test.rb +19 -18
  124. data/test/new_relic/agent/stats_engine_test.rb +41 -6
  125. data/test/new_relic/agent/transaction_info_test.rb +13 -0
  126. data/test/new_relic/agent/transaction_sample_builder_test.rb +27 -4
  127. data/test/new_relic/agent/transaction_sampler_test.rb +68 -46
  128. data/test/new_relic/agent/worker_loop_test.rb +3 -3
  129. data/test/new_relic/agent_test.rb +242 -0
  130. data/test/new_relic/collection_helper_test.rb +50 -28
  131. data/test/new_relic/control/configuration_test.rb +77 -0
  132. data/test/new_relic/control/logging_methods_test.rb +49 -21
  133. data/test/new_relic/control_test.rb +115 -54
  134. data/test/new_relic/delayed_job_injection_test.rb +21 -0
  135. data/test/new_relic/fake_collector.rb +210 -0
  136. data/test/new_relic/fake_service.rb +44 -0
  137. data/test/new_relic/local_environment_test.rb +14 -1
  138. data/test/new_relic/metric_parser/metric_parser_test.rb +11 -0
  139. data/test/new_relic/rack/browser_monitoring_test.rb +84 -23
  140. data/test/new_relic/rack/developer_mode_helper_test.rb +141 -0
  141. data/test/new_relic/rack/developer_mode_test.rb +31 -0
  142. data/test/new_relic/stats_test.rb +3 -18
  143. data/test/new_relic/transaction_analysis/segment_summary_test.rb +14 -0
  144. data/test/new_relic/transaction_analysis_test.rb +3 -3
  145. data/test/new_relic/transaction_sample/segment_test.rb +15 -80
  146. data/test/new_relic/transaction_sample_test.rb +25 -18
  147. data/test/script/build_test_gem.sh +51 -0
  148. data/test/script/ci.sh +140 -0
  149. data/test/script/ci_agent-tests_runner.sh +82 -0
  150. data/test/script/ci_bench.sh +52 -0
  151. data/test/script/ci_multiverse_runner.sh +63 -0
  152. data/test/test_contexts.rb +1 -0
  153. data/test/test_helper.rb +18 -5
  154. data/ui/helpers/developer_mode_helper.rb +14 -8
  155. data/ui/helpers/google_pie_chart.rb +0 -1
  156. data/ui/views/newrelic/index.rhtml +2 -2
  157. data/vendor/gems/dependency_detection-0.0.1.build/LICENSE +4 -18
  158. data/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb +10 -0
  159. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/mem_cache.rb +11 -11
  160. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/metric_parser.rb +17 -4
  161. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb +4 -0
  162. metadata +50 -36
  163. data/lib/new_relic/agent/instrumentation/rails/active_record_instrumentation.rb +0 -108
  164. data/lib/new_relic/agent/instrumentation/rails3/active_record_instrumentation.rb +0 -112
  165. data/lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb +0 -40
  166. data/lib/new_relic/data_serialization.rb +0 -84
  167. data/lib/new_relic/histogram.rb +0 -91
  168. data/lib/new_relic/rack/metric_app.rb +0 -65
  169. data/lib/new_relic/rack/mongrel_rpm.ru +0 -28
  170. data/lib/new_relic/rack/newrelic.yml +0 -27
  171. data/lib/new_relic/rack_app.rb +0 -6
  172. data/test/new_relic/data_serialization_test.rb +0 -70
  173. data/vendor/gems/dependency_detection-0.0.1.build/README +0 -0
  174. data/vendor/gems/metric_parser-0.1.0.pre1/LICENSE +0 -0
  175. data/vendor/gems/metric_parser-0.1.0.pre1/README +0 -0
@@ -0,0 +1,82 @@
1
+ #!/bin/bash -e
2
+
3
+ SCRATH_DIR=./agent-tests_tmp
4
+ #git pull git@github.com:newrelic/ruby_agent-tests.git
5
+
6
+ #echo $PWD
7
+ script_dirname=`dirname $0`
8
+ #echo $script_dirname
9
+ #echo $0
10
+
11
+ # make sure that we're in the project root
12
+ script_dirname=`dirname $0`
13
+ cd "$script_dirname/../../"
14
+
15
+
16
+
17
+ if [ -x $SCRATH_DIR ] ; then
18
+ echo "found tmp, deleting"
19
+ rm -fr $SCRATH_DIR
20
+ fi
21
+
22
+ mkdir $SCRATH_DIR
23
+ cd $SCRATH_DIR
24
+
25
+ git clone --depth=1 git@github.com:newrelic/ruby_agent-tests.git ruby_agent-tests
26
+ git clone --depth=1 git@github.com:newrelic/rpm_contrib.git rpm_contrib
27
+
28
+ if [ -x ../../Ruby_Agent ] ; then
29
+ ln -s ../../Ruby_Agent ./ruby_agent
30
+ else
31
+ echo "*********** Ruby_Agent can't be found ***********"
32
+ exit 1
33
+ fi
34
+
35
+ #exit 0
36
+
37
+ cd ruby_agent-tests
38
+ ./ci_run.sh
39
+
40
+ #echo "creating tmp dir"
41
+ #mkdir tmp
42
+ #echo "cd'ing to tmp"
43
+ # cd tmp
44
+ # echo $PWD
45
+
46
+
47
+ # exit 0
48
+ #env
49
+ #ls -al /home/hudson/.rvm/bin
50
+ # source ~/.rvm/scripts/rvm
51
+ #rvm 1.9.2
52
+ #ruby -v
53
+
54
+ # rvm --force gemset delete ruby_agent-tests
55
+
56
+ # rvm gemset create ruby_agent-tests
57
+
58
+ # rvm gemset use ruby_agent-tests
59
+ # gem install bundler
60
+ # bundle update
61
+ # bundle
62
+
63
+ ##
64
+ # bundle exec ruby fake_collector.rb
65
+ # bundle exec ruby sinatra_metric_explosion_test.rb
66
+
67
+ ########
68
+ # clear out gemset for next test set
69
+ #
70
+
71
+ # cd rails3viewfedex
72
+ # rvm --force gemset delete ruby_agent-tests
73
+
74
+ # rvm gemset create ruby_agent-tests
75
+
76
+ # rvm gemset use ruby_agent-tests
77
+
78
+ # gem install bundler
79
+ # bundle update
80
+ # bundle
81
+ # bundle exec ruby view_instrumentation_test.rb
82
+ #exit 0
@@ -0,0 +1,52 @@
1
+ #!/bin/bash
2
+
3
+ # Script to benchmark the ruby agent under various versions of ruby in ci.
4
+
5
+ echo "Executing $0"
6
+ echo "Running in $(pwd)"
7
+
8
+ # print commands in this script as they're invoked
9
+ # set -x
10
+ # fail if any command fails
11
+ set -e
12
+
13
+ # check for require environment variables
14
+ if [ "x$RUBY" == "x" ]; then
15
+ echo '$RUBY is undefined'
16
+ exit 1
17
+ fi
18
+
19
+
20
+ . "$HOME/.rvm/scripts/rvm"
21
+ rvm use $RUBY || rvm install $RUBY
22
+ echo `which ruby`
23
+
24
+ # make sure that we're in the project root
25
+ script_dirname=`dirname $0`
26
+ cd "$script_dirname/../../"
27
+ pwd
28
+
29
+ rm -rf tmp
30
+ mkdir -p tmp
31
+ cd tmp
32
+ git clone --depth=1 git@github.com:newrelic/agent_prof.git agent_prof
33
+ cd agent_prof
34
+
35
+ perl -p -i'.bak' -e 's#gem +.newrelic_rpm.*$#gem "newrelic_rpm", :path => "\.\.\/\.\.\/"#' Gemfile
36
+
37
+ rvm --force gemset delete ruby_bench_$RUBY
38
+ rvm gemset create ruby_bench_$RUBY
39
+ rvm gemset use ruby_bench_$RUBY
40
+
41
+ if [ "x$RUBY" == "x1.8.6" ]; then
42
+ # Bundler 1.1 dropped support for ruby 1.8.6
43
+ gem install bundler -v'~>1.0.0' --no-rdoc --no-ri
44
+ else
45
+ gem install bundler --no-rdoc --no-ri
46
+ fi
47
+
48
+ bundle
49
+ script/run
50
+ bundle exec script/post_log_to_dashboard
51
+
52
+
@@ -0,0 +1,63 @@
1
+ #!/bin/bash -e
2
+
3
+ export PATH=$PATH:$HOME/bin
4
+
5
+ echo $HOME
6
+ echo $PATH
7
+ #ls $HOME/bin
8
+
9
+
10
+
11
+ if [ "x$RUBY" == "x" ] ; then
12
+ export RUBY=1.9.3
13
+ fi
14
+
15
+ echo "Tests will be run using $RUBY"
16
+ #uname -a
17
+
18
+ SCRATH_DIR=./multiverse_tmp
19
+ script_dirname=`dirname $0`
20
+
21
+ # make sure that we're in the project root
22
+ cd "$script_dirname/../../"
23
+
24
+ #pwd
25
+
26
+ if [ -x $SCRATH_DIR ] ; then
27
+ echo "found tmp, deleting"
28
+ rm -fr $SCRATH_DIR
29
+ fi
30
+
31
+ mkdir $SCRATH_DIR
32
+ cd $SCRATH_DIR
33
+
34
+ #pwd
35
+ if [[ $JOB_NAME =~ "Pangalactic" ]] ; then
36
+ AGENT_LOCATION="../../../../../../Ruby_Agent"
37
+ else
38
+ AGENT_LOCATION="../../Ruby_Agent"
39
+ fi
40
+
41
+ git clone --depth=1 git@github.com:newrelic/multiverse.git multiverse
42
+ git clone --depth=1 git@github.com:newrelic/rpm_contrib.git rpm_contrib
43
+
44
+ echo "Looking for Ruby Agent at $AGENT_LOCATION"
45
+ #ls -l ../../../../../../
46
+ #ls -l /home/hudson/workspace/
47
+
48
+ if [ -x $AGENT_LOCATION ] ; then
49
+ ln -s $AGENT_LOCATION ./ruby_agent
50
+ else
51
+ echo "*********** Ruby_Agent not found ***********"
52
+ exit 1
53
+ fi
54
+
55
+ cd multiverse
56
+ #./ci_run.sh
57
+
58
+ #pwd
59
+ #ls -l ../
60
+
61
+ source ~/.rvm/scripts/rvm
62
+ rvm use $RUBY
63
+ script/runner
@@ -7,6 +7,7 @@ module TestContexts
7
7
  setup do
8
8
  @log_data = StringIO.new
9
9
  @log = Logger.new(@log_data)
10
+ NewRelic::Agent::Agent.instance.service = NewRelic::FakeService.new
10
11
  NewRelic::Agent.manual_start :log => @log
11
12
  @agent = NewRelic::Agent.instance
12
13
  @agent.transaction_sampler.send :clear_builder
data/test/test_helper.rb CHANGED
@@ -14,6 +14,7 @@ require 'rubygems'
14
14
 
15
15
  begin
16
16
  require 'config/environment'
17
+ # require File.join(File.dirname(__FILE__),'..','..','rpm_test_app','config','environment')
17
18
  begin
18
19
  require 'test_help'
19
20
  rescue LoadError
@@ -21,8 +22,18 @@ begin
21
22
  end
22
23
 
23
24
  rescue LoadError
24
- puts "Unable to load Rails for New Relic tests"
25
- raise
25
+ # To run the tests against a standalone agent build, you need to
26
+ # add a rails app to the load path. It can be 2.* to 3.*. It should
27
+ # referenc newrelic_rpm in the Gemfile with a :path option pointing
28
+ # to this work directory.
29
+ guess = File.expand_path("../../../rpm", __FILE__)
30
+ if $LOAD_PATH.include? guess
31
+ puts "Unable to load Rails for New Relic tests. See note in test_helper.rb"
32
+ raise
33
+ else
34
+ $LOAD_PATH << guess
35
+ retry
36
+ end
26
37
  end
27
38
  require 'newrelic_rpm'
28
39
 
@@ -33,10 +44,12 @@ require 'mocha'
33
44
  require 'mocha/integration/test_unit'
34
45
  require 'mocha/integration/test_unit/assertion_counter'
35
46
 
47
+ require 'new_relic/fake_service'
48
+
36
49
  class Test::Unit::TestCase
37
50
  include Mocha::API
38
51
 
39
- # FIXME delete this trick when we stop supporting rails2.0.x
52
+ # we can delete this trick when we stop supporting rails2.0.x
40
53
  if ENV['BRANCH'] != 'rails20'
41
54
  # a hack because rails2.0.2 does not like double teardowns
42
55
  def teardown
@@ -101,7 +114,7 @@ end
101
114
 
102
115
 
103
116
  def compare_metrics(expected, actual)
104
- actual.delete('GC/cumulative') # in case we are in REE
117
+ actual.delete_if {|a| a.include?('GC/cumulative') } # in case we are in REE
105
118
  assert_equal(expected.to_a.sort, actual.to_a.sort, "extra: #{(actual - expected).to_a.inspect}; missing: #{(expected - actual).to_a.inspect}")
106
119
  end
107
120
 
@@ -140,5 +153,5 @@ module TransactionSampleTestHelper
140
153
  sampler.notice_scope_empty
141
154
  sampler.samples[0]
142
155
  end
143
-
156
+ module_function :run_sample_trace_on
144
157
  end
@@ -27,8 +27,8 @@ module NewRelic::DeveloperModeHelper
27
27
  def application_caller(trace)
28
28
  trace = strip_nr_from_backtrace(trace) unless params[:show_nr]
29
29
  trace.each do |trace_line|
30
- file = file_and_line(trace_line).first
31
- unless exclude_file_from_stack_trace?(file, false)
30
+ file, line, gem = file_and_line(trace_line)
31
+ unless file && exclude_file_from_stack_trace?(file, false, gem)
32
32
  return trace_line
33
33
  end
34
34
  end
@@ -38,8 +38,8 @@ module NewRelic::DeveloperModeHelper
38
38
  def application_stack_trace(trace, include_rails = false)
39
39
  trace = strip_nr_from_backtrace(trace) unless params[:show_nr]
40
40
  trace.reject do |trace_line|
41
- file = file_and_line(trace_line).first
42
- exclude_file_from_stack_trace?(file, include_rails)
41
+ file, line, gem = file_and_line(trace_line)
42
+ file && exclude_file_from_stack_trace?(file, include_rails, gem)
43
43
  end
44
44
  end
45
45
 
@@ -60,7 +60,7 @@ module NewRelic::DeveloperModeHelper
60
60
 
61
61
  def url_for_source(trace_line)
62
62
  file, line = file_and_line(trace_line)
63
-
63
+ return "#" if file.nil?
64
64
  begin
65
65
  file = Pathname.new(file).realpath
66
66
  rescue Errno::ENOENT
@@ -70,7 +70,6 @@ module NewRelic::DeveloperModeHelper
70
70
  rescue
71
71
  # catch all other exceptions. We're going to create an invalid link below, but that's okay.
72
72
  end
73
-
74
73
  if using_textmate?
75
74
  "txmt://open?url=file://#{file}&line=#{line}"
76
75
  else
@@ -230,8 +229,14 @@ module NewRelic::DeveloperModeHelper
230
229
  end
231
230
 
232
231
  private
232
+ # return three objects, the file path, the line in the file, and the gem the file belongs to
233
+ # if found
233
234
  def file_and_line(stack_trace_line)
234
- stack_trace_line.match(/(.*):(\d+)/)[1..2]
235
+ if stack_trace_line =~ /^(?:(\w+) \([\d.]*\) )?(.*):(\d+)/
236
+ return $2, $3, $1
237
+ else
238
+ return nil
239
+ end
235
240
  end
236
241
 
237
242
  def using_textmate?
@@ -262,9 +267,10 @@ module NewRelic::DeveloperModeHelper
262
267
  html
263
268
  end
264
269
 
265
- def exclude_file_from_stack_trace?(file, include_rails)
270
+ def exclude_file_from_stack_trace?(file, include_rails, gem=nil)
266
271
  return false if include_rails
267
272
  return true if file !~ /\.(rb|java)/
273
+ return true if %w[rack activerecord activeresource activesupport actionpack railties].include? gem
268
274
  %w[/actionmailer/
269
275
  /activerecord
270
276
  /activeresource
@@ -1,6 +1,5 @@
1
1
 
2
2
  # A wrapper around the google charts service.
3
- # TODO consider making generic and open sourcing
4
3
  class GooglePieChart
5
4
  attr_accessor :width, :height, :color
6
5
 
@@ -21,10 +21,10 @@
21
21
  </table>
22
22
  </td>
23
23
  <td valign=top>
24
- <% if defined?(Unicorn) || defined?(Passenger) %>
24
+ <% if defined?(Unicorn) || defined?(Passenger) || defined?(Rainbows) %>
25
25
  <div class="flash">
26
26
  <p id="errorExplanation">
27
- We've noticed you're running a forking web server, like Unicorn or Passenger. See Below</p><p> Developer mode may be unpredictable,
27
+ We've noticed you're running a forking web server, like Unicorn or Passenger or Rainbows. See Below</p><p> Developer mode may be unpredictable,
28
28
  since those servers run many processes and developer mode is entirely in the process.</p><p> We suggest you try Thin,
29
29
  Mongrel, or another single-process web server for development mode.</p><p>
30
30
  (You can ignore this message if you're sure that you're running only one process, and it's not being reaped when inactive.)
@@ -1,19 +1,5 @@
1
- Copyright (c) 2010-2011 Justin George
1
+ Copyright (c) 2010-2011 New Relic, Inc. All rights reserved.
2
2
 
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in
11
- all copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- THE SOFTWARE.
3
+ This code is, and has always been, copyright New Relic and licensed
4
+ under our license terms that can be found in master license file
5
+ located here: ../../../../LICENSE
@@ -17,8 +17,18 @@ module DependencyDetection
17
17
  end
18
18
  end
19
19
 
20
+ def dependency_by_name(name)
21
+ @@items.find {|i| i.name == name }
22
+ end
23
+
24
+ def installed?(name)
25
+ item = dependency_by_name(name)
26
+ item && item.executed
27
+ end
28
+
20
29
  class Dependent
21
30
  attr_reader :executed
31
+ attr_reader :name
22
32
  def executed!
23
33
  @executed = true
24
34
  end
@@ -4,13 +4,13 @@ module NewRelic
4
4
  class MemCache < NewRelic::MetricParser::MetricParser
5
5
  def is_memcache?; true; end
6
6
 
7
- # for MemCache metrics, the short name is actually
7
+ # for Memcache metrics, the short name is actually
8
8
  # the full name
9
9
  def short_name
10
- name
10
+ 'Memcache'
11
11
  end
12
12
  def developer_name
13
- "MemCache #{segments[1..-1].join '/'}"
13
+ "Memcache #{segments[1..-1].join '/'}"
14
14
  end
15
15
 
16
16
  def all?
@@ -22,19 +22,19 @@ module NewRelic
22
22
  def legend_name
23
23
  case segments[1]
24
24
  when 'allWeb'
25
- "MemCache"
25
+ "Memcache"
26
26
  when 'allOther'
27
- "Non-web MemCache"
27
+ "Non-web Memcache"
28
28
  else
29
- "MemCache #{operation} operations"
29
+ "Memcache #{operation} operations"
30
30
  end
31
31
  end
32
32
  def tooltip_name
33
33
  case segments[1]
34
34
  when 'allWeb'
35
- "MemCache calls from web transactions"
35
+ "Memcache calls from web transactions"
36
36
  when 'allOther'
37
- "MemCache calls from non-web transactions"
37
+ "Memcache calls from non-web transactions"
38
38
  else
39
39
  "MemCache #{operation} operations"
40
40
  end
@@ -43,11 +43,11 @@ module NewRelic
43
43
  def developer_name
44
44
  case segments[1]
45
45
  when 'allWeb'
46
- "Web MemCache"
46
+ "Web Memcache"
47
47
  when 'allOther'
48
- "Non-web MemCache"
48
+ "Non-web Memcache"
49
49
  else
50
- "MemCache #{operation}"
50
+ "Memcache #{operation}"
51
51
  end
52
52
  end
53
53
  end