newrelic_rpm 3.6.6.147 → 3.6.7.152

Sign up to get free protection for your applications and to get access to all the features.
Files changed (265) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.gitignore +0 -1
  3. data/CHANGELOG +55 -17
  4. data/Guardfile +7 -0
  5. data/Rakefile +6 -0
  6. data/bin/mongrel_rpm +33 -0
  7. data/bin/newrelic +13 -0
  8. data/bin/newrelic_cmd +5 -0
  9. data/bin/nrdebug +273 -0
  10. data/install.rb +3 -3
  11. data/lib/new_relic/agent.rb +4 -6
  12. data/lib/new_relic/agent/agent.rb +76 -72
  13. data/lib/new_relic/agent/autostart.rb +18 -5
  14. data/lib/new_relic/agent/browser_monitoring.rb +41 -35
  15. data/lib/new_relic/agent/browser_token.rb +38 -0
  16. data/lib/new_relic/agent/busy_calculator.rb +7 -5
  17. data/lib/new_relic/agent/commands/agent_command.rb +19 -0
  18. data/lib/new_relic/agent/commands/agent_command_router.rb +88 -0
  19. data/lib/new_relic/agent/commands/thread_profiler.rb +80 -0
  20. data/lib/new_relic/agent/configuration/default_source.rb +700 -0
  21. data/lib/new_relic/agent/configuration/environment_source.rb +83 -30
  22. data/lib/new_relic/agent/configuration/manager.rb +8 -8
  23. data/lib/new_relic/agent/configuration/mask_defaults.rb +2 -2
  24. data/lib/new_relic/agent/cross_app_monitor.rb +10 -21
  25. data/lib/new_relic/agent/cross_app_tracing.rb +3 -3
  26. data/lib/new_relic/agent/error_collector.rb +7 -10
  27. data/lib/new_relic/agent/http_clients/curb_wrappers.rb +1 -1
  28. data/lib/new_relic/agent/http_clients/excon_wrappers.rb +5 -1
  29. data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +5 -1
  30. data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +5 -1
  31. data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +1 -1
  32. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +5 -12
  33. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +4 -0
  34. data/lib/new_relic/agent/instrumentation/{rails4/active_record.rb → active_record_4.rb} +1 -1
  35. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +11 -11
  36. data/lib/new_relic/agent/instrumentation/authlogic.rb +8 -6
  37. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +12 -6
  38. data/lib/new_relic/agent/instrumentation/curb.rb +11 -2
  39. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +1 -3
  40. data/lib/new_relic/agent/instrumentation/evented_subscriber.rb +11 -2
  41. data/lib/new_relic/agent/instrumentation/excon/middleware.rb +13 -4
  42. data/lib/new_relic/agent/instrumentation/puma.rb +2 -1
  43. data/lib/new_relic/agent/instrumentation/rack.rb +15 -17
  44. data/lib/new_relic/agent/method_tracer.rb +181 -191
  45. data/lib/new_relic/agent/new_relic_service.rb +16 -14
  46. data/lib/new_relic/agent/pipe_channel_manager.rb +1 -1
  47. data/lib/new_relic/agent/request_sampler.rb +32 -165
  48. data/lib/new_relic/agent/sampled_buffer.rb +79 -0
  49. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +1 -8
  50. data/lib/new_relic/agent/sql_sampler.rb +3 -3
  51. data/lib/new_relic/agent/stats_engine.rb +1 -1
  52. data/lib/new_relic/agent/stats_engine/gc_profiler.rb +1 -1
  53. data/lib/new_relic/agent/stats_engine/metric_stats.rb +2 -3
  54. data/lib/new_relic/agent/stats_engine/transactions.rb +2 -22
  55. data/lib/new_relic/agent/threading/agent_thread.rb +41 -0
  56. data/lib/new_relic/agent/threading/backtrace_node.rb +71 -0
  57. data/lib/new_relic/agent/threading/thread_profile.rb +172 -0
  58. data/lib/new_relic/agent/transaction.rb +16 -4
  59. data/lib/new_relic/agent/transaction_sample_builder.rb +13 -3
  60. data/lib/new_relic/agent/transaction_sampler.rb +5 -8
  61. data/lib/new_relic/agent/transaction_state.rb +166 -0
  62. data/lib/new_relic/agent/transaction_timings.rb +53 -0
  63. data/lib/new_relic/cli/command.rb +91 -0
  64. data/lib/new_relic/{commands → cli}/deployments.rb +13 -9
  65. data/lib/new_relic/{commands → cli}/install.rb +2 -2
  66. data/lib/new_relic/control/frameworks/rails.rb +1 -8
  67. data/lib/new_relic/control/instance_methods.rb +1 -2
  68. data/lib/new_relic/helper.rb +9 -0
  69. data/lib/new_relic/local_environment.rb +16 -63
  70. data/lib/new_relic/rack/browser_monitoring.rb +8 -5
  71. data/lib/new_relic/recipes.rb +44 -31
  72. data/lib/new_relic/transaction_sample.rb +6 -2
  73. data/lib/new_relic/version.rb +1 -1
  74. data/lib/tasks/install.rake +21 -1
  75. data/newrelic_rpm.gemspec +5 -1
  76. data/test/agent_helper.rb +4 -9
  77. data/test/environments/.gitignore +16 -0
  78. data/test/environments/lib/environments/runner.rb +104 -0
  79. data/test/environments/norails/Gemfile +11 -0
  80. data/test/environments/norails/Rakefile +9 -0
  81. data/test/environments/rails21/Gemfile +24 -0
  82. data/test/environments/rails21/Rakefile +12 -0
  83. data/test/environments/rails21/app/controllers/application.rb +20 -0
  84. data/test/environments/rails21/config/boot.rb +113 -0
  85. data/test/environments/rails21/config/database.yml +31 -0
  86. data/test/environments/rails21/config/environment.rb +28 -0
  87. data/test/environments/rails21/config/environments/development.rb +16 -0
  88. data/test/environments/rails21/config/environments/production.rb +8 -0
  89. data/test/environments/rails21/config/environments/test.rb +10 -0
  90. data/test/environments/rails21/config/routes.rb +5 -0
  91. data/test/environments/rails21/db/schema.rb +5 -0
  92. data/test/environments/rails22/Gemfile +29 -0
  93. data/test/environments/rails22/Rakefile +12 -0
  94. data/test/environments/rails22/app/controllers/application.rb +20 -0
  95. data/test/environments/rails22/config/boot.rb +113 -0
  96. data/test/environments/rails22/config/database.yml +31 -0
  97. data/test/environments/rails22/config/environment.rb +27 -0
  98. data/test/environments/rails22/config/environments/development.rb +16 -0
  99. data/test/environments/rails22/config/environments/production.rb +8 -0
  100. data/test/environments/rails22/config/environments/test.rb +10 -0
  101. data/test/environments/rails22/config/routes.rb +5 -0
  102. data/test/environments/rails22/db/schema.rb +5 -0
  103. data/test/environments/rails23/Gemfile +22 -0
  104. data/test/environments/rails23/Rakefile +12 -0
  105. data/test/environments/rails23/app/controllers/application.rb +20 -0
  106. data/test/environments/rails23/config/boot.rb +127 -0
  107. data/test/environments/rails23/config/database.yml +31 -0
  108. data/test/environments/rails23/config/environment.rb +25 -0
  109. data/test/environments/rails23/config/environments/development.rb +16 -0
  110. data/test/environments/rails23/config/environments/production.rb +8 -0
  111. data/test/environments/rails23/config/environments/test.rb +10 -0
  112. data/test/environments/rails23/config/preinitializer.rb +25 -0
  113. data/test/environments/rails23/config/routes.rb +5 -0
  114. data/test/environments/rails23/db/schema.rb +5 -0
  115. data/test/environments/rails30/Gemfile +19 -0
  116. data/test/environments/rails30/Rakefile +9 -0
  117. data/test/environments/rails30/config/application.rb +17 -0
  118. data/test/environments/rails30/config/boot.rb +10 -0
  119. data/test/environments/rails30/config/database.yml +31 -0
  120. data/test/environments/rails30/config/environment.rb +6 -0
  121. data/test/environments/rails30/config/initializers/new_rails_defaults.rb +11 -0
  122. data/test/environments/rails30/db/schema.rb +5 -0
  123. data/test/environments/rails31/Gemfile +19 -0
  124. data/test/environments/rails31/Rakefile +9 -0
  125. data/test/environments/rails31/config/application.rb +18 -0
  126. data/test/environments/rails31/config/boot.rb +10 -0
  127. data/test/environments/rails31/config/database.yml +31 -0
  128. data/test/environments/rails31/config/environment.rb +6 -0
  129. data/test/environments/rails31/config/initializers/new_rails_defaults.rb +21 -0
  130. data/test/environments/rails31/db/schema.rb +5 -0
  131. data/test/environments/rails32/Gemfile +25 -0
  132. data/test/environments/rails32/Rakefile +9 -0
  133. data/test/environments/rails32/config/application.rb +19 -0
  134. data/test/environments/rails32/config/boot.rb +10 -0
  135. data/test/environments/rails32/config/database.yml +31 -0
  136. data/test/environments/rails32/config/environment.rb +6 -0
  137. data/test/environments/rails32/db/schema.rb +5 -0
  138. data/test/environments/rails40/Gemfile +25 -0
  139. data/test/environments/rails40/Rakefile +9 -0
  140. data/test/environments/rails40/config/application.rb +18 -0
  141. data/test/environments/rails40/config/boot.rb +10 -0
  142. data/test/environments/rails40/config/database.yml +31 -0
  143. data/test/environments/rails40/config/environment.rb +6 -0
  144. data/test/environments/rails40/db/schema.rb +5 -0
  145. data/test/multiverse/lib/multiverse/suite.rb +24 -12
  146. data/test/multiverse/suites/agent_only/logging_test.rb +18 -1
  147. data/test/multiverse/suites/agent_only/rum_instrumentation_test.rb +1 -8
  148. data/test/multiverse/suites/agent_only/thread_profiling_test.rb +10 -7
  149. data/test/multiverse/suites/curb/curb_test.rb +17 -3
  150. data/test/multiverse/suites/excon/Envfile +1 -1
  151. data/test/multiverse/suites/excon/excon_test.rb +18 -2
  152. data/test/multiverse/suites/httpclient/httpclient_test.rb +2 -2
  153. data/test/multiverse/suites/net_http/net_http_test.rb +2 -2
  154. data/test/multiverse/suites/rails/error_tracing_test.rb +35 -8
  155. data/test/multiverse/suites/rails/ignore_test.rb +48 -0
  156. data/test/multiverse/suites/rails/mongrel_queue_depth_test.rb +44 -0
  157. data/test/multiverse/suites/sequel/sequel_test.rb +11 -0
  158. data/test/multiverse/suites/sinatra/ignoring_test.rb +2 -2
  159. data/test/multiverse/suites/typhoeus/Envfile +9 -2
  160. data/test/multiverse/suites/typhoeus/typhoeus_test.rb +3 -2
  161. data/test/new_relic/agent/agent/start_test.rb +3 -22
  162. data/test/new_relic/agent/agent_test.rb +6 -5
  163. data/test/new_relic/agent/autostart_test.rb +39 -1
  164. data/test/new_relic/agent/browser_monitoring_test.rb +43 -88
  165. data/test/new_relic/agent/browser_token_test.rb +52 -0
  166. data/test/new_relic/agent/busy_calculator_test.rb +1 -1
  167. data/test/new_relic/agent/commands/agent_command_router_test.rb +98 -0
  168. data/test/new_relic/agent/commands/agent_command_test.rb +37 -0
  169. data/test/new_relic/agent/commands/thread_profiler_test.rb +177 -0
  170. data/test/new_relic/agent/configuration/default_source_test.rb +81 -0
  171. data/test/new_relic/agent/configuration/environment_source_test.rb +81 -7
  172. data/test/new_relic/agent/configuration/manager_test.rb +16 -1
  173. data/test/new_relic/agent/cross_app_monitor_test.rb +3 -5
  174. data/test/new_relic/agent/error_collector_test.rb +14 -0
  175. data/test/new_relic/agent/instrumentation/action_controller_subscriber_test.rb +1 -1
  176. data/test/new_relic/agent/instrumentation/active_record_instrumentation_test.rb +2 -3
  177. data/test/new_relic/agent/instrumentation/active_record_subscriber_test.rb +29 -31
  178. data/test/new_relic/agent/instrumentation/controller_instrumentation_test.rb +22 -0
  179. data/test/new_relic/agent/method_tracer/instance_methods/trace_execution_scoped_test.rb +2 -2
  180. data/test/new_relic/agent/method_tracer_test.rb +2 -2
  181. data/test/new_relic/agent/new_relic_service_test.rb +5 -49
  182. data/test/new_relic/agent/pipe_channel_manager_test.rb +1 -0
  183. data/test/new_relic/agent/request_sampler_test.rb +32 -95
  184. data/test/new_relic/agent/rpm_agent_test.rb +7 -5
  185. data/test/new_relic/agent/sampled_buffer_test.rb +178 -0
  186. data/test/new_relic/agent/stats_engine/metric_stats_test.rb +0 -1
  187. data/test/new_relic/agent/stats_engine_test.rb +10 -17
  188. data/test/new_relic/agent/threading/agent_thread_test.rb +107 -0
  189. data/test/new_relic/agent/threading/backtrace_node_test.rb +96 -0
  190. data/test/new_relic/agent/{threaded_test.rb → threading/fake_thread.rb} +0 -25
  191. data/test/new_relic/agent/threading/thread_profile_test.rb +308 -0
  192. data/test/new_relic/agent/threading/threaded_test_case.rb +33 -0
  193. data/test/new_relic/agent/transaction/pop_test.rb +0 -16
  194. data/test/new_relic/agent/transaction_sample_builder_test.rb +23 -4
  195. data/test/new_relic/agent/transaction_sampler_test.rb +14 -15
  196. data/test/new_relic/agent/transaction_state_test.rb +75 -0
  197. data/test/new_relic/agent/transaction_test.rb +15 -0
  198. data/test/new_relic/agent/transaction_timings_test.rb +81 -0
  199. data/test/new_relic/agent_test.rb +12 -14
  200. data/test/new_relic/{command → cli}/deployments_test.rb +41 -13
  201. data/test/new_relic/control/frameworks/rails_test.rb +1 -2
  202. data/test/new_relic/control_test.rb +1 -2
  203. data/test/new_relic/dependency_detection_test.rb +14 -0
  204. data/test/new_relic/fake_collector.rb +1 -0
  205. data/test/new_relic/helper_test.rb +7 -2
  206. data/test/new_relic/http_client_test_cases.rb +33 -1
  207. data/test/new_relic/local_environment_test.rb +0 -23
  208. data/test/new_relic/metric_data_test.rb +4 -0
  209. data/test/new_relic/rack/browser_monitoring_test.rb +31 -30
  210. data/test/performance/lib/performance/result.rb +15 -4
  211. data/test/performance/lib/performance/timer.rb +7 -1
  212. data/test/performance/script/baselines +102 -0
  213. data/test/performance/suites/rum_autoinsertion.rb +57 -0
  214. data/test/rum/basic.result.html +10 -0
  215. data/test/rum/basic.source.html +10 -0
  216. data/test/rum/comments1.result.html +24 -0
  217. data/test/rum/comments1.source.html +24 -0
  218. data/test/rum/comments2.result.html +24 -0
  219. data/test/rum/comments2.source.html +24 -0
  220. data/test/rum/gt_in_quotes1.result.html +27 -0
  221. data/test/rum/gt_in_quotes1.source.html +27 -0
  222. data/test/rum/gt_in_quotes2.result.html +24 -0
  223. data/test/rum/gt_in_quotes2.source.html +24 -0
  224. data/test/rum/gt_in_quotes_mismatch.result.html +24 -0
  225. data/test/rum/gt_in_quotes_mismatch.source.html +24 -0
  226. data/test/rum/gt_in_single_quotes1.result.html +25 -0
  227. data/test/rum/gt_in_single_quotes1.source.html +25 -0
  228. data/test/rum/gt_in_single_quotes_mismatch.result.html +25 -0
  229. data/test/rum/gt_in_single_quotes_mismatch.source.html +25 -0
  230. data/test/rum/incomplete_non_meta_tags.result.html +10 -0
  231. data/test/rum/incomplete_non_meta_tags.source.html +10 -0
  232. data/test/rum/no_body.result.html +21 -0
  233. data/test/rum/no_body.source.html +21 -0
  234. data/test/rum/no_header.result.html +7 -0
  235. data/test/rum/no_header.source.html +7 -0
  236. data/test/rum/no_start_header.result.html +9 -0
  237. data/test/rum/no_start_header.source.html +9 -0
  238. data/test/rum/script1.result.html +19 -0
  239. data/test/rum/script1.source.html +19 -0
  240. data/test/rum/script2.result.html +17 -0
  241. data/test/rum/script2.source.html +17 -0
  242. data/test/rum/x_ua_meta_tag.result.html +10 -0
  243. data/test/rum/x_ua_meta_tag.source.html +10 -0
  244. data/test/rum/x_ua_meta_tag_multiline.result.html +11 -0
  245. data/test/rum/x_ua_meta_tag_multiline.source.html +11 -0
  246. data/test/rum/x_ua_meta_tag_with_others.result.html +11 -0
  247. data/test/rum/x_ua_meta_tag_with_others.source.html +11 -0
  248. data/test/rum/x_ua_meta_tag_with_spaces.result.html +10 -0
  249. data/test/rum/x_ua_meta_tag_with_spaces.source.html +10 -0
  250. data/test/script/ci.sh +1 -12
  251. data/test/test_helper.rb +1 -0
  252. data/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb +11 -0
  253. metadata +225 -32
  254. metadata.gz.sig +0 -0
  255. data/lib/new_relic/agent/configuration/defaults.rb +0 -157
  256. data/lib/new_relic/agent/instrumentation/browser_monitoring_timings.rb +0 -56
  257. data/lib/new_relic/agent/thread.rb +0 -37
  258. data/lib/new_relic/agent/thread_profiler.rb +0 -323
  259. data/lib/new_relic/agent/transaction_info.rb +0 -114
  260. data/lib/new_relic/command.rb +0 -89
  261. data/test/new_relic/agent/agent_test_controller_test.rb +0 -348
  262. data/test/new_relic/agent/instrumentation/browser_monitoring_timings_test.rb +0 -70
  263. data/test/new_relic/agent/thread_profiler_test.rb +0 -586
  264. data/test/new_relic/agent/thread_test.rb +0 -93
  265. data/test/new_relic/agent/transaction_info_test.rb +0 -99
@@ -0,0 +1,38 @@
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 'erb'
6
+
7
+ module NewRelic
8
+ module Agent
9
+ module BrowserToken
10
+
11
+ def self.get_token(request)
12
+ return nil unless request
13
+
14
+ agent_flag = request.cookies['NRAGENT']
15
+ if agent_flag and agent_flag.instance_of? String
16
+ s = agent_flag.split("=")
17
+ if s.length == 2
18
+ if s[0] == "tk" && s[1]
19
+ ERB::Util.h(sanitize_token(s[1]))
20
+ end
21
+ end
22
+ else
23
+ nil
24
+ end
25
+ end
26
+
27
+ # Run through a collection of unsafe characters ( in the context of the token )
28
+ # and set the token to an empty string if any of them are found in the token so that
29
+ # potential XSS attacks via the token are avoided
30
+ def self.sanitize_token(token)
31
+ if ( /[<>'"]/ =~ token )
32
+ token.replace("")
33
+ end
34
+ token
35
+ end
36
+ end
37
+ end
38
+ end
@@ -2,6 +2,8 @@
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/transaction_state'
6
+
5
7
  module NewRelic
6
8
  module Agent
7
9
  # This module supports calculation of actual time spent processing requests over the course of
@@ -23,8 +25,8 @@ module NewRelic
23
25
  # transactions - used for a rough estimate of what percentage of
24
26
  # wall clock time is spent processing requests
25
27
  def dispatcher_start(time)
26
- Thread.current[:busy_entries] ||= 0
27
- callers = Thread.current[:busy_entries] += 1
28
+ TransactionState.get.busy_entries ||= 0
29
+ callers = TransactionState.get.busy_entries += 1
28
30
  return if callers > 1
29
31
  @lock.synchronize do
30
32
  @entrypoint_stack.push time
@@ -36,10 +38,10 @@ module NewRelic
36
38
  # data to the server
37
39
  def dispatcher_finish(end_time = nil)
38
40
  # If #dispatcher_start hasn't been called at least once, abort early
39
- return unless Thread.current[:busy_entries]
41
+ return unless TransactionState.get.busy_entries
40
42
 
41
43
  end_time ||= time_now
42
- callers = Thread.current[:busy_entries] -= 1
44
+ callers = TransactionState.get.busy_entries -= 1
43
45
 
44
46
  # Ignore nested calls
45
47
  return if callers > 0
@@ -63,7 +65,7 @@ module NewRelic
63
65
  # but only reset the recursion counter for this thread.
64
66
  def reset
65
67
  @entrypoint_stack = []
66
- Thread.current[:busy_entries] = 0
68
+ TransactionState.get.busy_entries = 0
67
69
  @lock ||= Mutex.new
68
70
  @accumulator = 0
69
71
  @harvest_start = time_now
@@ -0,0 +1,19 @@
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 Agent
7
+ module Commands
8
+ class AgentCommand
9
+ attr_reader :id, :name, :arguments
10
+
11
+ def initialize(collector_command)
12
+ @id = collector_command[0]
13
+ @name = collector_command[1]["name"]
14
+ @arguments = collector_command[1]["arguments"]
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,88 @@
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
+ # This class is the central point for dispatching get_agent_commands messages
6
+ # to the various components that actually process them.
7
+ #
8
+ # This could be evented further, but we eventually need direct access to things
9
+ # like the ThreadProfiler, so it's simpler to just keep it together here.
10
+
11
+ require 'new_relic/agent/commands/agent_command'
12
+
13
+ module NewRelic
14
+ module Agent
15
+ module Commands
16
+ class AgentCommandRouter
17
+ attr_reader :service, :handlers
18
+
19
+ def initialize(service, thread_profiler)
20
+ @service = service
21
+
22
+ @handlers = Hash.new { |*| Proc.new { |cmd| self.unrecognized_agent_command(cmd) } }
23
+
24
+ @handlers['start_profiler'] = Proc.new { |cmd| thread_profiler.handle_start_command(cmd) }
25
+ @handlers['stop_profiler'] = Proc.new { |cmd| thread_profiler.handle_stop_command(cmd) }
26
+ end
27
+
28
+ def handle_agent_commands
29
+ results = invoke_commands(get_agent_commands)
30
+ service.agent_command_results(results) unless results.empty?
31
+ end
32
+
33
+ def get_agent_commands
34
+ commands = service.get_agent_commands
35
+ NewRelic::Agent.logger.debug "Received get_agent_commands = #{commands.inspect}"
36
+ commands
37
+ end
38
+
39
+ def invoke_commands(collector_commands)
40
+ results = {}
41
+
42
+ collector_commands.each do |collector_command|
43
+ agent_command = NewRelic::Agent::Commands::AgentCommand.new(collector_command)
44
+ results[agent_command.id.to_s] = invoke_command(agent_command)
45
+ end
46
+
47
+ results
48
+ end
49
+
50
+ class AgentCommandError < StandardError
51
+ end
52
+
53
+ def invoke_command(agent_command)
54
+ begin
55
+ call_handler_for(agent_command)
56
+ return success
57
+ rescue AgentCommandError => e
58
+ error(e)
59
+ end
60
+ end
61
+
62
+ SUCCESS_RESULT = {}.freeze
63
+ ERROR_KEY = "error"
64
+
65
+ def success
66
+ SUCCESS_RESULT
67
+ end
68
+
69
+ def error(err)
70
+ { ERROR_KEY => err.message}
71
+ end
72
+
73
+ def call_handler_for(agent_command)
74
+ handler = select_handler(agent_command)
75
+ handler.call(agent_command)
76
+ end
77
+
78
+ def select_handler(agent_command)
79
+ @handlers[agent_command.name]
80
+ end
81
+
82
+ def unrecognized_agent_command(agent_command)
83
+ NewRelic::Agent.logger.debug("Unrecognized agent command #{agent_command.inspect}")
84
+ end
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,80 @@
1
+ # encoding: utf-8
2
+ #k 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/agent/threading/agent_thread'
6
+ require 'new_relic/agent/threading/thread_profile'
7
+
8
+ module NewRelic
9
+ module Agent
10
+ module Commands
11
+
12
+ class ThreadProfiler
13
+
14
+ def self.is_supported?
15
+ RUBY_VERSION >= "1.9.2"
16
+ end
17
+
18
+ def handle_start_command(agent_command)
19
+ raise_unsupported_error unless ThreadProfiler.is_supported?
20
+ raise_already_started_error if running?
21
+ start(agent_command)
22
+ end
23
+
24
+ def handle_stop_command(agent_command)
25
+ report_data = agent_command.arguments.fetch("report_data", true)
26
+ stop(report_data)
27
+ end
28
+
29
+ def start(agent_command)
30
+ @profile = Threading::ThreadProfile.new(agent_command)
31
+ @profile.run
32
+ end
33
+
34
+ def stop(report_data)
35
+ @profile.stop unless @profile.nil?
36
+ @profile = nil if !report_data
37
+ end
38
+
39
+ def harvest
40
+ profile = @profile
41
+ @profile = nil
42
+ profile
43
+ end
44
+
45
+ def running?
46
+ !@profile.nil?
47
+ end
48
+
49
+ def finished?
50
+ @profile && @profile.finished?
51
+ end
52
+
53
+ private
54
+
55
+ def raise_command_error(msg)
56
+ NewRelic::Agent.logger.debug(msg)
57
+ raise NewRelic::Agent::Commands::AgentCommandRouter::AgentCommandError.new(msg)
58
+ end
59
+
60
+ def raise_already_started_error
61
+ msg = "Profile already in progress. Ignoring agent command to start another."
62
+ raise_command_error(msg)
63
+ end
64
+
65
+ def raise_unsupported_error
66
+ msg = <<-EOF
67
+ Thread profiling is only supported on 1.9.2 and greater versions of Ruby.
68
+ We detected running agents capable of profiling, but the profile started with
69
+ an agent running Ruby #{RUBY_VERSION}.
70
+
71
+ Profiling again might select an appropriate agent, but we recommend running a
72
+ consistent version of Ruby across your application for better results.
73
+ EOF
74
+ raise_command_error(msg)
75
+ end
76
+
77
+ end
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,700 @@
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 'forwardable'
6
+
7
+ module NewRelic
8
+ module Agent
9
+ module Configuration
10
+ class Boolean; end
11
+
12
+ class DefaultSource
13
+ attr_reader :defaults
14
+
15
+ extend Forwardable
16
+ def_delegators :@defaults, :has_key?, :each, :merge, :delete, :keys, :[], :to_hash
17
+
18
+ def initialize
19
+ @defaults = default_values
20
+ end
21
+
22
+ def default_values
23
+ result = {}
24
+ ::NewRelic::Agent::Configuration::DEFAULTS.each do |key, value|
25
+ result[key] = value[:default]
26
+ end
27
+ result
28
+ end
29
+
30
+ def self.config_path
31
+ Proc.new {
32
+ files = []
33
+ files << File.join("config","newrelic.yml")
34
+ files << File.join("newrelic.yml")
35
+ if ENV["HOME"]
36
+ files << File.join(ENV["HOME"], ".newrelic", "newrelic.yml")
37
+ files << File.join(ENV["HOME"], "newrelic.yml")
38
+ end
39
+ found_path = files.detect do |file|
40
+ File.expand_path(file) if File.exists? file
41
+ end
42
+ found_path || ""
43
+ }
44
+ end
45
+
46
+ def self.framework
47
+ Proc.new {
48
+ case
49
+ when defined?(::NewRelic::TEST) then :test
50
+ when defined?(::Merb) && defined?(::Merb::Plugins) then :merb
51
+ when defined?(::Rails)
52
+ case Rails::VERSION::MAJOR
53
+ when 0..2
54
+ :rails
55
+ when 3
56
+ :rails3
57
+ when 4
58
+ :rails4
59
+ else
60
+ ::NewRelic::Agent.logger.error "Detected unsupported Rails version #{Rails::VERSION::STRING}"
61
+ end
62
+ when defined?(::Sinatra) && defined?(::Sinatra::Base) then :sinatra
63
+ when defined?(::NewRelic::IA) then :external
64
+ else :ruby
65
+ end
66
+ }
67
+ end
68
+
69
+ def self.agent_enabled
70
+ Proc.new {
71
+ self[:enabled] && (self[:developer_mode] || self[:monitor_mode] || self[:monitor_daemons]) && ::NewRelic::Agent::Autostart.agent_should_start?
72
+ }
73
+ end
74
+
75
+ def self.audit_log_path
76
+ Proc.new {
77
+ File.join(self[:log_file_path], 'newrelic_audit.log')
78
+ }
79
+ end
80
+
81
+ def self.app_name
82
+ Proc.new { NewRelic::Control.instance.env }
83
+ end
84
+
85
+ def self.dispatcher
86
+ Proc.new { NewRelic::Control.instance.local_env.discovered_dispatcher }
87
+ end
88
+
89
+ def self.marshaller
90
+ Proc.new { NewRelic::Agent::NewRelicService::JsonMarshaller.is_supported? ? 'json' : 'pruby' }
91
+ end
92
+
93
+ def self.thread_profiler_enabled
94
+ Proc.new { NewRelic::Agent::Commands::ThreadProfiler.is_supported? }
95
+ end
96
+
97
+ def self.browser_monitoring_auto_instrument
98
+ Proc.new { self[:'rum.enabled'] }
99
+ end
100
+
101
+ def self.slow_sql_record_sql
102
+ Proc.new { self[:'transaction_tracer.record_sql'] }
103
+ end
104
+
105
+ def self.slow_sql_explain_enabled
106
+ Proc.new { self[:'transaction_tracer.explain_enabled'] }
107
+ end
108
+
109
+ def self.slow_sql_explain_threshold
110
+ Proc.new { self[:'transaction_tracer.explain_threshold'] }
111
+ end
112
+
113
+ def self.slow_sql_stack_trace_threshold
114
+ Proc.new { self[:'transaction_tracer.stack_trace_threshold'] }
115
+ end
116
+
117
+ def self.slow_sql_enabled
118
+ Proc.new { self[:'transaction_tracer.enabled'] }
119
+ end
120
+
121
+ def self.transaction_tracer_transaction_threshold
122
+ Proc.new { self[:apdex_t] * 4 }
123
+ end
124
+
125
+ def self.disable_activerecord_instrumentation
126
+ Proc.new { self[:skip_ar_instrumentation] }
127
+ end
128
+
129
+ def self.api_port
130
+ Proc.new { self[:port] }
131
+ end
132
+
133
+ def self.port
134
+ Proc.new { self[:ssl] ? 443 : 80 }
135
+ end
136
+
137
+ def self.strip_exception_messages_enabled
138
+ Proc.new { self[:high_security] }
139
+ end
140
+
141
+ def self.developer_mode
142
+ Proc.new { self[:developer] }
143
+ end
144
+
145
+ def self.monitor_mode
146
+ Proc.new { self[:enabled] }
147
+ end
148
+ end
149
+
150
+ AUTOSTART_BLACKLISTED_RAKE_TASKS = [
151
+ 'about',
152
+ 'assets:clean',
153
+ 'assets:clobber',
154
+ 'assets:environment',
155
+ 'assets:precompile',
156
+ 'db:create',
157
+ 'db:drop',
158
+ 'db:fixtures:load',
159
+ 'db:migrate',
160
+ 'db:migrate:status',
161
+ 'db:rollback',
162
+ 'db:schema:cache:clear',
163
+ 'db:schema:cache:dump',
164
+ 'db:schema:dump',
165
+ 'db:schema:load',
166
+ 'db:seed',
167
+ 'db:setup',
168
+ 'db:structure:dump',
169
+ 'db:version',
170
+ 'doc:app',
171
+ 'log:clear',
172
+ 'middleware',
173
+ 'notes',
174
+ 'notes:custom',
175
+ 'rails:template',
176
+ 'rails:update',
177
+ 'routes',
178
+ 'secret',
179
+ 'spec',
180
+ 'spec:controllers',
181
+ 'spec:helpers',
182
+ 'spec:models',
183
+ 'spec:rcov',
184
+ 'stats',
185
+ 'test',
186
+ 'test:all',
187
+ 'test:all:db',
188
+ 'test:recent',
189
+ 'test:single',
190
+ 'test:uncommitted',
191
+ 'time:zones:all',
192
+ 'tmp:clear',
193
+ 'tmp:create'
194
+ ].join(',').freeze
195
+
196
+ DEFAULTS = {
197
+ :license_key => {
198
+ :default => '',
199
+ :public => true,
200
+ :type => String,
201
+ :description => "New Relic license key."
202
+ },
203
+ :log => {
204
+ :default => '',
205
+ :public => false,
206
+ :type => String,
207
+ :description => "Override to set log file name and path to STDOUT."
208
+ },
209
+ :omit_fake_collector => {
210
+ :default => false,
211
+ :public => false,
212
+ :type => Boolean,
213
+ :description => "Override to omit fake collector in multiverse tests."
214
+ },
215
+ :config_path => {
216
+ :default => DefaultSource.config_path,
217
+ :public => true,
218
+ :type => String,
219
+ :description => "Path to newrelic.yml. When omitted the agent will check (in order) 'config/newrelic.yml', 'newrelic.yml', $HOME/.newrelic/newrelic.yml' and $HOME/newrelic.yml."
220
+ },
221
+ :app_name => {
222
+ :default => DefaultSource.app_name,
223
+ :public => true,
224
+ :type => String,
225
+ :description => "Semicolon delimited list of application names where metrics will be recorded in the dashboard (e.g. 'MyApplication' or 'MyAppStaging;Instance1')."
226
+ },
227
+ :dispatcher => {
228
+ :default => DefaultSource.dispatcher,
229
+ :public => false,
230
+ :type => Symbol,
231
+ :description => 'Autodetected application component that reports metrics to New Relic.'
232
+ },
233
+ :framework => {
234
+ :default => DefaultSource.framework,
235
+ :public => false,
236
+ :type => Symbol,
237
+ :description => 'Autodetected application framework used to enable framework-specific functionality.'
238
+ },
239
+ :enabled => {
240
+ :default => true,
241
+ :public => false,
242
+ :type => Boolean,
243
+ :aliases => [:enable],
244
+ :description => 'Enable or disable the agent.'
245
+ },
246
+ :monitor_mode => {
247
+ :default => DefaultSource.monitor_mode,
248
+ :public => false,
249
+ :type => Boolean,
250
+ :description => 'Enable or disable transmission of data to the New Relic data collection service.'
251
+ },
252
+ :agent_enabled => {
253
+ :default => DefaultSource.agent_enabled,
254
+ :public => true,
255
+ :type => Boolean,
256
+ :description => 'Enable or disable the agent.'
257
+ },
258
+ :'autostart.blacklisted_constants' => {
259
+ :default => 'Rails::Console',
260
+ :public => true,
261
+ :type => String,
262
+ :description => "Comma delimited list of constants whose presence should prevent the agent from automatically starting (e.g. 'Rails::Console, UninstrumentedBackgroundJob')."
263
+ },
264
+ :'autostart.blacklisted_executables' => {
265
+ :default => 'irb,rspec',
266
+ :public => true,
267
+ :type => String,
268
+ :description => "Comma delimited list of executables that should not be instrumented by the agent (e.g. 'rake,my_ruby_script.rb')."
269
+ },
270
+ :'autostart.blacklisted_rake_tasks' => {
271
+ :default => AUTOSTART_BLACKLISTED_RAKE_TASKS,
272
+ :public => true,
273
+ :type => String,
274
+ :description => "Comma delimited list of rake tasks that should not be instrumented by the agent (e.g. 'assets:precompile,db:migrate')."
275
+ },
276
+ :developer_mode => {
277
+ :default => DefaultSource.developer_mode,
278
+ :public => true,
279
+ :type => Boolean,
280
+ :description => "Enable or disable developer mode, a local analytics package built into the agent for rack applications. Access developer mode analytics by visiting '/newrelic' in your application."
281
+ },
282
+ :developer => {
283
+ :default => false,
284
+ :public => false,
285
+ :type => Boolean,
286
+ :description => 'Alternative method of enabling developer_mode.'
287
+ },
288
+ :apdex_t => {
289
+ :default => 0.5,
290
+ :public => true,
291
+ :type => Float,
292
+ :description => 'Threshold at which New Relic will begin alerting. By default the agent will send alerts when the Apdex score drops below 0.5, or when more than half of users are experiencing degraded application performance.'
293
+ },
294
+ :monitor_daemons => {
295
+ :default => false,
296
+ :public => false,
297
+ :type => Boolean,
298
+ :description => 'Enables or disables the agent for background processes. No longer necessary as the agent now automatically instruments background processes.'
299
+ },
300
+ :multi_homed => {
301
+ :default => false,
302
+ :public => false,
303
+ :type => Boolean,
304
+ :description => 'Enable or disable instrumentation for multiple applications on the same host bound to different interfaces serving the same port.'
305
+ },
306
+ :high_security => {
307
+ :default => false,
308
+ :public => true,
309
+ :type => Boolean,
310
+ :description => 'Enable or disable security features designed to protect data in an enterprise setting.'
311
+ },
312
+ :'strip_exception_messages.enabled' => {
313
+ :default => DefaultSource.strip_exception_messages_enabled,
314
+ :public => true,
315
+ :type => Boolean,
316
+ :description => 'Enable or disable the stripping of messages from all exceptions that are not specified in the whitelist. Enabled automatically in high security mode.'
317
+ },
318
+ :'strip_exception_messages.whitelist' => {
319
+ :default => '',
320
+ :public => true,
321
+ :type => String,
322
+ :description => "Comma delimited list of exceptions that should not have their messages stripped when strip_exception_messages is enabled (e.g. 'ImportantException, PreserveMessageException')."
323
+ },
324
+ :host => {
325
+ :default => 'collector.newrelic.com',
326
+ :public => false,
327
+ :type => String,
328
+ :description => "URI for the New Relic data collection service."
329
+ },
330
+ :api_host => {
331
+ :default => 'rpm.newrelic.com',
332
+ :public => false,
333
+ :type => String,
334
+ :description => 'API host for New Relic.'
335
+ },
336
+ :port => {
337
+ :default => DefaultSource.port,
338
+ :public => false,
339
+ :type => Fixnum,
340
+ :description => 'Port for the New Relic data collection service.'
341
+ },
342
+ :api_port => {
343
+ :default => DefaultSource.api_port,
344
+ :public => false,
345
+ :type => Fixnum,
346
+ :description => 'Port for the New Relic API host.'
347
+ },
348
+ :ssl => {
349
+ :default => true,
350
+ :public => true,
351
+ :type => Boolean,
352
+ :description => "Enable or disable SSL for transmissions to the New Relic data collection service."
353
+ },
354
+ :sync_startup => {
355
+ :default => false,
356
+ :public => true,
357
+ :type => Boolean,
358
+ :description => 'Enable or disable synchronous connection to the New Relic data collection service during application startup.'
359
+ },
360
+ :send_data_on_exit => {
361
+ :default => true,
362
+ :public => true,
363
+ :type => Boolean,
364
+ :description => 'Enable or disable the exit handler that sends data to the New Relic data collection service before shutting down.'
365
+ },
366
+ :post_size_limit => {
367
+ :default => 2 * 1024 * 1024, # 2MB
368
+ :public => false,
369
+ :type => Fixnum,
370
+ :description => 'Maximum number of bytes to send to the New Relic data collection service.'
371
+ },
372
+ :timeout => {
373
+ :default => 2 * 60, # 2 minutes
374
+ :public => true,
375
+ :type => Fixnum,
376
+ :description => 'Maximum number of seconds to try and contact the New Relic data collection service.'
377
+ },
378
+ :force_send => {
379
+ :default => false,
380
+ :public => false,
381
+ :type => Boolean,
382
+ :description => 'Enable or disable the forced sending of data to the New Relic data collection service when shutting down.'
383
+ },
384
+ :send_environment_info => {
385
+ :default => true,
386
+ :public => false,
387
+ :type => Boolean,
388
+ :description => 'Enable or disable transmission of application environment information to the New Relic data collection service.'
389
+ },
390
+ :start_channel_listener => {
391
+ :default => false,
392
+ :public => false,
393
+ :type => Boolean,
394
+ :description => 'Enable or disable spawning of a background thread that listens for connections from child processes. Primarily used for Resque instrumentation.'
395
+ },
396
+ :data_report_period => {
397
+ :default => 60,
398
+ :public => false,
399
+ :type => Fixnum,
400
+ :description => 'Number of seconds betwixt connections to the New Relic data collection service.'
401
+ },
402
+ :keep_retrying => {
403
+ :default => true,
404
+ :public => false,
405
+ :type => Boolean,
406
+ :description => '(Deprecated) Enable or disable retrying failed connections to the New Relic data collection service.'
407
+ },
408
+ :report_instance_busy => {
409
+ :default => true,
410
+ :public => false,
411
+ :type => Boolean,
412
+ :description => 'Enable or disable transmission of metrics recording the percentage of time application instances spend servicing requests (duty cycle metrics).'
413
+ },
414
+ :log_file_name => {
415
+ :default => 'newrelic_agent.log',
416
+ :public => true,
417
+ :type => String,
418
+ :description => 'Filename of the agent log file.'
419
+ },
420
+ :log_file_path => {
421
+ :default => 'log/',
422
+ :public => true,
423
+ :type => String,
424
+ :description => 'Path to the agent log file, excluding the filename.'
425
+ },
426
+ :log_level => {
427
+ :default => 'info',
428
+ :public => true,
429
+ :type => String,
430
+ :description => 'Log level for agent logging: error, warn, info or debug.'
431
+ },
432
+ :'audit_log.enabled' => {
433
+ :default => false,
434
+ :public => true,
435
+ :type => Boolean,
436
+ :description => 'Enable or disable the audit log, a log of communications with the New Relic data collection service.'
437
+ },
438
+ :'audit_log.path' => {
439
+ :default => DefaultSource.audit_log_path,
440
+ :public => true,
441
+ :type => String,
442
+ :description => 'Path to the audit log file (including the filename).'
443
+ },
444
+ :disable_samplers => {
445
+ :default => false,
446
+ :public => true,
447
+ :type => Boolean,
448
+ :description => 'Enable or disable the collection of sampler metrics, metrics that are not event based (e.g. CPU time or memory usage).'
449
+ },
450
+ :disable_resque => {
451
+ :default => false,
452
+ :public => true,
453
+ :type => Boolean,
454
+ :description => 'Enable or disable resque instrumentation.'
455
+ },
456
+ :disable_dj => {
457
+ :default => false,
458
+ :public => true,
459
+ :type => Boolean,
460
+ :description => 'Enable or disable delayed job instrumentation.'
461
+ },
462
+ :disable_sinatra => {
463
+ :default => false,
464
+ :public => true,
465
+ :type => Boolean,
466
+ :description => 'Enable or disable sinatra instrumentation.'
467
+ },
468
+ :disable_sinatra_auto_middleware => {
469
+ :default => false,
470
+ :public => true,
471
+ :type => Boolean,
472
+ :description => 'Enable or disable agent middleware for sinatra. This middleware is responsible for instrumenting advanced feature support for sinatra (e.g. Cross-application tracing, Real User Monitoring, Error collection).'
473
+ },
474
+ :disable_view_instrumentation => {
475
+ :default => false,
476
+ :public => true,
477
+ :type => Boolean,
478
+ :description => 'Enable or disable view instrumentation.'
479
+ },
480
+ :disable_backtrace_cleanup => {
481
+ :default => false,
482
+ :public => true,
483
+ :type => Boolean,
484
+ :description => 'Enable or disable removal of newrelic_rpm from backtraces.'
485
+ },
486
+ :disable_harvest_thread => {
487
+ :default => false,
488
+ :public => false,
489
+ :type => Boolean,
490
+ :description => 'Enable or disable the harvest thread.'
491
+ },
492
+ :skip_ar_instrumentation => {
493
+ :default => false,
494
+ :public => false,
495
+ :type => Boolean,
496
+ :description => 'Enable or disable active record instrumentation.'
497
+ },
498
+ :disable_activerecord_instrumentation => {
499
+ :default => DefaultSource.disable_activerecord_instrumentation,
500
+ :public => true,
501
+ :type => Boolean,
502
+ :description => 'Enable or disable active record instrumentation.'
503
+ },
504
+ :disable_memcache_instrumentation => {
505
+ :default => false,
506
+ :public => true,
507
+ :type => Boolean,
508
+ :description => 'Enable or disable memcache instrumentation.'
509
+ },
510
+ :disable_mobile_headers => {
511
+ :default => true,
512
+ :public => false,
513
+ :type => Boolean,
514
+ :description => 'Enable or disable injection of mobile response headers when mobile headers are present in the incoming request.'
515
+ },
516
+ :capture_params => {
517
+ :default => false,
518
+ :public => true,
519
+ :type => Boolean,
520
+ :description => 'Enable or disable capturing and attachment of HTTP request parameters to transaction traces and traced errors.'
521
+ },
522
+ :capture_memcache_keys => {
523
+ :default => false,
524
+ :public => true,
525
+ :type => Boolean,
526
+ :description => 'Enable or disable capturing and attachment of memcache keys to transaction traces.'
527
+ },
528
+ :textmate => {
529
+ :default => false,
530
+ :public => false,
531
+ :type => Boolean,
532
+ :description => 'Enables Textmate integration.'
533
+ },
534
+ :'transaction_tracer.enabled' => {
535
+ :default => true,
536
+ :public => true,
537
+ :type => Boolean,
538
+ :description => 'Enable or disable transaction tracer.'
539
+ },
540
+ :'transaction_tracer.transaction_threshold' => {
541
+ :default => DefaultSource.transaction_tracer_transaction_threshold,
542
+ :public => true,
543
+ :type => Float,
544
+ :description => 'Transaction traces will be generated for transactions that exceed this threshold.'
545
+ },
546
+ :'transaction_tracer.stack_trace_threshold' => {
547
+ :default => 0.5,
548
+ :public => true,
549
+ :type => Float,
550
+ :description => 'Stack traces will be included in transaction trace segments with durations that exceed this threshold.'
551
+ },
552
+ :'transaction_tracer.explain_threshold' => {
553
+ :default => 0.5,
554
+ :public => true,
555
+ :type => Float,
556
+ :description => 'Explain plans will be generated and included in transaction trace segments with durations that exceed this threshold.'
557
+ },
558
+ :'transaction_tracer.explain_enabled' => {
559
+ :default => true,
560
+ :public => true,
561
+ :type => Boolean,
562
+ :description => 'Enable or disable the generation and inclusion of explain queries in transaction trace segments.'
563
+ },
564
+ :'transaction_tracer.record_sql' => {
565
+ :default => 'obfuscated',
566
+ :public => true,
567
+ :type => String,
568
+ :description => "Obfuscation level for sql queries reported in transaction trace segments (e.g. 'obfuscated', 'raw', 'none')."
569
+ },
570
+ :'transaction_tracer.limit_segments' => {
571
+ :default => 4000,
572
+ :public => true,
573
+ :type => Fixnum,
574
+ :description => 'Maximum number of transaction trace segments to record in a single transaction trace.'
575
+ },
576
+ :'transaction_tracer.random_sample' => {
577
+ :default => false,
578
+ :public => false,
579
+ :type => Boolean,
580
+ :description => 'Enable or disable the collection of a random transaction trace during each harvest cycle in addition to the longest transaction trace.'
581
+ },
582
+ :sample_rate => {
583
+ :default => 10,
584
+ :public => false,
585
+ :type => Fixnum,
586
+ :description => 'Number of harvests between random transaction trace samples in the transaction sampler.'
587
+ },
588
+ :'slow_sql.enabled' => {
589
+ :default => DefaultSource.slow_sql_enabled,
590
+ :public => true,
591
+ :type => Boolean,
592
+ :description => 'Enable or disable collection of slow sql queries.'
593
+ },
594
+ :'slow_sql.stack_trace_threshold' => {
595
+ :default => DefaultSource.slow_sql_stack_trace_threshold,
596
+ :public => true,
597
+ :type => Float,
598
+ :description => 'Stack traces will be generated and included in slow sql queries with durations that exceed this threshold.'
599
+ },
600
+ :'slow_sql.explain_threshold' => {
601
+ :default => DefaultSource.slow_sql_explain_threshold,
602
+ :public => true,
603
+ :type => Float,
604
+ :description => 'Explain plans will be generated and included in slow sql queries with durations that exceed this threshold.'
605
+ },
606
+ :'slow_sql.explain_enabled' => {
607
+ :default => DefaultSource.slow_sql_explain_enabled,
608
+ :public => true,
609
+ :type => Boolean,
610
+ :description => 'Enable or disable the generation and inclusion of explain plans in slow sql queries.'
611
+ },
612
+ :'slow_sql.record_sql' => {
613
+ :default => DefaultSource.slow_sql_record_sql,
614
+ :public => true,
615
+ :type => String,
616
+ :description => "Obfuscation level for slow sql queries (e.g. 'obfuscated', 'raw', 'none')."
617
+ },
618
+ :'error_collector.enabled' => {
619
+ :default => true,
620
+ :public => true,
621
+ :type => Boolean,
622
+ :description => 'Enable or disable recording of traced errors and error count metrics.'
623
+ },
624
+ :'error_collector.capture_source' => {
625
+ :default => true,
626
+ :public => true,
627
+ :type => Boolean,
628
+ :description => 'Enable or disable collection of source code for errors that support it.'
629
+ },
630
+ :'error_collector.ignore_errors' => {
631
+ :default => 'ActionController::RoutingError,Sinatra::NotFound',
632
+ :public => true,
633
+ :type => String,
634
+ :description => 'Comma delimited list of error classes that should be ignored.'
635
+ },
636
+ :'rum.enabled' => {
637
+ :default => true,
638
+ :public => true,
639
+ :type => Boolean,
640
+ :description => 'Enable or disable real user monitoring.'
641
+ },
642
+ :'rum.jsonp' => {
643
+ :default => true,
644
+ :public => false,
645
+ :type => Boolean,
646
+ :description => 'Enable or disable jsonp as the default means of communicating with the beacon.'
647
+ },
648
+ :'rum.load_episodes_file' => {
649
+ :default => true,
650
+ :public => false,
651
+ :type => Boolean,
652
+ :description => 'Enable or disable real user monitoring.'
653
+ },
654
+ :'browser_monitoring.auto_instrument' => {
655
+ :default => DefaultSource.browser_monitoring_auto_instrument,
656
+ :public => true,
657
+ :type => Boolean,
658
+ :description => 'Enable or disable automatic insertion of the real user monitoring header and footer into outgoing responses.'
659
+ },
660
+ :trusted_account_ids => {
661
+ :default => [],
662
+ :public => false,
663
+ :type => Array,
664
+ :description => 'List of trusted New Relic account IDs for the purposes of cross-application tracing. Inbound requests from applications including cross-application headers that do not come from an account in this list will be ignored.'
665
+ },
666
+ :"cross_application_tracer.enabled" => {
667
+ :default => true,
668
+ :public => true,
669
+ :type => Boolean,
670
+ :description => 'Enable or disable cross-application tracing.'
671
+ },
672
+ :'thread_profiler.enabled' => {
673
+ :default => DefaultSource.thread_profiler_enabled,
674
+ :public => true,
675
+ :type => Boolean,
676
+ :description => 'Enable or disable the thread profiler.'
677
+ },
678
+ :marshaller => {
679
+ :default => DefaultSource.marshaller,
680
+ :public => true,
681
+ :type => String,
682
+ :description => 'Marshaller to use when marshalling data for transmission to the New Relic data collection service (e.g json, pruby).'
683
+ },
684
+ :'request_sampler.enabled' => {
685
+ :default => true,
686
+ :public => true,
687
+ :type => Boolean,
688
+ :description => 'Enable or disable the request sampler.'
689
+ },
690
+ :'request_sampler.max_samples' => {
691
+ :default => 1200,
692
+ :public => false,
693
+ :type => Fixnum,
694
+ :description => 'Maximum number of request events recorded by the request sampler in a single harvest.'
695
+ },
696
+ }.freeze
697
+
698
+ end
699
+ end
700
+ end