newrelic_rpm 2.13.2 → 2.13.3.beta

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 (92) hide show
  1. data/CHANGELOG +18 -0
  2. data/LICENSE +1 -1
  3. data/README.rdoc +10 -5
  4. data/lib/conditional_vendored_metric_parser.rb +5 -0
  5. data/lib/new_relic/agent.rb +0 -1
  6. data/lib/new_relic/agent/agent.rb +1 -1
  7. data/lib/new_relic/agent/error_collector.rb +2 -0
  8. data/lib/new_relic/agent/instrumentation/data_mapper.rb +170 -47
  9. data/lib/new_relic/agent/instrumentation/memcache.rb +3 -1
  10. data/lib/new_relic/agent/instrumentation/metric_frame.rb +1 -1
  11. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +6 -0
  12. data/lib/new_relic/agent/instrumentation/sinatra.rb +4 -3
  13. data/lib/new_relic/agent/stats_engine/metric_stats.rb +134 -98
  14. data/lib/new_relic/commands/install.rb +10 -0
  15. data/lib/new_relic/control.rb +13 -0
  16. data/lib/new_relic/control/configuration.rb +1 -1
  17. data/lib/new_relic/control/frameworks/rails.rb +9 -5
  18. data/lib/new_relic/control/frameworks/rails3.rb +3 -7
  19. data/lib/new_relic/control/instrumentation.rb +2 -2
  20. data/lib/new_relic/delayed_job_injection.rb +1 -1
  21. data/lib/new_relic/rack/developer_mode.rb +1 -1
  22. data/lib/new_relic/recipes.rb +1 -1
  23. data/lib/new_relic/transaction_analysis.rb +1 -1
  24. data/lib/new_relic/transaction_sample.rb +3 -1
  25. data/lib/new_relic/version.rb +2 -2
  26. data/newrelic_rpm.gemspec +50 -19
  27. data/test/new_relic/agent/memcache_instrumentation_test.rb +29 -25
  28. data/ui/helpers/developer_mode_helper.rb +1 -11
  29. data/ui/views/newrelic/_segment.rhtml +0 -1
  30. data/ui/views/newrelic/_segment_row.rhtml +1 -3
  31. data/ui/views/newrelic/index.rhtml +12 -0
  32. data/ui/views/newrelic/threads.rhtml +8 -7
  33. data/vendor/gems/metric_parser-0.1.0.pre1/LICENSE +0 -0
  34. data/vendor/gems/metric_parser-0.1.0.pre1/README +0 -0
  35. data/vendor/gems/metric_parser-0.1.0.pre1/lib/metric_parser.rb +1 -0
  36. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser.rb +64 -0
  37. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/action_mailer.rb +14 -0
  38. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/active_merchant.rb +31 -0
  39. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/active_record.rb +33 -0
  40. data/{lib → vendor/gems/metric_parser-0.1.0.pre1/lib}/new_relic/metric_parser/apdex.rb +12 -11
  41. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/background_transaction.rb +7 -0
  42. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/client.rb +46 -0
  43. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb +67 -0
  44. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller_cpu.rb +43 -0
  45. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller_ext.rb +17 -0
  46. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/database.rb +48 -0
  47. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/database_pool.rb +24 -0
  48. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/dot_net.rb +28 -0
  49. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/dot_net_parser.rb +17 -0
  50. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/errors.rb +11 -0
  51. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/external.rb +55 -0
  52. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/frontend.rb +40 -0
  53. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/gc.rb +20 -0
  54. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/hibernate_session.rb +7 -0
  55. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/java.rb +31 -0
  56. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/java_parser.rb +17 -0
  57. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/jsp.rb +34 -0
  58. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/jsp_tag.rb +7 -0
  59. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/mem_cache.rb +55 -0
  60. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/metric_parser.rb +122 -0
  61. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/orm.rb +27 -0
  62. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/other_transaction.rb +40 -0
  63. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet.rb +7 -0
  64. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet_context_listener.rb +7 -0
  65. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet_filter.rb +7 -0
  66. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/solr.rb +27 -0
  67. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/solr_request_handler.rb +15 -0
  68. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/spring.rb +54 -0
  69. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/spring_controller.rb +6 -0
  70. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/spring_view.rb +6 -0
  71. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/struts_action.rb +20 -0
  72. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/struts_result.rb +20 -0
  73. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/version.rb +5 -0
  74. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb +66 -0
  75. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_frontend.rb +18 -0
  76. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_service.rb +14 -0
  77. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_transaction.rb +133 -0
  78. metadata +88 -39
  79. data/lib/new_relic/metric_parser.rb +0 -136
  80. data/lib/new_relic/metric_parser/action_mailer.rb +0 -9
  81. data/lib/new_relic/metric_parser/active_merchant.rb +0 -26
  82. data/lib/new_relic/metric_parser/active_record.rb +0 -28
  83. data/lib/new_relic/metric_parser/controller.rb +0 -62
  84. data/lib/new_relic/metric_parser/controller_cpu.rb +0 -38
  85. data/lib/new_relic/metric_parser/errors.rb +0 -6
  86. data/lib/new_relic/metric_parser/external.rb +0 -50
  87. data/lib/new_relic/metric_parser/mem_cache.rb +0 -50
  88. data/lib/new_relic/metric_parser/other_transaction.rb +0 -36
  89. data/lib/new_relic/metric_parser/view.rb +0 -61
  90. data/lib/new_relic/metric_parser/web_frontend.rb +0 -14
  91. data/lib/new_relic/metric_parser/web_service.rb +0 -9
  92. data/test/new_relic/metric_parser_test.rb +0 -226
@@ -0,0 +1 @@
1
+ require 'new_relic/metric_parser'
@@ -0,0 +1,64 @@
1
+ module NewRelic
2
+ # Metric parsing logic mixin. Given a metric name (attribute called "name"), provide a set of accessors
3
+ # that enable inspection of the metric. A metric has 2 or more segments, each separated
4
+ # by the '/' character. The metric's category is specified by its first segment. Following
5
+ # are the set of categories currently supported by NewRelic's default metric set:
6
+ #
7
+ # * Controller
8
+ # * ActiveRecord
9
+ # * Rails
10
+ # * WebService
11
+ # * View
12
+ # * Database
13
+ # * Custom
14
+ #
15
+ # Based on the category of the metric, specific parsing logic is defined in the source files
16
+ # countained in the "metric_parsers" sub directory local to this file.
17
+ #
18
+ module MetricParser
19
+ end
20
+ end
21
+
22
+ require 'new_relic/metric_parser/metric_parser'
23
+ require 'new_relic/metric_parser/apdex'
24
+
25
+ require 'new_relic/metric_parser/action_mailer'
26
+ require 'new_relic/metric_parser/active_merchant'
27
+ require 'new_relic/metric_parser/active_record'
28
+ require 'new_relic/metric_parser/apdex'
29
+ require 'new_relic/metric_parser/background_transaction'
30
+ require 'new_relic/metric_parser/client'
31
+ require 'new_relic/metric_parser/controller'
32
+ require 'new_relic/metric_parser/controller_cpu'
33
+ require 'new_relic/metric_parser/controller_ext'
34
+ require 'new_relic/metric_parser/database'
35
+ require 'new_relic/metric_parser/database_pool'
36
+ require 'new_relic/metric_parser/dot_net'
37
+ require 'new_relic/metric_parser/errors'
38
+ require 'new_relic/metric_parser/external'
39
+ require 'new_relic/metric_parser/frontend'
40
+ require 'new_relic/metric_parser/gc'
41
+ require 'new_relic/metric_parser/hibernate_session'
42
+ require 'new_relic/metric_parser/java'
43
+ require 'new_relic/metric_parser/java_parser'
44
+ require 'new_relic/metric_parser/jsp'
45
+ require 'new_relic/metric_parser/jsp_tag'
46
+ require 'new_relic/metric_parser/mem_cache'
47
+ require 'new_relic/metric_parser/metric_parser'
48
+ require 'new_relic/metric_parser/orm'
49
+ require 'new_relic/metric_parser/other_transaction'
50
+ require 'new_relic/metric_parser/servlet'
51
+ require 'new_relic/metric_parser/servlet_context_listener'
52
+ require 'new_relic/metric_parser/servlet_filter'
53
+ require 'new_relic/metric_parser/solr'
54
+ require 'new_relic/metric_parser/solr_request_handler'
55
+ require 'new_relic/metric_parser/spring'
56
+ require 'new_relic/metric_parser/spring_controller'
57
+ require 'new_relic/metric_parser/spring_view'
58
+ require 'new_relic/metric_parser/struts_action'
59
+ require 'new_relic/metric_parser/struts_result'
60
+ require 'new_relic/metric_parser/version'
61
+ require 'new_relic/metric_parser/view'
62
+ require 'new_relic/metric_parser/web_frontend'
63
+ require 'new_relic/metric_parser/web_service'
64
+ require 'new_relic/metric_parser/web_transaction'
@@ -0,0 +1,14 @@
1
+ require 'new_relic/metric_parser'
2
+ module NewRelic
3
+ module MetricParser
4
+ class ActionMailer < NewRelic::MetricParser::MetricParser
5
+
6
+ def is_action_mailer?; true; end
7
+
8
+ def short_name
9
+ "ActionMailer - #{segments[1]}"
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,31 @@
1
+ require 'new_relic/metric_parser'
2
+ module NewRelic
3
+ module MetricParser
4
+ class ActiveMerchant < NewRelic::MetricParser::MetricParser
5
+
6
+ def is_active_merchant?; true; end
7
+
8
+ def is_active_merchant_gateway?
9
+ segments[1] == 'gateway'
10
+ end
11
+
12
+ def is_active_merchant_operation?
13
+ segments[1] == 'operation'
14
+ end
15
+
16
+ def gateway_name
17
+ # ends in "Gateway" - trim that off
18
+ segments[2][0..-8].titleize
19
+ end
20
+
21
+ def operation_name
22
+ segments[2]
23
+ end
24
+
25
+ def short_name
26
+ segments[2]
27
+ end
28
+
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,33 @@
1
+ require 'new_relic/metric_parser'
2
+ module NewRelic
3
+ module MetricParser
4
+ class ActiveRecord < NewRelic::MetricParser::MetricParser
5
+ def is_active_record? ; true; end
6
+
7
+ def model_class
8
+ return segments[1]
9
+ end
10
+
11
+ def is_database?
12
+ true
13
+ end
14
+ def legend_name
15
+ if name == 'ActiveRecord/all'
16
+ 'Database'
17
+ else
18
+ super
19
+ end
20
+ end
21
+ def tooltip_name
22
+ if name == 'ActiveRecord/all'
23
+ 'all SQL execution'
24
+ else
25
+ super
26
+ end
27
+ end
28
+ def developer_name
29
+ "#{model_class}##{segments.last}"
30
+ end
31
+ end
32
+ end
33
+ end
@@ -1,10 +1,10 @@
1
1
  require 'new_relic/metric_parser'
2
2
  module NewRelic
3
- class MetricParser
4
- class Apdex < NewRelic::MetricParser
5
-
3
+ module MetricParser
4
+ class Apdex < NewRelic::MetricParser::MetricParser
5
+
6
6
  CLIENT = 'Client'
7
-
7
+
8
8
  # Convenience method for creating the appropriate client
9
9
  # metric name.
10
10
  def self.client_metric(apdex_t)
@@ -14,6 +14,7 @@ module NewRelic
14
14
  "#{self.client_metric(apdex_t)}/#{os}/#{browser}/#{version}"
15
15
  end
16
16
 
17
+ def is_apdex?; true; end
17
18
  def is_client?
18
19
  segments[1] == CLIENT
19
20
  end
@@ -26,12 +27,12 @@ module NewRelic
26
27
  def is_summary?
27
28
  segments.size == 1
28
29
  end
29
-
30
+
30
31
  # Apdex/Client/N
31
32
  def apdex_t
32
33
  is_client? && segments[2].to_f
33
34
  end
34
-
35
+
35
36
  def platform
36
37
  is_browser_summary? && segments[3]
37
38
  end
@@ -51,7 +52,7 @@ module NewRelic
51
52
  def platform_and_user_agent
52
53
  is_browser_summary? && segments[3..-1].join(" ")
53
54
  end
54
-
55
+
55
56
  def developer_name
56
57
  case
57
58
  when is_client? then "Apdex Client (#{apdex_t})"
@@ -60,7 +61,7 @@ module NewRelic
60
61
  else "Apdex #{segments[1..-1].join("/")}"
61
62
  end
62
63
  end
63
-
64
+
64
65
  def short_name
65
66
  # standard controller actions
66
67
  if segments.length > 1
@@ -69,12 +70,12 @@ module NewRelic
69
70
  'All Frontend Urls'
70
71
  end
71
72
  end
72
-
73
+
73
74
  def url
74
75
  '/' + segments[1..-1].join('/')
75
76
  end
76
-
77
- # this is used to match transaction traces to controller actions.
77
+
78
+ # this is used to match transaction traces to controller actions.
78
79
  # TT's don't have a preceding slash :P
79
80
  def tt_path
80
81
  segments[1..-1].join('/')
@@ -0,0 +1,7 @@
1
+ require 'new_relic/metric_parser/java'
2
+ class NewRelic::MetricParser::BackgroundTransaction < NewRelic::MetricParser::Java
3
+
4
+ def call_rate_suffix
5
+ 'cpm'
6
+ end
7
+ end
@@ -0,0 +1,46 @@
1
+ class NewRelic::MetricParser::Client < NewRelic::MetricParser::MetricParser
2
+
3
+ def measure
4
+ segments[1]
5
+ end
6
+
7
+ def frontend?; measure == 'frontend'; end
8
+ def backend?; measure == 'backend'; end
9
+ def totaltime?; measure == 'totaltime'; end
10
+
11
+ def all?
12
+ segments[1].index('all') == 0
13
+ end
14
+
15
+ def operation
16
+ all? ? 'All Operations' : segments[1].titleize.gsub(/(load|ready|time|end)$/,' \1')
17
+ end
18
+
19
+ def legend_name
20
+ if frontend?
21
+ "Browser Rendering and Asset Download"
22
+ elsif backend?
23
+ "Backend and Network"
24
+ else
25
+ segments[1..-1].join(" ")
26
+ end
27
+ end
28
+
29
+ def platform
30
+ segments[2]
31
+ end
32
+
33
+ def user_agent
34
+ segments[3..-1].join(" ")
35
+ end
36
+
37
+ def platform_and_user_agent
38
+ segments[2..-1].join(" ")
39
+ end
40
+
41
+ def developer_name
42
+ name = segments[1].capitalize
43
+ name << " (#{segments[2..-1].join(" ")})" if segments.length > 2
44
+ name
45
+ end
46
+ end
@@ -0,0 +1,67 @@
1
+ require 'new_relic/metric_parser'
2
+ module NewRelic
3
+ module MetricParser
4
+ class Controller < NewRelic::MetricParser::MetricParser
5
+
6
+ def is_controller?; true; end
7
+ def is_transaction?; true; end
8
+
9
+ # If the controller name segments look like a file path, convert it to the controller
10
+ # class name. If it begins with a capital letter, assume it's already a class name.
11
+ # We only expect a lower case letter with Rails, so we'll be able to use camelize for
12
+ # that.
13
+ def controller_name
14
+ path = segments[1..-2].join('/')
15
+ path < 'a' ? path : path.camelize+"Controller"
16
+ end
17
+
18
+ def action_name
19
+ if segments[-1] =~ /^\(other\)$/
20
+ '(template only)'
21
+ else
22
+ segments[-1]
23
+ end
24
+ end
25
+
26
+ def developer_name
27
+ "#{controller_name}##{action_name}"
28
+ end
29
+
30
+ def is_web_transaction?
31
+ true
32
+ end
33
+ # return the cpu measuring equivalent. It may be nil since this metric was not
34
+ # present in earlier versions of the agent.
35
+ def cpu_metric
36
+ Metric.lookup((["ControllerCPU"] + segments[1..-1]).join('/'), :create => false)
37
+ end
38
+
39
+ def short_name
40
+ # standard controller actions
41
+ if segments.length > 1
42
+ url
43
+ else
44
+ 'All Controller Actions'
45
+ end
46
+ end
47
+
48
+ def url
49
+ '/' + segments[1..-1].join('/')
50
+ end
51
+
52
+ # this is used to match transaction traces to controller actions.
53
+ # TT's don't have a preceding slash :P
54
+ def tt_path
55
+ segments[1..-1].join('/')
56
+ end
57
+
58
+ def call_rate_suffix
59
+ 'rpm'
60
+ end
61
+
62
+ def summary_metrics
63
+ %w[HttpDispatcher]
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,43 @@
1
+ require 'new_relic/metric_parser'
2
+ module NewRelic
3
+ module MetricParser
4
+ class ControllerCPU < NewRelic::MetricParser::MetricParser
5
+
6
+ def is_controller_cpu?; true; end
7
+
8
+ def controller_name
9
+ segments[1..-2].join('/').camelize+"Controller"
10
+ end
11
+
12
+ def action_name
13
+ segments[-1]
14
+ end
15
+
16
+ def developer_name
17
+ "#{controller_name}##{action_name}"
18
+ end
19
+
20
+ def base_metric_name
21
+ "Controller/" + segments[1..-1].join('/')
22
+ end
23
+
24
+ def short_name
25
+ # standard controller actions
26
+ if segments.length > 1
27
+ url
28
+ else
29
+ 'All Controller Actions'
30
+ end
31
+ end
32
+
33
+ def url
34
+ '/' + segments[1..-1].join('/')
35
+ end
36
+
37
+ def call_rate_suffix
38
+ 'rpm'
39
+ end
40
+
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,17 @@
1
+ # Extend the controller with extra behavior from web transactions
2
+ # This is just temporary until we switchover to WebTransaction from Controller.
3
+
4
+ NewRelic::MetricParser::Controller.class_eval do
5
+
6
+ def initialize(name)
7
+ super
8
+ if %w[Sinatra Rack Task].include?(segment_1)
9
+ self.extend NewRelic::MetricParser::WebTransaction.const_get(segment_1)
10
+ end
11
+ end
12
+
13
+ # default to v2 Web Transactions tab
14
+ def drilldown_url(metric_id)
15
+ {:controller => '/v2/transactions', :action => 'index', :anchor => "id=#{metric_id}"}
16
+ end
17
+ end
@@ -0,0 +1,48 @@
1
+ class NewRelic::MetricParser::Database < NewRelic::MetricParser::MetricParser
2
+ def is_database?; true; end
3
+
4
+ def database
5
+ segments[1]
6
+ end
7
+
8
+ def operation
9
+ op = segments.last
10
+ case
11
+ when op == 'Join Table Columns'
12
+ op.upcase
13
+ when op == 'all'
14
+ op
15
+ else
16
+ op.split(' ').last.upcase
17
+ end
18
+ end
19
+
20
+ def developer_name
21
+ if segments.size == 3
22
+ "#{database} - #{operation}"
23
+ else
24
+ operation
25
+ end
26
+ end
27
+
28
+ def legend_name
29
+ if all?
30
+ 'Database'
31
+ else
32
+ super
33
+ end
34
+ end
35
+
36
+ def tooltip_name
37
+ if all?
38
+ 'all SQL execution'
39
+ else
40
+ super
41
+ end
42
+ end
43
+
44
+ private
45
+ def all?
46
+ name == 'Database/all' || name == 'Database/allWeb' || name == 'Database/allOther'
47
+ end
48
+ end