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.
- data/CHANGELOG +18 -0
- data/LICENSE +1 -1
- data/README.rdoc +10 -5
- data/lib/conditional_vendored_metric_parser.rb +5 -0
- data/lib/new_relic/agent.rb +0 -1
- data/lib/new_relic/agent/agent.rb +1 -1
- data/lib/new_relic/agent/error_collector.rb +2 -0
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +170 -47
- data/lib/new_relic/agent/instrumentation/memcache.rb +3 -1
- data/lib/new_relic/agent/instrumentation/metric_frame.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +6 -0
- data/lib/new_relic/agent/instrumentation/sinatra.rb +4 -3
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +134 -98
- data/lib/new_relic/commands/install.rb +10 -0
- data/lib/new_relic/control.rb +13 -0
- data/lib/new_relic/control/configuration.rb +1 -1
- data/lib/new_relic/control/frameworks/rails.rb +9 -5
- data/lib/new_relic/control/frameworks/rails3.rb +3 -7
- data/lib/new_relic/control/instrumentation.rb +2 -2
- data/lib/new_relic/delayed_job_injection.rb +1 -1
- data/lib/new_relic/rack/developer_mode.rb +1 -1
- data/lib/new_relic/recipes.rb +1 -1
- data/lib/new_relic/transaction_analysis.rb +1 -1
- data/lib/new_relic/transaction_sample.rb +3 -1
- data/lib/new_relic/version.rb +2 -2
- data/newrelic_rpm.gemspec +50 -19
- data/test/new_relic/agent/memcache_instrumentation_test.rb +29 -25
- data/ui/helpers/developer_mode_helper.rb +1 -11
- data/ui/views/newrelic/_segment.rhtml +0 -1
- data/ui/views/newrelic/_segment_row.rhtml +1 -3
- data/ui/views/newrelic/index.rhtml +12 -0
- data/ui/views/newrelic/threads.rhtml +8 -7
- data/vendor/gems/metric_parser-0.1.0.pre1/LICENSE +0 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/README +0 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/metric_parser.rb +1 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser.rb +64 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/action_mailer.rb +14 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/active_merchant.rb +31 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/active_record.rb +33 -0
- data/{lib → vendor/gems/metric_parser-0.1.0.pre1/lib}/new_relic/metric_parser/apdex.rb +12 -11
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/background_transaction.rb +7 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/client.rb +46 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb +67 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller_cpu.rb +43 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller_ext.rb +17 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/database.rb +48 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/database_pool.rb +24 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/dot_net.rb +28 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/dot_net_parser.rb +17 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/errors.rb +11 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/external.rb +55 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/frontend.rb +40 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/gc.rb +20 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/hibernate_session.rb +7 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/java.rb +31 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/java_parser.rb +17 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/jsp.rb +34 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/jsp_tag.rb +7 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/mem_cache.rb +55 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/metric_parser.rb +122 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/orm.rb +27 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/other_transaction.rb +40 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet.rb +7 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet_context_listener.rb +7 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet_filter.rb +7 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/solr.rb +27 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/solr_request_handler.rb +15 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/spring.rb +54 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/spring_controller.rb +6 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/spring_view.rb +6 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/struts_action.rb +20 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/struts_result.rb +20 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/version.rb +5 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb +66 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_frontend.rb +18 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_service.rb +14 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_transaction.rb +133 -0
- metadata +88 -39
- data/lib/new_relic/metric_parser.rb +0 -136
- data/lib/new_relic/metric_parser/action_mailer.rb +0 -9
- data/lib/new_relic/metric_parser/active_merchant.rb +0 -26
- data/lib/new_relic/metric_parser/active_record.rb +0 -28
- data/lib/new_relic/metric_parser/controller.rb +0 -62
- data/lib/new_relic/metric_parser/controller_cpu.rb +0 -38
- data/lib/new_relic/metric_parser/errors.rb +0 -6
- data/lib/new_relic/metric_parser/external.rb +0 -50
- data/lib/new_relic/metric_parser/mem_cache.rb +0 -50
- data/lib/new_relic/metric_parser/other_transaction.rb +0 -36
- data/lib/new_relic/metric_parser/view.rb +0 -61
- data/lib/new_relic/metric_parser/web_frontend.rb +0 -14
- data/lib/new_relic/metric_parser/web_service.rb +0 -9
- data/test/new_relic/metric_parser_test.rb +0 -226
@@ -1,38 +0,0 @@
|
|
1
|
-
class NewRelic::MetricParser::ControllerCPU < NewRelic::MetricParser
|
2
|
-
|
3
|
-
def is_controller_cpu?; true; end
|
4
|
-
|
5
|
-
def controller_name
|
6
|
-
segments[1..-2].join('/').camelize+"Controller"
|
7
|
-
end
|
8
|
-
|
9
|
-
def action_name
|
10
|
-
segments[-1]
|
11
|
-
end
|
12
|
-
|
13
|
-
def developer_name
|
14
|
-
"#{controller_name}##{action_name}"
|
15
|
-
end
|
16
|
-
|
17
|
-
def base_metric_name
|
18
|
-
"Controller/" + segments[1..-1].join('/')
|
19
|
-
end
|
20
|
-
|
21
|
-
def short_name
|
22
|
-
# standard controller actions
|
23
|
-
if segments.length > 1
|
24
|
-
url
|
25
|
-
else
|
26
|
-
'All Controller Actions'
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def url
|
31
|
-
'/' + segments[1..-1].join('/')
|
32
|
-
end
|
33
|
-
|
34
|
-
def call_rate_suffix
|
35
|
-
'rpm'
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
class NewRelic::MetricParser::External < NewRelic::MetricParser
|
2
|
-
|
3
|
-
def all?
|
4
|
-
host == 'all' || host == 'allWeb' || host == 'allOther'
|
5
|
-
end
|
6
|
-
def hosts_all?
|
7
|
-
library == 'all'
|
8
|
-
end
|
9
|
-
def host
|
10
|
-
segments[1]
|
11
|
-
end
|
12
|
-
def library
|
13
|
-
segments[2]
|
14
|
-
end
|
15
|
-
def operation
|
16
|
-
segments[3] && segments[3..-1].join("/")
|
17
|
-
end
|
18
|
-
def legend_name
|
19
|
-
case
|
20
|
-
when all?
|
21
|
-
"External Services"
|
22
|
-
when hosts_all?
|
23
|
-
"All #{host} calls"
|
24
|
-
else
|
25
|
-
developer_name
|
26
|
-
end
|
27
|
-
end
|
28
|
-
def tooltip_name
|
29
|
-
case
|
30
|
-
when all?
|
31
|
-
"calls to external systems"
|
32
|
-
when hosts_all?
|
33
|
-
"calls to #{host}"
|
34
|
-
else
|
35
|
-
"calls to #{developer_name}"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
def developer_name
|
39
|
-
case
|
40
|
-
when all?
|
41
|
-
'All External'
|
42
|
-
when hosts_all?
|
43
|
-
host
|
44
|
-
when operation
|
45
|
-
"#{library}[#{host}]: #{operation}"
|
46
|
-
else
|
47
|
-
"#{library}[#{host}]"
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
class NewRelic::MetricParser::MemCache < NewRelic::MetricParser
|
2
|
-
def is_memcache?; true; end
|
3
|
-
|
4
|
-
# for MemCache metrics, the short name is actually
|
5
|
-
# the full name
|
6
|
-
def short_name
|
7
|
-
name
|
8
|
-
end
|
9
|
-
def developer_name
|
10
|
-
"MemCache #{segments[1..-1].join '/'}"
|
11
|
-
end
|
12
|
-
|
13
|
-
def all?
|
14
|
-
segments[1].index('all') == 0
|
15
|
-
end
|
16
|
-
def operation
|
17
|
-
all? ? 'All Operations' : segments[1]
|
18
|
-
end
|
19
|
-
def legend_name
|
20
|
-
case segments[1]
|
21
|
-
when 'allWeb'
|
22
|
-
"MemCache"
|
23
|
-
when 'allOther'
|
24
|
-
"Non-web MemCache"
|
25
|
-
else
|
26
|
-
"MemCache #{operation} operations"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
def tooltip_name
|
30
|
-
case segments[1]
|
31
|
-
when 'allWeb'
|
32
|
-
"MemCache calls from web transactions"
|
33
|
-
when 'allOther'
|
34
|
-
"MemCache calls from non-web transactions"
|
35
|
-
else
|
36
|
-
"MemCache #{operation} operations"
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
def developer_name
|
41
|
-
case segments[1]
|
42
|
-
when 'allWeb'
|
43
|
-
"Web MemCache"
|
44
|
-
when 'allOther'
|
45
|
-
"Non-web MemCache"
|
46
|
-
else
|
47
|
-
"MemCache #{operation}"
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# OtherTransaction metrics must have at least three segments: /OtherTransaction/<task>/*
|
2
|
-
# Task is "Background", "Resque", "DelayedJob" etc.
|
3
|
-
|
4
|
-
class NewRelic::MetricParser::OtherTransaction < NewRelic::MetricParser
|
5
|
-
|
6
|
-
def is_transaction?
|
7
|
-
true
|
8
|
-
end
|
9
|
-
def task
|
10
|
-
segments[1]
|
11
|
-
end
|
12
|
-
|
13
|
-
def developer_name
|
14
|
-
segments[2..-1].join(NewRelic::MetricParser::SEPARATOR)
|
15
|
-
end
|
16
|
-
|
17
|
-
def short_name
|
18
|
-
developer_name
|
19
|
-
end
|
20
|
-
|
21
|
-
def drilldown_url(metric_id)
|
22
|
-
{:controller => '/v2/background_tasks', :action => 'index', :task => task, :anchor => "id=#{metric_id}"}
|
23
|
-
end
|
24
|
-
|
25
|
-
def path
|
26
|
-
segments[2..-1].join "/"
|
27
|
-
end
|
28
|
-
|
29
|
-
def summary_metrics
|
30
|
-
if segments.size > 2
|
31
|
-
%W[OtherTransaction/#{task}/all OtherTransaction/all]
|
32
|
-
else
|
33
|
-
[]
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
class NewRelic::MetricParser::View < NewRelic::MetricParser
|
2
|
-
def is_view?; true; end
|
3
|
-
|
4
|
-
def is_render?
|
5
|
-
segments.last == "Rendering"
|
6
|
-
end
|
7
|
-
def is_compiler?
|
8
|
-
segments.last == "Compile"
|
9
|
-
end
|
10
|
-
def pie_chart_label
|
11
|
-
case segments.last
|
12
|
-
when "Rendering"
|
13
|
-
"#{file_name(segments[-2])} Template"
|
14
|
-
when "Partial"
|
15
|
-
"#{file_name(segments[-2])} Partial"
|
16
|
-
when ".rhtml Processing"
|
17
|
-
"ERB compilation"
|
18
|
-
else
|
19
|
-
segments[1..-1]
|
20
|
-
end
|
21
|
-
end
|
22
|
-
def template_label
|
23
|
-
case segments.last
|
24
|
-
when "Rendering"
|
25
|
-
"#{file_name(segments[1..-2].join(NewRelic::MetricParser::SEPARATOR))} Template"
|
26
|
-
when "Partial"
|
27
|
-
"#{file_name(segments[1..-2].join(NewRelic::MetricParser::SEPARATOR))} Partial"
|
28
|
-
when ".rhtml Processing"
|
29
|
-
"ERB compilation"
|
30
|
-
else
|
31
|
-
segments[1..-1].join("/")
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def short_name
|
36
|
-
segments[1..-2].join(NewRelic::MetricParser::SEPARATOR)
|
37
|
-
end
|
38
|
-
|
39
|
-
def controller_name
|
40
|
-
template_label
|
41
|
-
end
|
42
|
-
|
43
|
-
def action_name
|
44
|
-
# Strip the extension
|
45
|
-
segments[-2].gsub(/\..*$/, "")
|
46
|
-
end
|
47
|
-
|
48
|
-
def developer_name
|
49
|
-
template_label
|
50
|
-
end
|
51
|
-
|
52
|
-
def url
|
53
|
-
'/' + file_name(segments[1..-2].join('/'))
|
54
|
-
end
|
55
|
-
private
|
56
|
-
def file_name(path)
|
57
|
-
label = path.gsub /\.html\.rhtml/, '.rhtml'
|
58
|
-
label = segments[1] if label.empty?
|
59
|
-
label
|
60
|
-
end
|
61
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# The metric where the mongrel queue time is stored
|
2
|
-
|
3
|
-
class NewRelic::MetricParser::WebFrontend < NewRelic::MetricParser
|
4
|
-
def short_name
|
5
|
-
if segments.last == 'Average Queue Time'
|
6
|
-
'Mongrel Average Queue Time'
|
7
|
-
else
|
8
|
-
super
|
9
|
-
end
|
10
|
-
end
|
11
|
-
def legend_name
|
12
|
-
'Mongrel Wait'
|
13
|
-
end
|
14
|
-
end
|
@@ -1,226 +0,0 @@
|
|
1
|
-
ENV['SKIP_RAILS'] = 'true'
|
2
|
-
require File.expand_path(File.join(File.dirname(__FILE__),'..', 'test_helper'))
|
3
|
-
|
4
|
-
class MetricParserTest < Test::Unit::TestCase
|
5
|
-
|
6
|
-
def test_memcache
|
7
|
-
m = NewRelic::MetricParser.for_metric_named "MemCache/read"
|
8
|
-
assert_equal "MemCache read", m.developer_name
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_memcache__all
|
12
|
-
m = NewRelic::MetricParser.for_metric_named "MemCache/all"
|
13
|
-
assert_equal "MemCache All Operations", m.developer_name
|
14
|
-
assert_equal "All Operations", m.operation
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_view__short
|
18
|
-
i = NewRelic::MetricParser.parse("View/.rhtml Processing")
|
19
|
-
assert_equal "ERB compilation", i.developer_name
|
20
|
-
end
|
21
|
-
def test_controller
|
22
|
-
["Controller", "Controller/1/2/3","Controller//!!#!//"].each do | metric_name |
|
23
|
-
m = NewRelic::MetricParser.for_metric_named(metric_name)
|
24
|
-
assert m.is_controller?
|
25
|
-
assert !m.is_view?
|
26
|
-
assert !m.is_database?
|
27
|
-
assert !m.is_web_service?
|
28
|
-
end
|
29
|
-
|
30
|
-
["Controller+1/2/3","Lew//!!#!//"].each do | metric_name |
|
31
|
-
m = NewRelic::MetricParser.for_metric_named(metric_name)
|
32
|
-
|
33
|
-
assert !m.is_controller?
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_controller_cpu
|
38
|
-
["Controller/1/2/3","Controller//!!#!//"].each do | metric_name |
|
39
|
-
m = NewRelic::MetricParser.for_metric_named(metric_name)
|
40
|
-
|
41
|
-
assert m.is_controller?
|
42
|
-
assert !m.is_view?
|
43
|
-
assert !m.is_database?
|
44
|
-
assert !m.is_web_service?
|
45
|
-
end
|
46
|
-
|
47
|
-
["ControllerCPU/1/2/3","ControllerCPU//!!#!//"].each do | metric_name |
|
48
|
-
m = NewRelic::MetricParser.for_metric_named(metric_name)
|
49
|
-
|
50
|
-
assert m.is_controller_cpu?
|
51
|
-
assert !m.is_view?
|
52
|
-
assert !m.is_controller?
|
53
|
-
assert !m.is_database?
|
54
|
-
assert !m.is_web_service?
|
55
|
-
|
56
|
-
assert_not_nil m.base_metric_name
|
57
|
-
assert_equal 0, m.base_metric_name.index('Controller/')
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_web_service
|
63
|
-
["WebService/x/Controller/", "WebService","WebService/1/2/3","WebService//!!#!//"].each do |metric_name|
|
64
|
-
m = NewRelic::MetricParser.for_metric_named(metric_name)
|
65
|
-
|
66
|
-
assert !m.is_controller?
|
67
|
-
assert !m.is_view?
|
68
|
-
assert !m.is_database?
|
69
|
-
assert m.is_web_service?
|
70
|
-
end
|
71
|
-
|
72
|
-
["Web/Service","WEBService+1/2/3","Lew//!!#!//"].each do | metric_name |
|
73
|
-
m = NewRelic::MetricParser.for_metric_named(metric_name)
|
74
|
-
|
75
|
-
assert !m.is_web_service?, metric_name
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_database
|
80
|
-
["ActiveRecord","ActiveRecord/1/2/3","ActiveRecord//!!#!//"].each do | metric_name |
|
81
|
-
m = NewRelic::MetricParser.for_metric_named(metric_name)
|
82
|
-
|
83
|
-
assert !m.is_view?
|
84
|
-
assert !m.is_controller?
|
85
|
-
assert m.is_active_record?, "#{metric_name}: #{m.category}"
|
86
|
-
assert !m.is_web_service?
|
87
|
-
end
|
88
|
-
|
89
|
-
["ActiveRecordxx","ActiveRecord+1/2/3","ActiveRecord#!//"].each do | metric_name |
|
90
|
-
m = NewRelic::MetricParser.for_metric_named(metric_name)
|
91
|
-
|
92
|
-
assert !m.is_database?
|
93
|
-
end
|
94
|
-
end
|
95
|
-
def test_view
|
96
|
-
%w[View/posts/post/Rendering View/admin/users/view/Partial View/ERB/Compile].each do | name |
|
97
|
-
m = NewRelic::MetricParser.for_metric_named(name)
|
98
|
-
assert !m.is_database?
|
99
|
-
assert !m.is_controller?
|
100
|
-
assert !m.is_web_service?
|
101
|
-
assert !m.is_error?
|
102
|
-
assert m.is_view?
|
103
|
-
end
|
104
|
-
end
|
105
|
-
def test_view__render
|
106
|
-
m = NewRelic::MetricParser.parse "View/blogs/show.html.erb/Rendering"
|
107
|
-
|
108
|
-
short_name = "show.html.erb Template"
|
109
|
-
long_name = "blogs/show.html.erb Template"
|
110
|
-
assert_equal short_name, m.pie_chart_label
|
111
|
-
assert_equal long_name, m.developer_name
|
112
|
-
assert_equal short_name, m.pie_chart_label
|
113
|
-
assert_equal "blogs/show.html.erb Template", m.controller_name
|
114
|
-
assert_equal "show", m.action_name
|
115
|
-
assert_equal "/blogs/show.html.erb", m.url
|
116
|
-
end
|
117
|
-
def test_view__partial
|
118
|
-
m = NewRelic::MetricParser.for_metric_named "View/admin/users/view.html.erb/Partial"
|
119
|
-
m.pie_chart_label
|
120
|
-
assert_equal "view.html.erb Partial", m.pie_chart_label
|
121
|
-
assert_equal "admin/users/view.html.erb Partial", m.developer_name
|
122
|
-
assert_equal "admin/users/view.html.erb Partial", m.controller_name
|
123
|
-
assert_equal "view", m.action_name
|
124
|
-
assert_equal "/admin/users/view.html.erb", m.url
|
125
|
-
end
|
126
|
-
def test_view__rhtml
|
127
|
-
m = NewRelic::MetricParser.for_metric_named "View/admin/users/view.rhtml/Rendering"
|
128
|
-
m.pie_chart_label
|
129
|
-
assert_equal "view.rhtml Template", m.pie_chart_label
|
130
|
-
assert_equal "admin/users/view.rhtml Template", m.developer_name
|
131
|
-
assert_equal "admin/users/view.rhtml Template", m.controller_name
|
132
|
-
assert_equal "view", m.action_name
|
133
|
-
assert_equal "/admin/users/view.rhtml", m.url
|
134
|
-
end
|
135
|
-
def test_error
|
136
|
-
["Errors","Errors/Type/MyType","Errors/Controller/MyController/"].each do | metric_name |
|
137
|
-
m = NewRelic::MetricParser.for_metric_named(metric_name)
|
138
|
-
|
139
|
-
assert !m.is_database?
|
140
|
-
assert !m.is_controller?
|
141
|
-
assert !m.is_web_service?
|
142
|
-
assert !m.is_view?
|
143
|
-
assert m.is_error?
|
144
|
-
end
|
145
|
-
|
146
|
-
m = NewRelic::MetricParser.for_metric_named("Errors/Type/MyType")
|
147
|
-
assert_equal m.short_name, 'MyType'
|
148
|
-
end
|
149
|
-
def test_external
|
150
|
-
m = NewRelic::MetricParser.for_metric_named("External/all")
|
151
|
-
assert m.all?
|
152
|
-
assert !m.hosts_all?
|
153
|
-
assert_equal "All External", m.developer_name
|
154
|
-
assert_equal "calls to external systems", m.tooltip_name
|
155
|
-
assert_equal "External Services", m.legend_name
|
156
|
-
assert_nil m.operation
|
157
|
-
assert_nil m.library
|
158
|
-
|
159
|
-
m = NewRelic::MetricParser.for_metric_named("External/venus/all")
|
160
|
-
assert !m.all?
|
161
|
-
assert m.hosts_all?
|
162
|
-
assert_equal "venus", m.developer_name
|
163
|
-
assert_equal "calls to venus", m.tooltip_name
|
164
|
-
assert_equal "All venus calls", m.legend_name
|
165
|
-
assert_nil m.operation
|
166
|
-
assert_equal 'all', m.library
|
167
|
-
|
168
|
-
m = NewRelic::MetricParser.for_metric_named("External/venus/Net::Http/get")
|
169
|
-
assert !m.all?
|
170
|
-
assert !m.hosts_all?
|
171
|
-
assert_equal "Net::Http[venus]: get", m.developer_name
|
172
|
-
assert_equal "calls to Net::Http[venus]: get", m.tooltip_name
|
173
|
-
assert_equal "Net::Http[venus]: get", m.legend_name
|
174
|
-
assert_equal 'get', m.operation
|
175
|
-
assert_equal 'Net::Http', m.library
|
176
|
-
|
177
|
-
|
178
|
-
end
|
179
|
-
|
180
|
-
context "with apdex" do
|
181
|
-
|
182
|
-
context "client" do
|
183
|
-
setup do
|
184
|
-
@client_name = NewRelic::MetricParser::Apdex.client_metric(NewRelic::Control.instance.apdex_t)
|
185
|
-
@apdex_client = NewRelic::MetricParser.for_metric_named(@client_name)
|
186
|
-
end
|
187
|
-
should "produce a client metric name" do
|
188
|
-
assert_equal "Apdex/Client/#{NewRelic::Control.instance.apdex_t}", @client_name
|
189
|
-
end
|
190
|
-
should "display the apdex value in " do
|
191
|
-
assert_equal "Apdex Client (1.1)", @apdex_client.developer_name
|
192
|
-
end
|
193
|
-
should "act like a client score" do
|
194
|
-
assert ! @apdex_client.is_summary?
|
195
|
-
assert @apdex_client.is_client?
|
196
|
-
end
|
197
|
-
should "display nicely" do
|
198
|
-
assert_equal "Apdex Client (#{NewRelic::Control.instance.apdex_t})", @apdex_client.developer_name
|
199
|
-
end
|
200
|
-
|
201
|
-
end
|
202
|
-
|
203
|
-
context "summary" do
|
204
|
-
setup do
|
205
|
-
@apdex_summary = NewRelic::MetricParser.for_metric_named('Apdex')
|
206
|
-
end
|
207
|
-
|
208
|
-
should "act like a summary" do
|
209
|
-
assert @apdex_summary.is_summary?
|
210
|
-
assert ! @apdex_summary.is_client?
|
211
|
-
end
|
212
|
-
end
|
213
|
-
context "controller score" do
|
214
|
-
setup do
|
215
|
-
@controller_apdex = NewRelic::MetricParser.for_metric_named('Apdex/sessions/guest_index')
|
216
|
-
end
|
217
|
-
should "act like a controller" do
|
218
|
-
assert ! @controller_apdex.is_summary?
|
219
|
-
assert ! @controller_apdex.is_client?
|
220
|
-
end
|
221
|
-
should "display nicely" do
|
222
|
-
assert_equal "Apdex sessions/guest_index", @controller_apdex.developer_name
|
223
|
-
end
|
224
|
-
end
|
225
|
-
end
|
226
|
-
end
|