wd_newrelic_rpm 3.3.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (264) hide show
  1. data/CHANGELOG +591 -0
  2. data/LICENSE +64 -0
  3. data/README.rdoc +179 -0
  4. data/bin/mongrel_rpm +33 -0
  5. data/bin/newrelic +13 -0
  6. data/bin/newrelic_cmd +5 -0
  7. data/cert/cacert.pem +118 -0
  8. data/cert/oldsite.pem +28 -0
  9. data/cert/site.pem +27 -0
  10. data/install.rb +9 -0
  11. data/lib/conditional_vendored_dependency_detection.rb +3 -0
  12. data/lib/conditional_vendored_metric_parser.rb +5 -0
  13. data/lib/new_relic/agent.rb +467 -0
  14. data/lib/new_relic/agent/agent.rb +1325 -0
  15. data/lib/new_relic/agent/beacon_configuration.rb +121 -0
  16. data/lib/new_relic/agent/browser_monitoring.rb +142 -0
  17. data/lib/new_relic/agent/busy_calculator.rb +99 -0
  18. data/lib/new_relic/agent/chained_call.rb +13 -0
  19. data/lib/new_relic/agent/database.rb +223 -0
  20. data/lib/new_relic/agent/error_collector.rb +251 -0
  21. data/lib/new_relic/agent/instrumentation.rb +9 -0
  22. data/lib/new_relic/agent/instrumentation/active_merchant.rb +29 -0
  23. data/lib/new_relic/agent/instrumentation/active_record.rb +137 -0
  24. data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +68 -0
  25. data/lib/new_relic/agent/instrumentation/authlogic.rb +19 -0
  26. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +443 -0
  27. data/lib/new_relic/agent/instrumentation/data_mapper.rb +238 -0
  28. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +52 -0
  29. data/lib/new_relic/agent/instrumentation/memcache.rb +80 -0
  30. data/lib/new_relic/agent/instrumentation/merb/controller.rb +41 -0
  31. data/lib/new_relic/agent/instrumentation/merb/errors.rb +29 -0
  32. data/lib/new_relic/agent/instrumentation/metric_frame.rb +353 -0
  33. data/lib/new_relic/agent/instrumentation/metric_frame/pop.rb +80 -0
  34. data/lib/new_relic/agent/instrumentation/net.rb +29 -0
  35. data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +37 -0
  36. data/lib/new_relic/agent/instrumentation/queue_time.rb +210 -0
  37. data/lib/new_relic/agent/instrumentation/rack.rb +98 -0
  38. data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +114 -0
  39. data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +42 -0
  40. data/lib/new_relic/agent/instrumentation/rails/errors.rb +42 -0
  41. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +180 -0
  42. data/lib/new_relic/agent/instrumentation/rails3/errors.rb +37 -0
  43. data/lib/new_relic/agent/instrumentation/sinatra.rb +78 -0
  44. data/lib/new_relic/agent/instrumentation/sunspot.rb +29 -0
  45. data/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb +21 -0
  46. data/lib/new_relic/agent/method_tracer.rb +528 -0
  47. data/lib/new_relic/agent/sampler.rb +50 -0
  48. data/lib/new_relic/agent/samplers/cpu_sampler.rb +58 -0
  49. data/lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb +40 -0
  50. data/lib/new_relic/agent/samplers/memory_sampler.rb +143 -0
  51. data/lib/new_relic/agent/samplers/object_sampler.rb +26 -0
  52. data/lib/new_relic/agent/shim_agent.rb +29 -0
  53. data/lib/new_relic/agent/sql_sampler.rb +286 -0
  54. data/lib/new_relic/agent/stats_engine.rb +26 -0
  55. data/lib/new_relic/agent/stats_engine/gc_profiler.rb +123 -0
  56. data/lib/new_relic/agent/stats_engine/metric_stats.rb +187 -0
  57. data/lib/new_relic/agent/stats_engine/samplers.rb +95 -0
  58. data/lib/new_relic/agent/stats_engine/transactions.rb +125 -0
  59. data/lib/new_relic/agent/transaction_info.rb +74 -0
  60. data/lib/new_relic/agent/transaction_sample_builder.rb +116 -0
  61. data/lib/new_relic/agent/transaction_sampler.rb +468 -0
  62. data/lib/new_relic/agent/worker_loop.rb +89 -0
  63. data/lib/new_relic/collection_helper.rb +77 -0
  64. data/lib/new_relic/command.rb +85 -0
  65. data/lib/new_relic/commands/deployments.rb +105 -0
  66. data/lib/new_relic/commands/install.rb +80 -0
  67. data/lib/new_relic/control.rb +46 -0
  68. data/lib/new_relic/control/class_methods.rb +53 -0
  69. data/lib/new_relic/control/configuration.rb +206 -0
  70. data/lib/new_relic/control/frameworks.rb +10 -0
  71. data/lib/new_relic/control/frameworks/external.rb +16 -0
  72. data/lib/new_relic/control/frameworks/merb.rb +31 -0
  73. data/lib/new_relic/control/frameworks/rails.rb +164 -0
  74. data/lib/new_relic/control/frameworks/rails3.rb +75 -0
  75. data/lib/new_relic/control/frameworks/ruby.rb +42 -0
  76. data/lib/new_relic/control/frameworks/sinatra.rb +20 -0
  77. data/lib/new_relic/control/instance_methods.rb +179 -0
  78. data/lib/new_relic/control/instrumentation.rb +100 -0
  79. data/lib/new_relic/control/logging_methods.rb +143 -0
  80. data/lib/new_relic/control/profiling.rb +25 -0
  81. data/lib/new_relic/control/server_methods.rb +114 -0
  82. data/lib/new_relic/data_serialization.rb +151 -0
  83. data/lib/new_relic/delayed_job_injection.rb +51 -0
  84. data/lib/new_relic/language_support.rb +73 -0
  85. data/lib/new_relic/local_environment.rb +428 -0
  86. data/lib/new_relic/merbtasks.rb +6 -0
  87. data/lib/new_relic/metric_data.rb +51 -0
  88. data/lib/new_relic/metric_spec.rb +76 -0
  89. data/lib/new_relic/metrics.rb +9 -0
  90. data/lib/new_relic/noticed_error.rb +29 -0
  91. data/lib/new_relic/rack/browser_monitoring.rb +76 -0
  92. data/lib/new_relic/rack/developer_mode.rb +268 -0
  93. data/lib/new_relic/recipes.rb +77 -0
  94. data/lib/new_relic/stats.rb +335 -0
  95. data/lib/new_relic/timer_lib.rb +27 -0
  96. data/lib/new_relic/transaction_analysis.rb +77 -0
  97. data/lib/new_relic/transaction_analysis/segment_summary.rb +49 -0
  98. data/lib/new_relic/transaction_sample.rb +261 -0
  99. data/lib/new_relic/transaction_sample/composite_segment.rb +27 -0
  100. data/lib/new_relic/transaction_sample/fake_segment.rb +9 -0
  101. data/lib/new_relic/transaction_sample/segment.rb +203 -0
  102. data/lib/new_relic/transaction_sample/summary_segment.rb +21 -0
  103. data/lib/new_relic/url_rule.rb +14 -0
  104. data/lib/new_relic/version.rb +55 -0
  105. data/lib/newrelic_rpm.rb +49 -0
  106. data/lib/tasks/all.rb +4 -0
  107. data/lib/tasks/install.rake +7 -0
  108. data/lib/tasks/tests.rake +19 -0
  109. data/newrelic.yml +265 -0
  110. data/newrelic_rpm.gemspec +312 -0
  111. data/recipes/newrelic.rb +6 -0
  112. data/test/active_record_fixtures.rb +77 -0
  113. data/test/config/newrelic.yml +48 -0
  114. data/test/config/test_control.rb +48 -0
  115. data/test/fixtures/proc_cpuinfo.txt +575 -0
  116. data/test/new_relic/agent/agent/connect_test.rb +403 -0
  117. data/test/new_relic/agent/agent/start_test.rb +255 -0
  118. data/test/new_relic/agent/agent/start_worker_thread_test.rb +153 -0
  119. data/test/new_relic/agent/agent_test.rb +140 -0
  120. data/test/new_relic/agent/agent_test_controller.rb +77 -0
  121. data/test/new_relic/agent/agent_test_controller_test.rb +382 -0
  122. data/test/new_relic/agent/apdex_from_server_test.rb +9 -0
  123. data/test/new_relic/agent/beacon_configuration_test.rb +111 -0
  124. data/test/new_relic/agent/browser_monitoring_test.rb +323 -0
  125. data/test/new_relic/agent/busy_calculator_test.rb +81 -0
  126. data/test/new_relic/agent/database_test.rb +149 -0
  127. data/test/new_relic/agent/error_collector/notice_error_test.rb +257 -0
  128. data/test/new_relic/agent/error_collector_test.rb +192 -0
  129. data/test/new_relic/agent/instrumentation/active_record_instrumentation_test.rb +576 -0
  130. data/test/new_relic/agent/instrumentation/controller_instrumentation_test.rb +34 -0
  131. data/test/new_relic/agent/instrumentation/instrumentation_test.rb +11 -0
  132. data/test/new_relic/agent/instrumentation/metric_frame/pop_test.rb +171 -0
  133. data/test/new_relic/agent/instrumentation/metric_frame_test.rb +50 -0
  134. data/test/new_relic/agent/instrumentation/net_instrumentation_test.rb +84 -0
  135. data/test/new_relic/agent/instrumentation/queue_time_test.rb +382 -0
  136. data/test/new_relic/agent/instrumentation/rack_test.rb +35 -0
  137. data/test/new_relic/agent/instrumentation/task_instrumentation_test.rb +184 -0
  138. data/test/new_relic/agent/memcache_instrumentation_test.rb +143 -0
  139. data/test/new_relic/agent/method_tracer/class_methods/add_method_tracer_test.rb +164 -0
  140. data/test/new_relic/agent/method_tracer/instance_methods/trace_execution_scoped_test.rb +234 -0
  141. data/test/new_relic/agent/method_tracer_test.rb +386 -0
  142. data/test/new_relic/agent/mock_scope_listener.rb +23 -0
  143. data/test/new_relic/agent/rpm_agent_test.rb +149 -0
  144. data/test/new_relic/agent/sampler_test.rb +19 -0
  145. data/test/new_relic/agent/shim_agent_test.rb +20 -0
  146. data/test/new_relic/agent/sql_sampler_test.rb +192 -0
  147. data/test/new_relic/agent/stats_engine/metric_stats/harvest_test.rb +150 -0
  148. data/test/new_relic/agent/stats_engine/metric_stats_test.rb +82 -0
  149. data/test/new_relic/agent/stats_engine/samplers_test.rb +99 -0
  150. data/test/new_relic/agent/stats_engine_test.rb +220 -0
  151. data/test/new_relic/agent/transaction_info_test.rb +13 -0
  152. data/test/new_relic/agent/transaction_sample_builder_test.rb +219 -0
  153. data/test/new_relic/agent/transaction_sampler_test.rb +967 -0
  154. data/test/new_relic/agent/worker_loop_test.rb +66 -0
  155. data/test/new_relic/agent_test.rb +187 -0
  156. data/test/new_relic/collection_helper_test.rb +149 -0
  157. data/test/new_relic/command/deployments_test.rb +68 -0
  158. data/test/new_relic/control/class_methods_test.rb +62 -0
  159. data/test/new_relic/control/configuration_test.rb +84 -0
  160. data/test/new_relic/control/logging_methods_test.rb +185 -0
  161. data/test/new_relic/control_test.rb +256 -0
  162. data/test/new_relic/data_serialization_test.rb +208 -0
  163. data/test/new_relic/delayed_job_injection_test.rb +16 -0
  164. data/test/new_relic/local_environment_test.rb +85 -0
  165. data/test/new_relic/metric_data_test.rb +125 -0
  166. data/test/new_relic/metric_parser/metric_parser_test.rb +11 -0
  167. data/test/new_relic/metric_spec_test.rb +95 -0
  168. data/test/new_relic/rack/all_test.rb +11 -0
  169. data/test/new_relic/rack/browser_monitoring_test.rb +142 -0
  170. data/test/new_relic/rack/developer_mode_helper_test.rb +141 -0
  171. data/test/new_relic/rack/developer_mode_test.rb +74 -0
  172. data/test/new_relic/stats_test.rb +411 -0
  173. data/test/new_relic/transaction_analysis/segment_summary_test.rb +91 -0
  174. data/test/new_relic/transaction_analysis_test.rb +121 -0
  175. data/test/new_relic/transaction_sample/composite_segment_test.rb +35 -0
  176. data/test/new_relic/transaction_sample/fake_segment_test.rb +17 -0
  177. data/test/new_relic/transaction_sample/segment_test.rb +389 -0
  178. data/test/new_relic/transaction_sample/summary_segment_test.rb +31 -0
  179. data/test/new_relic/transaction_sample_subtest_test.rb +56 -0
  180. data/test/new_relic/transaction_sample_test.rb +177 -0
  181. data/test/new_relic/version_number_test.rb +89 -0
  182. data/test/script/build_test_gem.sh +51 -0
  183. data/test/script/ci.sh +94 -0
  184. data/test/script/ci_bench.sh +52 -0
  185. data/test/test_contexts.rb +29 -0
  186. data/test/test_helper.rb +155 -0
  187. data/ui/helpers/developer_mode_helper.rb +357 -0
  188. data/ui/helpers/google_pie_chart.rb +48 -0
  189. data/ui/views/layouts/newrelic_default.rhtml +47 -0
  190. data/ui/views/newrelic/_explain_plans.rhtml +27 -0
  191. data/ui/views/newrelic/_sample.rhtml +20 -0
  192. data/ui/views/newrelic/_segment.rhtml +28 -0
  193. data/ui/views/newrelic/_segment_limit_message.rhtml +1 -0
  194. data/ui/views/newrelic/_segment_row.rhtml +12 -0
  195. data/ui/views/newrelic/_show_sample_detail.rhtml +24 -0
  196. data/ui/views/newrelic/_show_sample_sql.rhtml +24 -0
  197. data/ui/views/newrelic/_show_sample_summary.rhtml +3 -0
  198. data/ui/views/newrelic/_sql_row.rhtml +16 -0
  199. data/ui/views/newrelic/_stack_trace.rhtml +15 -0
  200. data/ui/views/newrelic/_table.rhtml +12 -0
  201. data/ui/views/newrelic/explain_sql.rhtml +43 -0
  202. data/ui/views/newrelic/file/images/arrow-close.png +0 -0
  203. data/ui/views/newrelic/file/images/arrow-open.png +0 -0
  204. data/ui/views/newrelic/file/images/blue_bar.gif +0 -0
  205. data/ui/views/newrelic/file/images/file_icon.png +0 -0
  206. data/ui/views/newrelic/file/images/gray_bar.gif +0 -0
  207. data/ui/views/newrelic/file/images/new-relic-rpm-desktop.gif +0 -0
  208. data/ui/views/newrelic/file/images/new_relic_rpm_desktop.gif +0 -0
  209. data/ui/views/newrelic/file/images/textmate.png +0 -0
  210. data/ui/views/newrelic/file/javascript/jquery-1.4.2.js +6240 -0
  211. data/ui/views/newrelic/file/javascript/transaction_sample.js +120 -0
  212. data/ui/views/newrelic/file/stylesheets/style.css +490 -0
  213. data/ui/views/newrelic/index.rhtml +71 -0
  214. data/ui/views/newrelic/sample_not_found.rhtml +2 -0
  215. data/ui/views/newrelic/show_sample.rhtml +80 -0
  216. data/ui/views/newrelic/show_source.rhtml +3 -0
  217. data/ui/views/newrelic/threads.rhtml +53 -0
  218. data/vendor/gems/dependency_detection-0.0.1.build/LICENSE +5 -0
  219. data/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb +67 -0
  220. data/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection/version.rb +3 -0
  221. data/vendor/gems/metric_parser-0.1.0.pre1/lib/metric_parser.rb +1 -0
  222. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser.rb +64 -0
  223. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/action_mailer.rb +14 -0
  224. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/active_merchant.rb +31 -0
  225. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/active_record.rb +33 -0
  226. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/apdex.rb +89 -0
  227. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/background_transaction.rb +7 -0
  228. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/client.rb +46 -0
  229. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb +67 -0
  230. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller_cpu.rb +43 -0
  231. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller_ext.rb +17 -0
  232. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/database.rb +48 -0
  233. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/database_pool.rb +24 -0
  234. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/dot_net.rb +28 -0
  235. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/dot_net_parser.rb +17 -0
  236. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/errors.rb +11 -0
  237. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/external.rb +55 -0
  238. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/frontend.rb +40 -0
  239. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/gc.rb +20 -0
  240. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/hibernate_session.rb +7 -0
  241. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/java.rb +31 -0
  242. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/java_parser.rb +17 -0
  243. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/jsp.rb +34 -0
  244. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/jsp_tag.rb +7 -0
  245. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/mem_cache.rb +55 -0
  246. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/metric_parser.rb +135 -0
  247. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/orm.rb +27 -0
  248. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/other_transaction.rb +40 -0
  249. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet.rb +7 -0
  250. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet_context_listener.rb +7 -0
  251. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet_filter.rb +7 -0
  252. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/solr.rb +27 -0
  253. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/solr_request_handler.rb +15 -0
  254. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/spring.rb +54 -0
  255. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/spring_controller.rb +6 -0
  256. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/spring_view.rb +6 -0
  257. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/struts_action.rb +20 -0
  258. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/struts_result.rb +20 -0
  259. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/version.rb +5 -0
  260. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb +70 -0
  261. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_frontend.rb +18 -0
  262. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_service.rb +14 -0
  263. data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_transaction.rb +133 -0
  264. metadata +376 -0
@@ -0,0 +1,27 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIEmTCCA4GgAwIBAgICdPYwDQYJKoZIhvcNAQEFBQAwQDELMAkGA1UEBhMCVVMx
3
+ FzAVBgNVBAoTDkdlb1RydXN0LCBJbmMuMRgwFgYDVQQDEw9HZW9UcnVzdCBTU0wg
4
+ Q0EwHhcNMTEwMzExMTExNTEzWhcNMTMwMzEzMDUyMjU1WjCBrDEpMCcGA1UEBRMg
5
+ M0VrS1FSNFN5Vk5SZjQtdkJaMUZMUEhENnZWNzhLdUoxCzAJBgNVBAYTAlVTMRMw
6
+ EQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMRYwFAYD
7
+ VQQKEw1OZXcgUmVsaWMgSW5jMRQwEgYDVQQLEwtFbmdpbmVlcmluZzEXMBUGA1UE
8
+ AwwOKi5uZXdyZWxpYy5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
9
+ AQC4eLGubSgkxRrusVqnI7FmWxp2cS0hjeBFdzjYF3heRWzyerrP74UjbW/3lDV2
10
+ L7mKD6AKL51wPBC+xRtVXI+8SoWLyaO3k9pJEXIiNw8RVl9s9CAiiam3KCgFw+U1
11
+ B8RiZm1xYlbxGAb6XoxJXOx3Sld61ko5ZU/tV5Gs75Vnyt5RxLINoMKl8Dk0C2Z/
12
+ piS8pzoePgTJHEoL/aU9bnCyv2BxdhfIpvBVzvpr79JJ2mo/6gr/ODZWBLIflVPj
13
+ 4D+VE4so/Nt5pkTelRsyX8IL/xYb9lIQ+FJqjXksFy+NaR77afNUug3wUXwpkBjc
14
+ KF4TlxTXHadUUURJAyZN/zrlAgMBAAGjggEuMIIBKjAfBgNVHSMEGDAWgBRCeVQb
15
+ Yc1VKz5j1TxIV/Wf+0XOSjAOBgNVHQ8BAf8EBAMCBaAwHQYDVR0lBBYwFAYIKwYB
16
+ BQUHAwEGCCsGAQUFBwMCMCcGA1UdEQQgMB6CDioubmV3cmVsaWMuY29tggxuZXdy
17
+ ZWxpYy5jb20wPQYDVR0fBDYwNDAyoDCgLoYsaHR0cDovL2d0c3NsLWNybC5nZW90
18
+ cnVzdC5jb20vY3Jscy9ndHNzbC5jcmwwHQYDVR0OBBYEFIGySnbWmSQHcvbson/A
19
+ hDGIuIamMAwGA1UdEwEB/wQCMAAwQwYIKwYBBQUHAQEENzA1MDMGCCsGAQUFBzAC
20
+ hidodHRwOi8vZ3Rzc2wtYWlhLmdlb3RydXN0LmNvbS9ndHNzbC5jcnQwDQYJKoZI
21
+ hvcNAQEFBQADggEBAHuO8i5vPkZfPhT1a9GCn49J8Ada+faVpGnZ0nE3ufqhD52d
22
+ dZaVyUgft+2s+ksxIGjCwl3X+jeLfOL+dqqt77E1JRAskrCIfFHeQDS/7P6Ch3pE
23
+ zm8uTkMARuRARSi+O0jwTfYH5ApRb7eumgtz8sELg94yPCAKeegrK0zqhNGF6Bnp
24
+ tuSN36tUDtZb1Xy+sz6RzNpQJS/b1KH7e+jbEudctO8b6mP8/5bGoDcWQqPn4YWd
25
+ UAkOShAeRtdc0jsn62VlqDEfQQ16CsmD1Hoh9Mxhwj9rSqwpDSc9f0isJ6xypDhM
26
+ 4cNwyeIvhj++8Ir5LdCmWGLcUtNqUs4jK36ph7k=
27
+ -----END CERTIFICATE-----
@@ -0,0 +1,9 @@
1
+ if __FILE__ == $0 || $0 =~ /script\/plugin/
2
+ $LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), 'lib'))
3
+ require 'new_relic/command'
4
+ begin
5
+ NewRelic::Command::Install.new(:quiet => true, :app_name => 'My Application').run
6
+ rescue NewRelic::Command::CommandFailure => e
7
+ $stderr.puts e.message
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ path = File.expand_path('../vendor/gems/dependency_detection-0.0.1.build/lib', File.dirname(__FILE__))
2
+ $LOAD_PATH << path unless $LOAD_PATH.include?(path)
3
+ require 'dependency_detection'
@@ -0,0 +1,5 @@
1
+ unless defined?(NewRelic) && defined?(NewRelic::MetricParser)
2
+ vendored_metric_parser = File.expand_path('../../vendor/gems/metric_parser-0.1.0.pre1/lib/', __FILE__)
3
+ $:.unshift vendored_metric_parser unless $:.include?(vendored_metric_parser)
4
+ require 'metric_parser'
5
+ end
@@ -0,0 +1,467 @@
1
+ require 'new_relic/control'
2
+ require 'new_relic/data_serialization'
3
+ # = New Relic Ruby Agent
4
+ #
5
+ # New Relic is a performance monitoring application for applications
6
+ # running in production. For more information on New Relic please visit
7
+ # http://www.newrelic.com.
8
+ #
9
+ # The New Relic Ruby Agent can be installed in Rails applications to
10
+ # gather runtime performance metrics, traces, and errors for display
11
+ # in a Developer Mode middleware (mapped to /newrelic in your application
12
+ # server) or for monitoring and analysis at http://rpm.newrelic.com
13
+ # with just about any Ruby application.
14
+ #
15
+ # == Getting Started
16
+ # For instructions on installation and setup, see
17
+ # the README[link:./files/README_rdoc.html] file.
18
+ #
19
+ # == Using with Rack/Metal
20
+ #
21
+ # To instrument Rack middlwares or Metal apps, refer to the docs in
22
+ # NewRelic::Agent::Instrumentation::Rack.
23
+ #
24
+ # == Ruby Agent API
25
+ #
26
+ # For details on the Ruby Agent API, refer to NewRelic::Agent.
27
+ #
28
+ # == Customizing the Ruby Agent
29
+ #
30
+ # For detailed information on customizing the Ruby Agent
31
+ # please visit our {support and documentation site}[http://support.newrelic.com].
32
+ #
33
+ module NewRelic
34
+ # == Ruby Agent APIs
35
+ # This module contains the public API methods for the Ruby Agent.
36
+ #
37
+ # For adding custom instrumentation to method invocations, refer to
38
+ # the docs in the class NewRelic::Agent::MethodTracer.
39
+ #
40
+ # For information on how to customize the controller
41
+ # instrumentation, or to instrument something other than Rails so
42
+ # that high level dispatcher actions or background tasks show up as
43
+ # first class operations in New Relic, refer to
44
+ # NewRelic::Agent::Instrumentation::ControllerInstrumentation and
45
+ # NewRelic::Agent::Instrumentation::ControllerInstrumentation::ClassMethods.
46
+ #
47
+ # Methods in this module as well as documented methods in
48
+ # NewRelic::Agent::MethodTracer and
49
+ # NewRelic::Agent::Instrumentation::ControllerInstrumentation are
50
+ # available to applications. When the agent is not enabled the
51
+ # method implementations are stubbed into no-ops to reduce overhead.
52
+ #
53
+ # Methods and classes in other parts of the agent are not guaranteed
54
+ # to be available between releases.
55
+ #
56
+ # Refer to the online docs at support.newrelic.com to see how to
57
+ # access the data collected by custom instrumentation, or e-mail
58
+ # support at New Relic for help.
59
+ module Agent
60
+ extend self
61
+
62
+ require 'new_relic/version'
63
+ require 'new_relic/local_environment'
64
+ require 'new_relic/stats'
65
+ require 'new_relic/metrics'
66
+ require 'new_relic/metric_spec'
67
+ require 'new_relic/metric_data'
68
+ require 'new_relic/collection_helper'
69
+ require 'new_relic/transaction_analysis'
70
+ require 'new_relic/transaction_sample'
71
+ require 'new_relic/url_rule'
72
+ require 'new_relic/noticed_error'
73
+ require 'new_relic/timer_lib'
74
+
75
+ require 'new_relic/agent'
76
+ require 'new_relic/agent/chained_call'
77
+ require 'new_relic/agent/browser_monitoring'
78
+ require 'new_relic/agent/agent'
79
+ require 'new_relic/agent/shim_agent'
80
+ require 'new_relic/agent/method_tracer'
81
+ require 'new_relic/agent/worker_loop'
82
+ require 'new_relic/agent/stats_engine'
83
+ require 'new_relic/agent/transaction_sampler'
84
+ require 'new_relic/agent/sql_sampler'
85
+ require 'new_relic/agent/error_collector'
86
+ require 'new_relic/agent/busy_calculator'
87
+ require 'new_relic/agent/sampler'
88
+ require 'new_relic/agent/database'
89
+ require 'new_relic/agent/transaction_info'
90
+
91
+ require 'new_relic/agent/instrumentation/controller_instrumentation'
92
+
93
+ require 'new_relic/agent/samplers/cpu_sampler'
94
+ require 'new_relic/agent/samplers/memory_sampler'
95
+ require 'new_relic/agent/samplers/object_sampler'
96
+ require 'new_relic/agent/samplers/delayed_job_lock_sampler'
97
+ require 'set'
98
+ require 'thread'
99
+ require 'resolv'
100
+
101
+ # An exception that is thrown by the server if the agent license is invalid.
102
+ class LicenseException < StandardError; end
103
+
104
+ # An exception that forces an agent to stop reporting until its mongrel is restarted.
105
+ class ForceDisconnectException < StandardError; end
106
+
107
+ # An exception that forces an agent to restart.
108
+ class ForceRestartException < StandardError; end
109
+
110
+ # Used to blow out of a periodic task without logging a an error, such as for routine
111
+ # failures.
112
+ class ServerConnectionException < StandardError; end
113
+
114
+ # Used for when a transaction trace or error report has too much
115
+ # data, so we reset the queue to clear the extra-large item
116
+ class PostTooBigException < ServerConnectionException; end
117
+
118
+ # Reserved for future use. Meant to represent a problem on the server side.
119
+ class ServerError < StandardError; end
120
+
121
+ class BackgroundLoadingError < StandardError; end
122
+
123
+ @agent = nil
124
+
125
+ # The singleton Agent instance. Used internally.
126
+ def agent #:nodoc:
127
+ @agent || raise("Plugin not initialized!")
128
+ end
129
+
130
+ def agent=(new_instance)#:nodoc:
131
+ @agent = new_instance
132
+ end
133
+
134
+ alias instance agent #:nodoc:
135
+
136
+ # Get or create a statistics gatherer that will aggregate numerical data
137
+ # under a metric name.
138
+ #
139
+ # +metric_name+ should follow a slash separated path convention. Application
140
+ # specific metrics should begin with "Custom/".
141
+ #
142
+ # Return a NewRelic::Stats that accepts data
143
+ # via calls to add_data_point(value).
144
+ def get_stats(metric_name, use_scope=false)
145
+ agent.stats_engine.get_stats(metric_name, use_scope)
146
+ end
147
+
148
+ alias get_stats_no_scope get_stats
149
+
150
+ # Get the logger for the agent. Available after the agent has initialized.
151
+ # This sends output to the agent log file. If the agent has not initialized
152
+ # a standard output logger is returned.
153
+ def logger
154
+ control = NewRelic::Control.instance(false)
155
+ if control
156
+ control.log
157
+ else
158
+ require 'logger'
159
+ @stdoutlog ||= Logger.new $stdout
160
+ end
161
+ end
162
+
163
+ # Call this to manually start the Agent in situations where the Agent does
164
+ # not auto-start.
165
+ #
166
+ # When the app environment loads, so does the Agent. However, the
167
+ # Agent will only connect to the service if a web front-end is found. If
168
+ # you want to selectively monitor ruby processes that don't use
169
+ # web plugins, then call this method in your code and the Agent
170
+ # will fire up and start reporting to the service.
171
+ #
172
+ # Options are passed in as overrides for values in the
173
+ # newrelic.yml, such as app_name. In addition, the option +log+
174
+ # will take a logger that will be used instead of the standard
175
+ # file logger. The setting for the newrelic.yml section to use
176
+ # (ie, RAILS_ENV) can be overridden with an :env argument.
177
+ #
178
+ def manual_start(options={})
179
+ raise "Options must be a hash" unless Hash === options
180
+ NewRelic::Control.instance.init_plugin({ :agent_enabled => true, :sync_startup => true }.merge(options))
181
+ end
182
+
183
+ # Register this method as a callback for processes that fork
184
+ # jobs.
185
+ #
186
+ # If the master/parent connects to the agent prior to forking the
187
+ # agent in the forked process will use that agent_run. Otherwise
188
+ # the forked process will establish a new connection with the
189
+ # server.
190
+ #
191
+ # Use this especially when you fork the process to run background
192
+ # jobs or other work. If you are doing this with a web dispatcher
193
+ # that forks worker processes then you will need to force the
194
+ # agent to reconnect, which it won't do by default. Passenger and
195
+ # Unicorn are already handled, nothing special needed for them.
196
+ #
197
+ # Options:
198
+ # * <tt>:force_reconnect => true</tt> to force the spawned process to
199
+ # establish a new connection, such as when forking a long running process.
200
+ # The default is false--it will only connect to the server if the parent
201
+ # had not connected.
202
+ # * <tt>:keep_retrying => false</tt> if we try to initiate a new
203
+ # connection, this tells me to only try it once so this method returns
204
+ # quickly if there is some kind of latency with the server.
205
+ def after_fork(options={})
206
+ agent.after_fork(options)
207
+ end
208
+
209
+ # Clear out any unsent metric data. See NewRelic::Agent::Agent#reset_stats
210
+ def reset_stats
211
+ agent.reset_stats
212
+ end
213
+
214
+ # Shutdown the agent. Call this before exiting. Sends any queued data
215
+ # and kills the background thread.
216
+ def shutdown(options={})
217
+ agent.shutdown(options)
218
+ end
219
+
220
+ # a method used to serialize short-running processes to disk, so
221
+ # we don't incur the overhead of reporting to the server for every
222
+ # fork/invocation of a small job.
223
+ #
224
+ # Functionally, this loads the data from the file into the agent
225
+ # (to avoid losing data by overwriting) and then serializes the
226
+ # agent data to the file again. See also #load_data
227
+ def save_data
228
+ NewRelic::DataSerialization.read_and_write_to_file do |old_data|
229
+ agent.merge_data_from(old_data)
230
+ agent.serialize
231
+ end
232
+ end
233
+
234
+ # used to load data from the disk during the harvest cycle to send
235
+ # it. This method also clears the file so data should never be
236
+ # sent more than once.
237
+
238
+ # Note that only one transaction trace will be sent even if many
239
+ # are serialized, since the slowest is sent.
240
+ #
241
+ # See also the complement to this method, #save_data - used when a
242
+ # process is shutting down
243
+ def load_data
244
+ if !NewRelic::Control.instance['disable_serialization']
245
+ NewRelic::DataSerialization.read_and_write_to_file do |old_data|
246
+ agent.merge_data_from(old_data)
247
+ nil # return nil so nothing is written to the file
248
+ end
249
+ NewRelic::DataSerialization.update_last_sent!
250
+ end
251
+
252
+ {
253
+ :metrics => agent.stats_engine.metrics.length,
254
+ :traces => agent.unsent_traces_size,
255
+ :errors => agent.unsent_errors_size
256
+ }
257
+ end
258
+
259
+ # Add instrumentation files to the agent. The argument should be
260
+ # a glob matching ruby scripts which will be executed at the time
261
+ # instrumentation is loaded. Since instrumentation is not loaded
262
+ # when the agent is not running it's better to use this method to
263
+ # register instrumentation than just loading the files directly,
264
+ # although that probably also works.
265
+ def add_instrumentation(file_pattern)
266
+ NewRelic::Control.instance.add_instrumentation file_pattern
267
+ end
268
+
269
+ # This method sets the block sent to this method as a sql
270
+ # obfuscator. The block will be called with a single String SQL
271
+ # statement to obfuscate. The method must return the obfuscated
272
+ # String SQL. If chaining of obfuscators is required, use type =
273
+ # :before or :after
274
+ #
275
+ # type = :before, :replace, :after
276
+ #
277
+ # Example:
278
+ #
279
+ # NewRelic::Agent.set_sql_obfuscator(:replace) do |sql|
280
+ # my_obfuscator(sql)
281
+ # end
282
+ #
283
+ def set_sql_obfuscator(type = :replace, &block)
284
+ NewRelic::Agent::Database.set_sql_obfuscator(type, &block)
285
+ end
286
+
287
+
288
+ # This method sets the state of sql recording in the transaction
289
+ # sampler feature. Within the given block, no sql will be recorded
290
+ #
291
+ # usage:
292
+ #
293
+ # NewRelic::Agent.disable_sql_recording do
294
+ # ...
295
+ # end
296
+ #
297
+ def disable_sql_recording
298
+ state = agent.set_record_sql(false)
299
+ begin
300
+ yield
301
+ ensure
302
+ agent.set_record_sql(state)
303
+ end
304
+ end
305
+
306
+ # This method disables the recording of transaction traces in the given
307
+ # block. See also #disable_all_tracing
308
+ def disable_transaction_tracing
309
+ state = agent.set_record_tt(false)
310
+ begin
311
+ yield
312
+ ensure
313
+ agent.set_record_tt(state)
314
+ end
315
+ end
316
+
317
+ # Cancel the collection of the current transaction in progress, if
318
+ # any. Only affects the transaction started on this thread once
319
+ # it has started and before it has completed.
320
+ def abort_transaction!
321
+ NewRelic::Agent::Instrumentation::MetricFrame.abort_transaction!
322
+ end
323
+
324
+ # Yield to the block without collecting any metrics or traces in
325
+ # any of the subsequent calls. If executed recursively, will keep
326
+ # track of the first entry point and turn on tracing again after
327
+ # leaving that block. This uses the thread local
328
+ # +newrelic_untrace+
329
+ def disable_all_tracing
330
+ agent.push_trace_execution_flag(false)
331
+ yield
332
+ ensure
333
+ agent.pop_trace_execution_flag
334
+ end
335
+
336
+ # Check to see if we are capturing metrics currently on this thread.
337
+ def is_execution_traced?
338
+ Thread.current[:newrelic_untraced].nil? || Thread.current[:newrelic_untraced].last != false
339
+ end
340
+
341
+ # helper method to check the thread local to determine whether the
342
+ # transaction in progress is traced or not
343
+ def is_transaction_traced?
344
+ Thread::current[:record_tt] != false
345
+ end
346
+
347
+ # helper method to check the thread local to determine whether sql
348
+ # is being recorded or not
349
+ def is_sql_recorded?
350
+ Thread::current[:record_sql] != false
351
+ end
352
+
353
+ # Set a filter to be applied to errors that the Ruby Agent will
354
+ # track. The block should evalute to the exception to track
355
+ # (which could be different from the original exception) or nil to
356
+ # ignore this exception.
357
+ #
358
+ # The block is yielded to with the exception to filter.
359
+ #
360
+ # Return the new block or the existing filter Proc if no block is passed.
361
+ #
362
+ def ignore_error_filter(&block)
363
+ agent.error_collector.ignore_error_filter(&block)
364
+ end
365
+
366
+ # Record the given error. It will be passed through the
367
+ # #ignore_error_filter if there is one.
368
+ #
369
+ # * <tt>exception</tt> is the exception which will be recorded. May also be
370
+ # an error message.
371
+ # Options:
372
+ # * <tt>:uri</tt> => The request path, minus any request params or query string.
373
+ # * <tt>:referer</tt> => The URI of the referer
374
+ # * <tt>:metric</tt> => The metric name associated with the transaction
375
+ # * <tt>:request_params</tt> => Request parameters, already filtered if necessary
376
+ # * <tt>:custom_params</tt> => Custom parameters
377
+ #
378
+ # Anything left over is treated as custom params.
379
+ #
380
+ def notice_error(exception, options={})
381
+ NewRelic::Agent::Instrumentation::MetricFrame.notice_error(exception, options)
382
+ end
383
+
384
+ # Add parameters to the current transaction trace (and traced error if any)
385
+ # on the call stack.
386
+ #
387
+ def add_custom_parameters(params)
388
+ NewRelic::Agent::Instrumentation::MetricFrame.add_custom_parameters(params)
389
+ end
390
+
391
+ # Set attributes about the user making this request. These attributes will be automatically
392
+ # appended to any Transaction Trace or Error that is collected. These attributes
393
+ # will also be collected for RUM requests.
394
+ #
395
+ # Attributes (hash)
396
+ # * <tt>:user</tt> => user name or ID
397
+ # * <tt>:account</tt> => account name or ID
398
+ # * <tt>:product</tt> => product name or level
399
+ #
400
+ def set_user_attributes(attributes)
401
+ NewRelic::Agent::Instrumentation::MetricFrame.set_user_attributes(attributes)
402
+ end
403
+
404
+ # The #add_request_parameters method is aliased to #add_custom_parameters
405
+ # and is now deprecated.
406
+ alias add_request_parameters add_custom_parameters #:nodoc:
407
+
408
+ # Yield to a block that is run with a database metric name
409
+ # context. This means the Database instrumentation will use this
410
+ # for the metric name if it does not otherwise know about a model.
411
+ # This is re-entrant.
412
+ #
413
+ # * <tt>model</tt> is the DB model class
414
+ # * <tt>method</tt> is the name of the finder method or other
415
+ # method to identify the operation with.
416
+ def with_database_metric_name(model, method, &block)
417
+ if frame = NewRelic::Agent::Instrumentation::MetricFrame.current
418
+ frame.with_database_metric_name(model, method, &block)
419
+ else
420
+ yield
421
+ end
422
+ end
423
+
424
+ # Record a web transaction from an external source. This will
425
+ # process the response time, error, and score an apdex value.
426
+ #
427
+ # First argument is a float value, time in seconds. Option
428
+ # keys are strings.
429
+ #
430
+ # == Identifying the transaction
431
+ # * <tt>'uri' => uri</tt> to record the value for a given web request.
432
+ # If not provided, just record the aggregate dispatcher and apdex scores.
433
+ # * <tt>'metric' => metric_name</tt> to record with a general metric name
434
+ # like +OtherTransaction/Background/Class/method+. Ignored if +uri+ is
435
+ # provided.
436
+ #
437
+ # == Error options
438
+ # Provide one of the following:
439
+ # * <tt>'is_error' => true</tt> if an unknown error occurred
440
+ # * <tt>'error_message' => msg</tt> if an error message is available
441
+ # * <tt>'exception' => exception</tt> if a ruby exception is recorded
442
+ #
443
+ # == Misc options
444
+ # Additional information captured in errors
445
+ # * <tt>'referer' => referer_url</tt>
446
+ # * <tt>'request_params' => hash</tt> to record a set of name/value pairs as the
447
+ # request parameters.
448
+ # * <tt>'custom_params' => hash</tt> to record extra information in traced errors
449
+ #
450
+ def record_transaction(response_sec, options = {})
451
+ agent.record_transaction(response_sec, options)
452
+ end
453
+
454
+ # Returns a Javascript string which should be injected into the very top of the response body
455
+ #
456
+ def browser_timing_header
457
+ agent.browser_timing_header
458
+ end
459
+
460
+ # Returns a Javascript string which should be injected into the very bottom of the response body
461
+ #
462
+ def browser_timing_footer
463
+ agent.browser_timing_footer
464
+ end
465
+
466
+ end
467
+ end