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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6f033acf8bf5efe89fd548f55aba3e3b7b9c58e2
4
- data.tar.gz: 0e523aeaaca318f6bf863c4f7b9269d4b212f63a
3
+ metadata.gz: b3d8215fa6708cb77746b4bb7042b19ce62c863b
4
+ data.tar.gz: 817f76b9f47cc4d993b919ba6b25d27874635ab3
5
5
  SHA512:
6
- metadata.gz: 9b18921ad5e63244778c06a6d45fcf7fa556a19cac8eb61f58cdfce341033ea87c9e9c3eb1832c8c5c3dd4ce9ad30030340497772c5a1144bfd408b2be0dfd0e
7
- data.tar.gz: 809cc815755c0d2be8555ac9e8bec2d057a849617e196e62644131588d7c8a697f19f1e91a1f73f0c4ace692efbd1d7ece2ce7996548a2f1828c7cd56b0649a9
6
+ metadata.gz: 207d7d3c3bf702d48da4caa3e45f9414914fcad1aa5ba1dee9e1f3e8c72dff1b893e5d117ef54add04eb6e6ee05aeef7012ba242322910902a970c2e2c13b1e9
7
+ data.tar.gz: 359c0dcdeda0ba4380df1715e116753dc54e4249cf38c72f85c9b57dde3102e5fd5432e1a71c9a209561c42927c7fa2fc7d776e6e575be7f6f59745c4689866b
data/.yardopts CHANGED
@@ -10,7 +10,6 @@ lib/new_relic/agent/datastores.rb
10
10
  lib/new_relic/agent/sql_sampler.rb
11
11
  lib/new_relic/agent/transaction.rb
12
12
  lib/new_relic/agent/transaction_sampler.rb
13
- lib/new_relic/rack/developer_mode.rb
14
13
  lib/new_relic/rack/agent_hooks.rb
15
14
  lib/new_relic/rack/browser_monitoring.rb
16
15
  lib/new_relic/rack/error_collector.rb
@@ -1,5 +1,27 @@
1
1
  # New Relic Ruby Agent Release Notes #
2
2
 
3
+ ## v4.1.0 ##
4
+
5
+ * Developer Mode removed
6
+
7
+ The Ruby Agent's Developer Mode, which provided a very limited view of your
8
+ application performance data, has been removed. For more information, check
9
+ out our [community forum](https://discuss.newrelic.com/t/feedback-on-the-ruby-agent-s-developer-mode/46957).
10
+
11
+ * Support NEW_RELIC_ENV for Rails apps
12
+
13
+ Previously, users could set the agent environment with NEW_RELIC_ENV only
14
+ for non-Rails apps. For Rails app, the agent environment would use whatever
15
+ the Rails environment was set to. Now, NEW_RELIC_ENV can also be used for
16
+ Rails apps, so that it is possible to have an agent environment that is
17
+ different from the Rails environment. Thanks Andrea Campolonghi for the
18
+ contribution, as well as Steve Schwartz for also looking into this issue!
19
+
20
+ * Normalization of external hostnames
21
+
22
+ Hostnames from URIs used in external HTTP requests are now always downcased
23
+ to prevent duplicate metrics when only case is different.
24
+
3
25
  ## v4.0.0 ##
4
26
 
5
27
  * Require Ruby 2.0.0+
data/LICENSE CHANGED
@@ -1,30 +1,4 @@
1
- This product includes jquery 1.4.2, written by John Resig
2
- and distributed under an MIT license.
3
- See https://github.com/jquery/jquery/blob/1.4.2/MIT-LICENSE.txt
4
-
5
- Copyright (c) 2010 John Resig, http://jquery.com/
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining
8
- a copy of this software and associated documentation files (the
9
- "Software"), to deal in the Software without restriction, including
10
- without limitation the rights to use, copy, modify, merge, publish,
11
- distribute, sublicense, and/or sell copies of the Software, and to
12
- permit persons to whom the Software is furnished to do so, subject to
13
- the following conditions:
14
-
15
- The above copyright notice and this permission notice shall be
16
- included in all copies or substantial portions of the Software.
17
-
18
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
-
26
-
27
- All other components of this product are
1
+ All components of this product are
28
2
  Copyright (c) 2008-2017 New Relic, Inc. All rights reserved.
29
3
 
30
4
  Certain inventions disclosed in this file may be claimed within
data/README.md CHANGED
@@ -3,21 +3,10 @@
3
3
  New Relic is a performance management system, developed by
4
4
  New Relic, Inc (http://www.newrelic.com). It provides you with deep
5
5
  information about the performance of your Rails or Ruby
6
- application as it runs in production. The New Relic Ruby Agent is
7
- dual-purposed as a either a Gem or a Rails plugin, hosted on
8
- [github](https://github.com/newrelic/rpm/tree/master).
9
-
10
- The New Relic Ruby Agent runs in one of two modes:
11
-
12
- **Production Mode**
13
- Low overhead instrumentation that captures detailed information on
14
- your application running in production and transmits them to
15
- newrelic.com where you can monitor them in real time.
16
-
17
- **Developer Mode**
18
- A Rack middleware that maps `/newrelic` to an application for showing
19
- detailed performance metrics on a page by page basis. Installed
20
- automatically in Rails applications.
6
+ application as it runs in production and transmits them to
7
+ newrelic.com where you can monitor them in real time. The New Relic
8
+ Ruby Agent is dual-purposed as a either a Gem or a Rails plugin,
9
+ hosted on [github](https://github.com/newrelic/rpm/tree/master).
21
10
 
22
11
  ## Supported Environments
23
12
 
@@ -90,9 +79,6 @@ Then make sure you set `RACK_ENV` to the environment corresponding to the
90
79
  configuration definitions in the newrelic.yml file; e.g., development,
91
80
  staging, production, etc.
92
81
 
93
- To use Developer Mode in Sinatra, add `NewRelic::Rack::DeveloperMode` to
94
- the middleware stack. See the `config.ru` sample below.
95
-
96
82
  #### Other Environments
97
83
 
98
84
  You can use the Ruby Agent to monitor any Ruby application. Add:
@@ -118,45 +104,6 @@ frameworks. You can find a list of community created intrumentation plugins
118
104
  (e.g. [newrelic-redis](https://github.com/evanphx/newrelic-redis)) in the
119
105
  [extends_newrelic_rpm project](https://github.com/newrelic/extends_newrelic_rpm).
120
106
 
121
- ## Developer Mode
122
-
123
- When running the Developer Mode, the Ruby Agent will track the
124
- performance of every HTTP request serviced by your application, and
125
- store in memory this information for the last 100 HTTP transactions.
126
-
127
- To view this performance information, including detailed SQL statement
128
- analysis, open `/newrelic` in your web application. For instance if
129
- you are running mongrel or thin on port 3000, enter the following into
130
- your browser:
131
-
132
- http://localhost:3000/newrelic
133
-
134
- Developer Mode is only initialized if the `developer_mode` setting in
135
- the newrelic.yml file is set to true. By default, it is turned off in
136
- all environments but `development`.
137
-
138
- #### Developer Mode in Rails
139
-
140
- Developer Mode is available automatically in Rails Applications based
141
- on Rails 2.3 and later. No additional configuration is required. When
142
- your application starts and `developer_mode` is enabled, the Ruby
143
- Agent injects a middleware into your Rails middleware stack.
144
-
145
- For earlier versions of Rails that support Rack, you can use
146
- a `config.ru` as below.
147
-
148
- #### Developer Mode in Rack Applications
149
-
150
- Developer Mode is available for any Rack based application such as
151
- Sinatra by installing the NewRelic::Rack::DeveloperMode
152
- middleware. This middleware passes all requests that do not start with
153
- /newrelic.
154
-
155
- Here's an example entry for Developer Mode in a `config.ru` file:
156
-
157
- require 'new_relic/rack/developer_mode'
158
- use NewRelic::Rack::DeveloperMode
159
-
160
107
  ## Production Mode
161
108
 
162
109
  When your application runs in the production environment, the New
@@ -29,7 +29,6 @@ module NewRelic
29
29
  require 'new_relic/metrics'
30
30
  require 'new_relic/metric_spec'
31
31
  require 'new_relic/metric_data'
32
- require 'new_relic/collection_helper'
33
32
  require 'new_relic/noticed_error'
34
33
 
35
34
  require 'new_relic/agent/encoding_normalizer'
@@ -68,7 +68,6 @@ module NewRelic
68
68
  DST_TRANSACTION_TRACER = 1 << 1
69
69
  DST_ERROR_COLLECTOR = 1 << 2
70
70
  DST_BROWSER_MONITORING = 1 << 3
71
- DST_DEVELOPER_MODE = 1 << 4
72
71
 
73
72
  DST_ALL = 0xF
74
73
 
@@ -108,7 +108,7 @@ module NewRelic
108
108
  def self.agent_enabled
109
109
  Proc.new {
110
110
  NewRelic::Agent.config[:enabled] &&
111
- (NewRelic::Agent.config[:developer_mode] || NewRelic::Agent.config[:monitor_mode]) &&
111
+ (NewRelic::Agent.config[:test_mode] || NewRelic::Agent.config[:monitor_mode]) &&
112
112
  NewRelic::Agent::Autostart.agent_should_start?
113
113
  }
114
114
  end
@@ -278,19 +278,12 @@ module NewRelic
278
278
  :allowed_from_server => false,
279
279
  :description => 'When <code>true</code>, the agent transmits data about your app to the New Relic <a href="https://docs.newrelic.com/docs/apm/new-relic-apm/getting-started/glossary#collector">collector</a>.'
280
280
  },
281
- :developer_mode => {
282
- :default => value_of(:developer),
283
- :public => true,
284
- :type => Boolean,
285
- :allowed_from_server => false,
286
- :description => 'When <code>true</code>, enables developer mode, a local analytics package built into the agent for rack applications. Access developer mode analytics by visiting <b>/newrelic</b> in your application.'
287
- },
288
- :developer => {
281
+ :test_mode => {
289
282
  :default => false,
290
283
  :public => false,
291
284
  :type => Boolean,
292
285
  :allowed_from_server => false,
293
- :description => 'Alternative method of enabling developer_mode.'
286
+ :description => 'Used in tests for agent to start up but not connect to collector. Formerly used <code>developer_mode</code> in test config for this purpose.'
294
287
  },
295
288
  :log_level => {
296
289
  :default => 'info',
@@ -433,13 +426,6 @@ module NewRelic
433
426
  :allowed_from_server => false,
434
427
  :description => 'Timeout for waiting on connect to complete before a rake task'
435
428
  },
436
- :'profiling.available' => {
437
- :default => DefaultSource.profiling_available,
438
- :public => false,
439
- :type => Boolean,
440
- :allowed_from_server => false,
441
- :description => 'Determines if ruby-prof is available for developer mode profiling.'
442
- },
443
429
  :apdex_t => {
444
430
  :default => 0.5,
445
431
  :public => true,
@@ -669,13 +655,6 @@ module NewRelic
669
655
  :allowed_from_server => false,
670
656
  :description => 'If <code>true</code>, disables view instrumentation.'
671
657
  },
672
- :disable_backtrace_cleanup => {
673
- :default => false,
674
- :public => true,
675
- :type => Boolean,
676
- :allowed_from_server => false,
677
- :description => 'If <code>true</code>, the agent won\'t remove <code>newrelic_rpm</code> from backtraces.'
678
- },
679
658
  :disable_harvest_thread => {
680
659
  :default => false,
681
660
  :public => false,
@@ -1315,14 +1294,6 @@ module NewRelic
1315
1294
  :allowed_from_server => false,
1316
1295
  :description => 'If <code>true</code>, prevents the agent from hooking into Puma::Rack::URLMap to install middleware tracing.'
1317
1296
  },
1318
- :disable_rubyprof => {
1319
- :default => false,
1320
- :public => true,
1321
- :type => Boolean,
1322
- :dynamic_name => true,
1323
- :allowed_from_server => false,
1324
- :description => 'If <code>true</code>, the agent won\'t use RubyProf in developer mode.'
1325
- },
1326
1297
  :disable_typhoeus => {
1327
1298
  :default => false,
1328
1299
  :public => true,
@@ -9,8 +9,6 @@ module NewRelic
9
9
  # This class collects errors from the parent application, storing
10
10
  # them until they are harvested and transmitted to the server
11
11
  class ErrorCollector
12
- include NewRelic::CollectionHelper
13
-
14
12
  # Maximum possible length of the queue - defaults to 20, may be
15
13
  # made configurable in the future. This is a tradeoff between
16
14
  # memory and data retention
@@ -40,7 +40,7 @@ module NewRelic
40
40
  end
41
41
 
42
42
  def uri
43
- @uri ||= NewRelic::Agent::HTTPClients::URIUtil.parse_url(@curlobj.url)
43
+ @uri ||= NewRelic::Agent::HTTPClients::URIUtil.parse_and_normalize_url(@curlobj.url)
44
44
  end
45
45
  end
46
46
 
@@ -40,7 +40,7 @@ module NewRelic
40
40
  @request = request
41
41
  @uri = case request.url
42
42
  when ::URI then request.url
43
- else NewRelic::Agent::HTTPClients::URIUtil.parse_url(request.url)
43
+ else NewRelic::Agent::HTTPClients::URIUtil.parse_and_normalize_url(request.url)
44
44
  end
45
45
  end
46
46
 
@@ -26,14 +26,19 @@ module NewRelic
26
26
  # There are valid URI strings that some HTTP client libraries will
27
27
  # accept that the stdlib URI module doesn't handle. If we find that
28
28
  # Addressable is around, use that to normalize out our URL's.
29
- def self.parse_url(url)
30
- if defined?(::Addressable::URI)
31
- address = ::Addressable::URI.parse(url)
32
- address.normalize!
33
- URI.parse(address.to_s)
34
- else
35
- URI.parse(url)
29
+ def self.parse_and_normalize_url(url)
30
+ uri = url
31
+ unless ::URI === uri
32
+ if defined?(::Addressable::URI)
33
+ address = ::Addressable::URI.parse(url)
34
+ address.normalize!
35
+ uri = ::URI.parse(address.to_s)
36
+ else
37
+ uri = ::URI.parse(url)
38
+ end
36
39
  end
40
+ uri.host.downcase!
41
+ uri
37
42
  end
38
43
 
39
44
  QUESTION_MARK = "?".freeze
@@ -141,19 +141,5 @@ module NewRelic
141
141
  (other.min_call_time < min_call_time && other.call_count > 0) || call_count == 0
142
142
  end
143
143
  end
144
-
145
- class ChainedStats
146
- attr_accessor :scoped_stats, :unscoped_stats
147
-
148
- def initialize(scoped_stats, unscoped_stats)
149
- @scoped_stats = scoped_stats
150
- @unscoped_stats = unscoped_stats
151
- end
152
-
153
- def method_missing(method, *args)
154
- unscoped_stats.send(method, *args)
155
- scoped_stats.send(method, *args)
156
- end
157
- end
158
144
  end
159
145
  end
@@ -2,16 +2,14 @@
2
2
  # This file is distributed under New Relic's license terms.
3
3
  # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
4
 
5
- require 'new_relic/agent/stats_engine/metric_stats'
6
5
  require 'new_relic/agent/stats_engine/gc_profiler'
7
6
  require 'new_relic/agent/stats_engine/stats_hash'
7
+ require 'new_relic/language_support'
8
8
 
9
9
  module NewRelic
10
10
  module Agent
11
11
  # This class handles all the statistics gathering for the agent
12
12
  class StatsEngine
13
- include MetricStats
14
-
15
13
  attr_accessor :metric_rules
16
14
 
17
15
  def initialize
@@ -25,6 +23,176 @@ module NewRelic
25
23
  def with_stats_lock
26
24
  @stats_lock.synchronize { yield }
27
25
  end
26
+
27
+ # Update the unscoped metrics given in metric_names.
28
+ # metric_names may be either a single name, or an array of names.
29
+ #
30
+ # This is an internal method, subject to change at any time. Client apps
31
+ # and gems should use the public API (NewRelic::Agent.record_metric)
32
+ # instead.
33
+ #
34
+ # There are four ways to use this method:
35
+ #
36
+ # 1. With a numeric value, it will update the Stats objects associated
37
+ # with the given metrics by calling record_data_point(value, aux).
38
+ # aux will be treated in this case as the exclusive time associated
39
+ # with the call being recorded.
40
+ #
41
+ # 2. With a value of :apdex_s, :apdex_t, or :apdex_f, it will treat the
42
+ # associated stats as an Apdex metric, updating it to reflect the
43
+ # occurrence of a transaction falling into the given category.
44
+ # The aux value in this case should be the apdex threshold used in
45
+ # bucketing the request.
46
+ #
47
+ # 3. If a block is given, value and aux will be ignored, and instead the
48
+ # Stats object associated with each named unscoped metric will be
49
+ # yielded to the block for customized update logic.
50
+ #
51
+ # 4. If value is a Stats instance, it will be merged into the Stats
52
+ # associated with each named unscoped metric.
53
+ #
54
+ # If this method is called during a transaction, the metrics will be
55
+ # attached to the Transaction, and not merged into the global set until
56
+ # the end of the transaction.
57
+ #
58
+ # Otherwise, the metrics will be recorded directly into the global set
59
+ # of metrics, under a lock.
60
+ #
61
+ # @api private
62
+ #
63
+ def tl_record_unscoped_metrics(metric_names, value=nil, aux=nil, &blk)
64
+ state = NewRelic::Agent::TransactionState.tl_get
65
+ record_unscoped_metrics(state, metric_names, value, aux, &blk)
66
+ end
67
+
68
+ def record_unscoped_metrics(state, metric_names, value=nil, aux=nil, &blk)
69
+ txn = state.current_transaction
70
+ if txn
71
+ txn.metrics.record_unscoped(metric_names, value, aux, &blk)
72
+ else
73
+ specs = coerce_to_metric_spec_array(metric_names, nil)
74
+ with_stats_lock do
75
+ @stats_hash.record(specs, value, aux, &blk)
76
+ end
77
+ end
78
+ end
79
+
80
+ # Like tl_record_unscoped_metrics, but records a scoped metric as well.
81
+ #
82
+ # This is an internal method, subject to change at any time. Client apps
83
+ # and gems should use the public API (NewRelic::Agent.record_metric)
84
+ # instead.
85
+ #
86
+ # The given scoped_metric will be recoded as both a scoped *and* an
87
+ # unscoped metric. The summary_metrics will be recorded as unscoped
88
+ # metrics only.
89
+ #
90
+ # If called during a transaction, all metrics will be attached to the
91
+ # Transaction, and not merged into the global set of metrics until the
92
+ # end of the transaction.
93
+ #
94
+ # If called outside of a transaction, only the *unscoped* metrics will
95
+ # be recorded, directly into the global set of metrics (under a lock).
96
+ #
97
+ # @api private
98
+ #
99
+ def tl_record_scoped_and_unscoped_metrics(scoped_metric, summary_metrics=nil, value=nil, aux=nil, &blk)
100
+ state = NewRelic::Agent::TransactionState.tl_get
101
+ record_scoped_and_unscoped_metrics(state, scoped_metric, summary_metrics, value, aux, &blk)
102
+ end
103
+
104
+ def record_scoped_and_unscoped_metrics(state, scoped_metric, summary_metrics=nil, value=nil, aux=nil, &blk)
105
+ txn = state.current_transaction
106
+ if txn
107
+ txn.metrics.record_scoped_and_unscoped(scoped_metric, value, aux, &blk)
108
+ if summary_metrics
109
+ txn.metrics.record_unscoped(summary_metrics, value, aux, &blk)
110
+ end
111
+ else
112
+ specs = coerce_to_metric_spec_array(scoped_metric, nil)
113
+ if summary_metrics
114
+ specs.concat(coerce_to_metric_spec_array(summary_metrics, nil))
115
+ end
116
+ with_stats_lock do
117
+ @stats_hash.record(specs, value, aux, &blk)
118
+ end
119
+ end
120
+ end
121
+
122
+ # Helper for recording a straight value into the count
123
+ def tl_record_supportability_metric_count(metric, value)
124
+ real_name = "Supportability/#{metric}"
125
+ tl_record_unscoped_metrics(real_name) do |stat|
126
+ stat.call_count = value
127
+ end
128
+ end
129
+
130
+ def reset!
131
+ with_stats_lock do
132
+ old = @stats_hash
133
+ @stats_hash = StatsHash.new
134
+ old
135
+ end
136
+ end
137
+
138
+ # merge data from previous harvests into this stats engine
139
+ def merge!(other_stats_hash)
140
+ with_stats_lock do
141
+ @stats_hash.merge!(other_stats_hash)
142
+ @stats_hash
143
+ end
144
+ end
145
+
146
+ def merge_transaction_metrics!(txn_metrics, scope)
147
+ with_stats_lock do
148
+ @stats_hash.merge_transaction_metrics!(txn_metrics, scope)
149
+ end
150
+ end
151
+
152
+ def harvest!
153
+ now = Time.now
154
+ snapshot = reset!
155
+ snapshot = apply_rules_to_metric_data(@metric_rules, snapshot)
156
+ snapshot.harvested_at = now
157
+ snapshot
158
+ end
159
+
160
+ def apply_rules_to_metric_data(rules_engine, stats_hash)
161
+ renamed_stats = NewRelic::Agent::StatsHash.new(stats_hash.started_at)
162
+ stats_hash.each do |spec, stats|
163
+ new_name = rules_engine.rename(spec.name)
164
+ unless new_name.nil?
165
+ new_spec = NewRelic::MetricSpec.new(new_name, spec.scope)
166
+ renamed_stats[new_spec].merge!(stats)
167
+ end
168
+ end
169
+ renamed_stats
170
+ end
171
+
172
+ def coerce_to_metric_spec_array(metric_names_or_specs, scope)
173
+ specs = []
174
+ Array(metric_names_or_specs).map do |name_or_spec|
175
+ case name_or_spec
176
+ when String
177
+ specs << NewRelic::MetricSpec.new(name_or_spec)
178
+ specs << NewRelic::MetricSpec.new(name_or_spec, scope) if scope
179
+ when NewRelic::MetricSpec
180
+ specs << name_or_spec
181
+ end
182
+ end
183
+ specs
184
+ end
185
+
186
+ # For use by test code only.
187
+ def clear_stats
188
+ reset!
189
+ NewRelic::Agent::BusyCalculator.reset
190
+ end
191
+
192
+ # For use by test code only.
193
+ def to_h
194
+ with_stats_lock { @stats_hash.to_h }
195
+ end
28
196
  end
29
197
  end
30
198
  end