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
File without changes
|
File without changes
|
@@ -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
|
-
|
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,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
|