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,21 +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
- module NewRelic
6
- module MetricParser
7
- module DotNetParser
8
- def class_name_without_package
9
- full_class_name =~ /(.*\.)(.*)$/ ? $2 : full_class_name
10
- end
11
-
12
- def developer_name
13
- "#{full_class_name}.#{method_name}()"
14
- end
15
-
16
- def short_name
17
- "#{class_name_without_package}.#{method_name}()"
18
- end
19
- end
20
- end
21
- end
@@ -1,15 +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
- module NewRelic
6
- autoload :MetricParser, 'new_relic/metric_parser'
7
- module MetricParser
8
- class Errors < NewRelic::MetricParser::MetricParser
9
- def is_error?; true; end
10
- def short_name
11
- segments[2..-1].join(NewRelic::MetricParser::MetricParser::SEPARATOR)
12
- end
13
- end
14
- end
15
- end
@@ -1,59 +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
- module NewRelic
6
- autoload :MetricParser, 'new_relic/metric_parser'
7
- module MetricParser
8
- class External < NewRelic::MetricParser::MetricParser
9
-
10
- def all?
11
- host == 'all' || host == 'allWeb' || host == 'allOther'
12
- end
13
- def hosts_all?
14
- library == 'all'
15
- end
16
- def host
17
- segments[1]
18
- end
19
- def library
20
- segments[2]
21
- end
22
- def operation
23
- segments[3] && segments[3..-1].join("/")
24
- end
25
- def legend_name
26
- case
27
- when all?
28
- "External Services"
29
- when hosts_all?
30
- "All #{host} calls"
31
- else
32
- developer_name
33
- end
34
- end
35
- def tooltip_name
36
- case
37
- when all?
38
- "calls to external systems"
39
- when hosts_all?
40
- "calls to #{host}"
41
- else
42
- "calls to #{developer_name}"
43
- end
44
- end
45
- def developer_name
46
- case
47
- when all?
48
- 'All External'
49
- when hosts_all?
50
- host
51
- when operation
52
- "#{library}[#{host}]: #{operation}"
53
- else
54
- "#{library}[#{host}]"
55
- end
56
- end
57
- end
58
- end
59
- end
@@ -1,44 +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
- class NewRelic::MetricParser::Frontend < NewRelic::MetricParser::MetricParser
6
-
7
- =begin
8
- def action_name
9
- if segments[-1] =~ /^\(other\)$/
10
- '(template only)'
11
- else
12
- segments[-1]
13
- end
14
- end
15
- =end
16
-
17
- def developer_name
18
- url
19
- #"#{controller_name}##{action_name}"
20
- end
21
-
22
- def short_name
23
- # standard controller actions
24
- if segments.length > 1
25
- url
26
- else
27
- 'All Frontend Urls'
28
- end
29
- end
30
-
31
- def url
32
- '/' + segments[1..-1].join('/')
33
- end
34
-
35
- # this is used to match transaction traces to controller actions.
36
- # TT's don't have a preceding slash :P
37
- def tt_path
38
- segments[1..-1].join('/')
39
- end
40
-
41
- def call_rate_suffix
42
- 'rpm'
43
- end
44
- end
@@ -1,24 +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
- class NewRelic::MetricParser::GC < NewRelic::MetricParser::MetricParser
6
-
7
- def developer_name
8
- if segments.length == 1
9
- "GC"
10
- elsif segment_1 == "cumulative"
11
- "GC Execution"
12
- else
13
- "GC - #{segment_1}"
14
- end
15
- end
16
-
17
- def short_name
18
- if segments.length > 1
19
- developer_name
20
- else
21
- 'All GCs'
22
- end
23
- end
24
- end
@@ -1,11 +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 'new_relic/metric_parser/java'
6
- class NewRelic::MetricParser::HibernateSession < NewRelic::MetricParser::Java
7
-
8
- def call_rate_suffix
9
- 'cpm'
10
- end
11
- end
@@ -1,35 +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 'new_relic/metric_parser/java_parser'
6
- module NewRelic
7
- module MetricParser
8
- class Java < NewRelic::MetricParser::MetricParser
9
- include JavaParser
10
- def initialize(name)
11
- super
12
- if segments.length > 2
13
- self.extend NewRelic::MetricParser::JavaParser
14
- end
15
- end
16
-
17
- def pie_chart_label
18
- short_name
19
- end
20
-
21
- def tooltip_name
22
- developer_name
23
- end
24
-
25
- def full_class_name
26
- segment_1
27
- end
28
-
29
- def method_name
30
- segment_2
31
- end
32
-
33
- end
34
- end
35
- end
@@ -1,21 +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
- module NewRelic
6
- module MetricParser
7
- module JavaParser
8
- def class_name_without_package
9
- full_class_name =~ /(.*\.)(.*)$/ ? $2 : full_class_name
10
- end
11
-
12
- def developer_name
13
- "#{full_class_name}.#{method_name}()"
14
- end
15
-
16
- def short_name
17
- "#{class_name_without_package}.#{method_name}()"
18
- end
19
- end
20
- end
21
- end
@@ -1,38 +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
- class NewRelic::MetricParser::Jsp < NewRelic::MetricParser::MetricParser
6
- def is_view?; true; end
7
- def pie_chart_label
8
- short_name
9
- end
10
-
11
- def short_name
12
- segments[-1]
13
- end
14
-
15
- def controller_name
16
- file_name
17
- end
18
-
19
- def tooltip_name
20
- developer_name
21
- end
22
-
23
- def action_name
24
- file_name
25
- end
26
-
27
- def developer_name
28
- file_name
29
- end
30
-
31
- def url
32
- '/' + file_name
33
- end
34
- private
35
- def file_name
36
- segments[1..-1].join(NewRelic::MetricParser::MetricParser::SEPARATOR)
37
- end
38
- end
@@ -1,11 +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 'new_relic/metric_parser/java'
6
- class NewRelic::MetricParser::JspTag < NewRelic::MetricParser::Java
7
-
8
- def call_rate_suffix
9
- 'cpm'
10
- end
11
- end
@@ -1,56 +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
- module NewRelic
6
- autoload :MetricParser, 'new_relic/metric_parser'
7
- module MetricParser
8
- class MemCache < NewRelic::MetricParser::MetricParser
9
- def is_memcache?; true; end
10
-
11
- # for Memcache metrics, the short name is actually
12
- # the full name
13
- def short_name
14
- 'Memcache'
15
- end
16
-
17
- def all?
18
- segments[1].index('all') == 0
19
- end
20
- def operation
21
- all? ? 'All Operations' : segments[1]
22
- end
23
- def legend_name
24
- case segments[1]
25
- when 'allWeb'
26
- "Memcache"
27
- when 'allOther'
28
- "Non-web Memcache"
29
- else
30
- "Memcache #{operation} operations"
31
- end
32
- end
33
- def tooltip_name
34
- case segments[1]
35
- when 'allWeb'
36
- "Memcache calls from web transactions"
37
- when 'allOther'
38
- "Memcache calls from non-web transactions"
39
- else
40
- "MemCache #{operation} operations"
41
- end
42
-
43
- end
44
- def developer_name
45
- case segments[1]
46
- when 'allWeb'
47
- "Web Memcache"
48
- when 'allOther'
49
- "Non-web Memcache"
50
- else
51
- "Memcache #{operation}"
52
- end
53
- end
54
- end
55
- end
56
- end
@@ -1,138 +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
- module NewRelic
6
- module MetricParser
7
- class MetricParser
8
-
9
- SEPARATOR = '/' unless defined? SEPARATOR
10
- attr_reader :name
11
-
12
- # Load in the parsers classes in the plugin:
13
- Dir[File.join(File.dirname(__FILE__), "metric_parser", "*.rb")].each { | file | require file }
14
-
15
- def self.category_is_constant(category)
16
- @string_constants ||= (
17
- NewRelic::MetricParser.constants.inject({}){|memo, const| memo[const.to_s] = true; memo}
18
- )
19
- @string_constants[category]
20
- end
21
- # return a string that is parsable via the Metric parser APIs
22
- def self.for_metric_named(s)
23
- category = (s =~ /^([^\/]*)/) && $1
24
- parser_class = self
25
- if category_is_constant(category)
26
- begin
27
- parser_class = NewRelic::MetricParser.const_get(category)
28
- rescue
29
- nil
30
- end
31
- end
32
- parser_class.new s
33
- end
34
-
35
- def self.parse(s)
36
- for_metric_named(s)
37
- end
38
-
39
- def method_missing(method_name, *args)
40
- return false if method_name.to_s =~ /^is_.*\?/
41
- super
42
- end
43
- # The short name for the metric is defined as all of the segments
44
- # of the metric name except for its first (its domain).
45
- def short_name
46
- if segments.empty?
47
- ''
48
- elsif segments.length == 1
49
- segments[0]
50
- else
51
- segments[1..-1].join(SEPARATOR)
52
- end
53
- end
54
-
55
- def pie_chart_label
56
- developer_name
57
- end
58
-
59
- def developer_name
60
- short_name
61
- end
62
-
63
- def tooltip_name
64
- short_name
65
- end
66
-
67
- def apdex_metric_path
68
- %Q[Apdex/#{segments[1..-1].join('/')}]
69
- end
70
-
71
- # A short name for legends in the graphs
72
- def legend_name
73
- short_name
74
- end
75
-
76
- # Return the name of another metric if the current
77
- # metric is really add-on data for another metric.
78
- def base_metric_name
79
- nil
80
- end
81
-
82
- # Category is a UI description of the general
83
- # category of metrics for this metric.
84
- def category
85
- segments[0]
86
- end
87
-
88
-
89
- EMPTY_SEGMENTS_HASH = [].freeze
90
- SEGMENTS_CACHE = {}
91
- def segments
92
- name || (return EMPTY_SEGMENTS_HASH)
93
- SEGMENTS_CACHE[name] ||= name.split(SEPARATOR).freeze
94
- end
95
-
96
- # --
97
- # These accessors are used to allow chart to use a specific segment in the metric
98
- # name for label construction as a zero-arg accessor
99
- # ++
100
- def segment_0; segments[0]; end
101
- def segment_1; segments[1]; end
102
- def segment_2; segments[2]; end
103
- def segment_3; segments[3]; end
104
- def segment_4; segments[4]; end
105
- def segment_5; segments[5]; end
106
- def last_segment; segments.last; end
107
-
108
- # This is the suffix used for call rate or throughput. By default, it's cpm
109
- # but things like controller actions will override to use something like 'rpm'
110
- # for requests per minute
111
- def call_rate_suffix
112
- 'cpm'
113
- end
114
-
115
- def url
116
- ''
117
- end
118
- # Return the list of dispatcher metrics that correspond to this metric. That is,
119
- # the summary metrics which should also be recorded when this metric is recorded.
120
- def summary_metrics
121
- []
122
- end
123
- # returns a hash of params for url_for(), giving you a drilldown URL to an RPM page for this metric
124
- # define in subclasses - TB 2009-12-18
125
- # def drilldown_url(metric_id); end
126
-
127
- def initialize(name)
128
- @name = name
129
- end
130
-
131
- # These would be reflected properly by method missing; consider
132
- # this an optimization
133
- def is_controller?; false; end
134
- def is_transaction?; false; end
135
-
136
- end
137
- end
138
- end