Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix

  • Loading branch information...
commit a18d3aa1c5a2cbb612aadc04d1135555917d9563 1 parent 9bba217
@bkayser bkayser authored
Showing with 0 additions and 21,852 deletions.
  1. +0 −7 v2_13_1/.gitignore
  2. +0 −17 v2_13_1/.project
  3. +0 −462 v2_13_1/CHANGELOG
  4. +0 −15 v2_13_1/InstallationNotes.md
  5. +0 −37 v2_13_1/LICENSE
  6. +0 −172 v2_13_1/README.rdoc
  7. +0 −111 v2_13_1/Rakefile
  8. +0 −33 v2_13_1/bin/mongrel_rpm
  9. +0 −13 v2_13_1/bin/newrelic
  10. +0 −5 v2_13_1/bin/newrelic_cmd
  11. +0 −34 v2_13_1/cert/cacert.pem
  12. +0 −37 v2_13_1/init.rb
  13. +0 −9 v2_13_1/install.rb
  14. +0 −382 v2_13_1/lib/new_relic/agent.rb
  15. +0 −741 v2_13_1/lib/new_relic/agent/agent.rb
  16. +0 −91 v2_13_1/lib/new_relic/agent/busy_calculator.rb
  17. +0 −13 v2_13_1/lib/new_relic/agent/chained_call.rb
  18. +0 −131 v2_13_1/lib/new_relic/agent/error_collector.rb
  19. +0 −18 v2_13_1/lib/new_relic/agent/instrumentation/active_merchant.rb
  20. +0 −92 v2_13_1/lib/new_relic/agent/instrumentation/active_record_instrumentation.rb
  21. +0 −45 v2_13_1/lib/new_relic/agent/instrumentation/acts_as_solr.rb
  22. +0 −8 v2_13_1/lib/new_relic/agent/instrumentation/authlogic.rb
  23. +0 −409 v2_13_1/lib/new_relic/agent/instrumentation/controller_instrumentation.rb
  24. +0 −58 v2_13_1/lib/new_relic/agent/instrumentation/data_mapper.rb
  25. +0 −22 v2_13_1/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb
  26. +0 −40 v2_13_1/lib/new_relic/agent/instrumentation/memcache.rb
  27. +0 −26 v2_13_1/lib/new_relic/agent/instrumentation/merb/controller.rb
  28. +0 −9 v2_13_1/lib/new_relic/agent/instrumentation/merb/errors.rb
  29. +0 −319 v2_13_1/lib/new_relic/agent/instrumentation/metric_frame.rb
  30. +0 −17 v2_13_1/lib/new_relic/agent/instrumentation/net.rb
  31. +0 −22 v2_13_1/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb
  32. +0 −98 v2_13_1/lib/new_relic/agent/instrumentation/rack.rb
  33. +0 −59 v2_13_1/lib/new_relic/agent/instrumentation/rails/action_controller.rb
  34. +0 −27 v2_13_1/lib/new_relic/agent/instrumentation/rails/action_web_service.rb
  35. +0 −24 v2_13_1/lib/new_relic/agent/instrumentation/rails/errors.rb
  36. +0 −45 v2_13_1/lib/new_relic/agent/instrumentation/rails3/action_controller.rb
  37. +0 −21 v2_13_1/lib/new_relic/agent/instrumentation/rails3/errors.rb
  38. +0 −46 v2_13_1/lib/new_relic/agent/instrumentation/sinatra.rb
  39. +0 −17 v2_13_1/lib/new_relic/agent/instrumentation/sunspot.rb
  40. +0 −10 v2_13_1/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb
  41. +0 −350 v2_13_1/lib/new_relic/agent/method_tracer.rb
  42. +0 −50 v2_13_1/lib/new_relic/agent/sampler.rb
  43. +0 −54 v2_13_1/lib/new_relic/agent/samplers/cpu_sampler.rb
  44. +0 −37 v2_13_1/lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb
  45. +0 −142 v2_13_1/lib/new_relic/agent/samplers/memory_sampler.rb
  46. +0 −24 v2_13_1/lib/new_relic/agent/samplers/object_sampler.rb
  47. +0 −25 v2_13_1/lib/new_relic/agent/shim_agent.rb
  48. +0 −24 v2_13_1/lib/new_relic/agent/stats_engine.rb
  49. +0 −118 v2_13_1/lib/new_relic/agent/stats_engine/metric_stats.rb
  50. +0 −83 v2_13_1/lib/new_relic/agent/stats_engine/samplers.rb
  51. +0 −149 v2_13_1/lib/new_relic/agent/stats_engine/transactions.rb
  52. +0 −330 v2_13_1/lib/new_relic/agent/transaction_sampler.rb
  53. +0 −81 v2_13_1/lib/new_relic/agent/worker_loop.rb
  54. +0 −71 v2_13_1/lib/new_relic/collection_helper.rb
  55. +0 −85 v2_13_1/lib/new_relic/command.rb
  56. +0 −105 v2_13_1/lib/new_relic/commands/deployments.rb
  57. +0 −91 v2_13_1/lib/new_relic/commands/install.rb
  58. +0 −203 v2_13_1/lib/new_relic/control.rb
  59. +0 −149 v2_13_1/lib/new_relic/control/configuration.rb
  60. +0 −13 v2_13_1/lib/new_relic/control/frameworks/external.rb
  61. +0 −24 v2_13_1/lib/new_relic/control/frameworks/merb.rb
  62. +0 −126 v2_13_1/lib/new_relic/control/frameworks/rails.rb
  63. +0 −60 v2_13_1/lib/new_relic/control/frameworks/rails3.rb
  64. +0 −36 v2_13_1/lib/new_relic/control/frameworks/ruby.rb
  65. +0 −18 v2_13_1/lib/new_relic/control/frameworks/sinatra.rb
  66. +0 −95 v2_13_1/lib/new_relic/control/instrumentation.rb
  67. +0 −74 v2_13_1/lib/new_relic/control/logging_methods.rb
  68. +0 −24 v2_13_1/lib/new_relic/control/profiling.rb
  69. +0 −88 v2_13_1/lib/new_relic/control/server_methods.rb
  70. +0 −27 v2_13_1/lib/new_relic/delayed_job_injection.rb
  71. +0 −91 v2_13_1/lib/new_relic/histogram.rb
  72. +0 −333 v2_13_1/lib/new_relic/local_environment.rb
  73. +0 −6 v2_13_1/lib/new_relic/merbtasks.rb
  74. +0 −42 v2_13_1/lib/new_relic/metric_data.rb
  75. +0 −67 v2_13_1/lib/new_relic/metric_spec.rb
  76. +0 −9 v2_13_1/lib/new_relic/metrics.rb
  77. +0 −24 v2_13_1/lib/new_relic/noticed_error.rb
  78. +0 −257 v2_13_1/lib/new_relic/rack/developer_mode.rb
  79. +0 −64 v2_13_1/lib/new_relic/rack/metric_app.rb
  80. +0 −26 v2_13_1/lib/new_relic/rack/mongrel_rpm.ru
  81. +0 −27 v2_13_1/lib/new_relic/rack/newrelic.yml
  82. +0 −6 v2_13_1/lib/new_relic/rack_app.rb
  83. +0 −82 v2_13_1/lib/new_relic/recipes.rb
  84. +0 −368 v2_13_1/lib/new_relic/stats.rb
  85. +0 −27 v2_13_1/lib/new_relic/timer_lib.rb
  86. +0 −119 v2_13_1/lib/new_relic/transaction_analysis.rb
  87. +0 −586 v2_13_1/lib/new_relic/transaction_sample.rb
  88. +0 −14 v2_13_1/lib/new_relic/url_rule.rb
  89. +0 −55 v2_13_1/lib/new_relic/version.rb
  90. +0 −276 v2_13_1/lib/new_relic_api.rb
  91. +0 −49 v2_13_1/lib/newrelic_rpm.rb
  92. +0 −4 v2_13_1/lib/tasks/all.rb
  93. +0 −7 v2_13_1/lib/tasks/install.rake
  94. +0 −15 v2_13_1/lib/tasks/tests.rake
  95. +0 −246 v2_13_1/newrelic.yml
  96. +0 −6 v2_13_1/recipes/newrelic.rb
  97. +0 −55 v2_13_1/test/active_record_fixtures.rb
  98. +0 −48 v2_13_1/test/config/newrelic.yml
  99. +0 −36 v2_13_1/test/config/test_control.rb
  100. +0 −286 v2_13_1/test/new_relic/agent/active_record_instrumentation_test.rb
  101. +0 −294 v2_13_1/test/new_relic/agent/agent_controller_test.rb
  102. +0 −77 v2_13_1/test/new_relic/agent/agent_test_controller.rb
  103. +0 −81 v2_13_1/test/new_relic/agent/busy_calculator_test.rb
  104. +0 −125 v2_13_1/test/new_relic/agent/collection_helper_test.rb
  105. +0 −163 v2_13_1/test/new_relic/agent/error_collector_test.rb
  106. +0 −103 v2_13_1/test/new_relic/agent/memcache_instrumentation_test.rb
  107. +0 −340 v2_13_1/test/new_relic/agent/method_tracer_test.rb
  108. +0 −53 v2_13_1/test/new_relic/agent/metric_data_test.rb
  109. +0 −51 v2_13_1/test/new_relic/agent/metric_frame_test.rb
  110. +0 −23 v2_13_1/test/new_relic/agent/mock_scope_listener.rb
  111. +0 −77 v2_13_1/test/new_relic/agent/net_instrumentation_test.rb
  112. +0 −142 v2_13_1/test/new_relic/agent/rpm_agent_test.rb
  113. +0 −79 v2_13_1/test/new_relic/agent/stats_engine/metric_stats_test.rb
  114. +0 −72 v2_13_1/test/new_relic/agent/stats_engine/samplers_test.rb
  115. +0 −184 v2_13_1/test/new_relic/agent/stats_engine/stats_engine_test.rb
  116. +0 −188 v2_13_1/test/new_relic/agent/task_instrumentation_test.rb
  117. +0 −13 v2_13_1/test/new_relic/agent/testable_agent.rb
  118. +0 −195 v2_13_1/test/new_relic/agent/transaction_sample_builder_test.rb
  119. +0 −192 v2_13_1/test/new_relic/agent/transaction_sample_test.rb
  120. +0 −385 v2_13_1/test/new_relic/agent/transaction_sampler_test.rb
  121. +0 −66 v2_13_1/test/new_relic/agent/worker_loop_test.rb
  122. +0 −127 v2_13_1/test/new_relic/control_test.rb
  123. +0 −69 v2_13_1/test/new_relic/deployments_api_test.rb
  124. +0 −75 v2_13_1/test/new_relic/environment_test.rb
  125. +0 −226 v2_13_1/test/new_relic/metric_parser_test.rb
  126. +0 −177 v2_13_1/test/new_relic/metric_spec_test.rb
  127. +0 −318 v2_13_1/test/new_relic/rack/episodes_test.rb
  128. +0 −9 v2_13_1/test/new_relic/shim_agent_test.rb
  129. +0 −312 v2_13_1/test/new_relic/stats_test.rb
  130. +0 −89 v2_13_1/test/new_relic/version_number_test.rb
  131. +0 −28 v2_13_1/test/test_contexts.rb
  132. +0 −72 v2_13_1/test/test_helper.rb
  133. +0 −359 v2_13_1/ui/helpers/developer_mode_helper.rb
  134. +0 −49 v2_13_1/ui/helpers/google_pie_chart.rb
  135. +0 −47 v2_13_1/ui/views/layouts/newrelic_default.rhtml
  136. +0 −27 v2_13_1/ui/views/newrelic/_explain_plans.rhtml
  137. +0 −20 v2_13_1/ui/views/newrelic/_sample.rhtml
  138. +0 −29 v2_13_1/ui/views/newrelic/_segment.rhtml
  139. +0 −1  v2_13_1/ui/views/newrelic/_segment_limit_message.rhtml
  140. +0 −14 v2_13_1/ui/views/newrelic/_segment_row.rhtml
  141. +0 −24 v2_13_1/ui/views/newrelic/_show_sample_detail.rhtml
  142. +0 −20 v2_13_1/ui/views/newrelic/_show_sample_sql.rhtml
  143. +0 −3  v2_13_1/ui/views/newrelic/_show_sample_summary.rhtml
  144. +0 −16 v2_13_1/ui/views/newrelic/_sql_row.rhtml
  145. +0 −15 v2_13_1/ui/views/newrelic/_stack_trace.rhtml
  146. +0 −12 v2_13_1/ui/views/newrelic/_table.rhtml
  147. +0 −43 v2_13_1/ui/views/newrelic/explain_sql.rhtml
  148. BIN  v2_13_1/ui/views/newrelic/file/images/arrow-close.png
  149. BIN  v2_13_1/ui/views/newrelic/file/images/arrow-open.png
  150. BIN  v2_13_1/ui/views/newrelic/file/images/blue_bar.gif
  151. BIN  v2_13_1/ui/views/newrelic/file/images/file_icon.png
  152. BIN  v2_13_1/ui/views/newrelic/file/images/gray_bar.gif
  153. BIN  v2_13_1/ui/views/newrelic/file/images/new-relic-rpm-desktop.gif
  154. BIN  v2_13_1/ui/views/newrelic/file/images/new_relic_rpm_desktop.gif
  155. BIN  v2_13_1/ui/views/newrelic/file/images/textmate.png
  156. +0 −6,240 v2_13_1/ui/views/newrelic/file/javascript/jquery-1.4.2.js
  157. +0 −120 v2_13_1/ui/views/newrelic/file/javascript/transaction_sample.js
  158. +0 −484 v2_13_1/ui/views/newrelic/file/stylesheets/style.css
  159. +0 −59 v2_13_1/ui/views/newrelic/index.rhtml
  160. +0 −2  v2_13_1/ui/views/newrelic/sample_not_found.rhtml
  161. +0 −79 v2_13_1/ui/views/newrelic/show_sample.rhtml
  162. +0 −3  v2_13_1/ui/views/newrelic/show_source.rhtml
  163. +0 −52 v2_13_1/ui/views/newrelic/threads.rhtml
View
7 v2_13_1/.gitignore
@@ -1,7 +0,0 @@
-.DS\_Store
-.svn/
-*~
-pkg/
-*.gem
-!rails
-Manifest*
View
17 v2_13_1/.project
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>New Relic Agent</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.rubypeople.rdt.core.rubybuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.rubypeople.rdt.core.rubynature</nature>
- </natures>
-</projectDescription>
View
462 v2_13_1/CHANGELOG
@@ -1,462 +0,0 @@
-v2.13.1
- * Add missing require in rails 3 framework control
-
-v2.13.0
- * developer mode is now a rack middleware and can be used on any framework;
- it is no longer supported automatically on versions of Rails prior to 2.3;
- see README for details
- * memcache key recording for transaction traces
- * use system_timer gem if available, fall back to timeout lib
- * address instability issues in JRuby 1.2
- * renamed executable 'newrelic_cmd' to 'newrelic'; old name still supported
- for backward compatibility
- * added 'newrelic install' command to install a newrelic.yml file in the
- current directory
- * optimization to execution time measurement
- * optimization to startup sequence
- * change startup sequence so that instrumentation is installed after all
- other gems and plugins have loaded
- * add option to override automatic flushing of data on exit--send_data_on_exit
- defaults to 'true'
- * ignored errors no longer affect apdex score
- * added record_transaction method to the api to allow recording
- details from web and background transactions occurring outside RPM
- * fixed a bug related to enabling a gold trial / upgrade not sending
- trasaction traces correctly
-
-v2.12.3
- * fix regression in startup sequence
-
-v2.12.2
- * fix for regression in Rails 2.1 inline rendering
- * workaround bug found in some rubies that caused a segv and/or NoMemoryError
- when deflating content for upload
- * avoid creating connection thread in unicorn/passenger spawners
-
-v2.12.1
- * fix bug in profile mode
- * fix race condition in Delayed::Job instrumentation loading
- * fix glassfish detection in latest glassfish gem
-
-v2.12.0
- * support basic instrumentation for ActsAsSolr and Sunspot
-
-v2.11.3
- * fix bug in startup when running JRuby
-
-v2.11.2
- * fix for unicorn not reporting when the proc line had 'master' in it
- * fix regression for passenger 2.0 and earlier
- * fix after_fork in the shim
-
-v2.11.1
- * republished gem without generated rdocs
-
-v2.11.0
- * rails3 instrumentation (no developer mode support yet)
- * removed the ensure_worker_thread started and instead defined an after_fork
- handler that will set up the agent properly in forked processes.
- * change at_exit handler so the shutdown always goes after other shutdown
- handlers
- * add visibility to active record db transactions in the rpm transaction
- traces (thanks to jeremy kemper)
- * fix regression in merb support which caused merb apps not to start
- * added NewRelic::Agent.logger to the public api to write to the agent
- log file.
- * optimizations to background thread, controller instrumentation, memory
- usage
- * add logger method to public_api
- * support list notation for ignored exceptions in the newrelic.yml
-
-v2.10.8
- * fix bug in delayed_job instrumentation that caused the job queue sampler
- to run in the wrong place
- * change startup sequence and code that restarts the worker loop
- thread
- * detect the unicorn master and dont start the agent; hook in after_fork
- * fix problem with the Authlogic metric names which caused errors in
- developer mode. Authlogic metrics now adhere to the convention of
- prefixing the name with 'Custom'
- * allow more correct overriding of transaction trace settings in the
- call to #manual_start
- * simplify WorkerLoop and add better protection for concurrency
- * preliminary support for rails3
-
-v2.10.6
- * fix missing URL and referer on some traced errors and transactions
- * gather traced errors *after* executing the rescue chain in ActionController
- * always load controller instrumentation
- * pick up token validation from newrelic.yml
-
-v2.10.5
- * fix bug in delayed_job instrumentation occurring when there was no DJ log
-
-v2.10.4
- * fix incompatibility with Capistrano 2.5.16
- * strip down URLs reported in transactions and errors to path only
-
-v2.10.3
- * optimization to reduce overhead: move background samplers into foreground thread
- * change default config file to ignore RoutingErrors
- * moved the background task instrumentation into a separate tab in the RPM UI
- * allow override of the RPM application name via NEWRELIC_APP_NAME environment variable
- * revised Delayed::Job instrumentation so no manual_start is required
- * send buffered data on shutdown
- * expanded support for queue length and queue time
- * remove calls to starts_with to fix Sinatra and non-rails deployments
- * fix problem with apdex scores recording too low in some circumstances
- * switch to jeweler for gem building
- * minor fixes, test improvements, doc and rakefile improvements
- * fix incompatibility with Hoptoad where Hoptoad was not getting errors handled by New Relic
- * many other optimizations, bug fixes and documentation improvements
-
-v2.10.2.
- * beta release of 2.10
- * fix bugs with Sinatra app instrumentation
- * minor doc updates
-
-v2.10.1.
- * alpha release of 2.10
- * rack support, including metal; ignores 404s; requires a module inclusion (see docs)
- * sinatra support, displays actions named by the URI pattern matched
- * add API method to abort transaction recording for in-flight transactions
- * remove account management calls from newrelic_api.rb
- * truncating extremely large transaction traces for efficiency
- * fix error reporting in recipes; add newrelic_rails_env option to recipes to
- override the rails env used to pull the app_name out of newrelic.yml
- * added TorqueBox recognition (thanks Bob McWhirter)
- * renamed config settings: enabled => monitor_mode; developer => developer_mode;
- old names will still work in newrelic.yml
- * instrumentation for DelayedJob (thanks Travis Tilley)
- * added config switches to turn off certain instrumentation when you aren't
- interested in the metrics, to save on overhead--see newrelic.yml for details.
- * add profiling support to dev mode; very experimental!
- * add 'multi_threaded' config option to indicate when the app is running
- multi-threaded, so we can disable some instrumentation
- * fix test failures in JRuby, REE
- * improve Net::HTTP instrumentation so its more efficient and distinguishes calls
- between web and non-web transactions.
- * database instrumentation notices all database commands in addition to the core commands
- * add support for textmate to dev mode
- * added add_transaction_tracer method to support instrumenting methods as
- if they were web transactions; this will facilitate better visibility of background
- tasks and eventually things like rack, metal and Sinatra
- * adjusted apdex scores to reflect time spent in the mongrel queue
- * fixed incompatibility with JRuby on startup
- * implmented CPU measure for JRuby which reflects the cpu burn for
- all controller actions (does not include background tasks)
- * fixed scope issue with GC instrumentation, subtracting time from caller
- * added # of GC calls to GC instrumentation
- * renamed the dispatcher metric
- * refactored stats_engine code for readability
- * optimization: reduce wakeup times for harvest thread
-
-v2.10.0.
- * alpha release of 2.10
- * support unicorn
- * instrumentation of GC for REE and MRE with GC patch
- * support agent restarting when changes are made to the account
- * removed #newrelic_notice_error from Object class, replaced by NewRelic::Agent#notic_error
- * collect histogram statistics
- * add custom parameters to newrelic_notice_error call to display
- extra info for errors
- * add method disable_all_tracing(&block) to execute a block without
- capturing metrics
- * newrelic_ignore now blocks all instrumentation collection for
- the specified actions
- * added doc to method_tracer API and removed second arg
- requirement for add_method_tracer call
- * instrumentation for Net::HTTP
- * remove method_tracer shim to avoid timing problems in monitoring daemons
- * for non-rails daemons, look at APP_ROOT and NRCONFIG env vars for custom locations
-
-v2.9.9.
- * Disable at_exit handler for Unicorn which sometimes caused the
- agent to stop reporting immediately.
-
-v2.9.8.
- * add instrumentation for Net::HTTP calls, to show up as "External"
- * added support for validating agents in the cloud.
- * recognize Unicorn dispatcher
- * add NewRelic module definitions to ActiveRecord instrumentation
-
-v2.9.5.
- * Snow Leopard memory fix
-
-v2.9.4.
- * clamp size of data sent to server
- * reset statistics for passenger when forking to avoid erroneous data
- * fix problem deserializing errors from the server
- * fix incompatibility with postgres introduced in 2.9.
-
-v2.9.3.
- * fix startup failure in Windows due to memory sampler
- * add JRuby environment information
-
-v2.9.2.
- * change default apdex_t to 0.5 seconds
- * fix bug in deployments introduced by multi_homed setting
- * support overriding the log in the agent api
- * fix JRuby problem using objectspace
- * display custom parameters when looking at transactions in dev mode
- * display count of sql statements on the list of transactions in dev mode
- * fixes for merb--thanks to Carl Lerche
-
-v2.9.1.
- * add newrelic_ignore_apdex method to controller classes to allow
- you to omit some actions from apdex statistics
- * Add hook for Passenger shutdown events to get more timely shutdown
- notices; this will help in more accurate memory readings in
- Passenger
- * add newrelic_notice_error to Object class
- * optional ability to verify SSL certificates, note that this has some
- performance and reliability implications
- * support multi-homed host with multiple apps running on duplicate
- ports
-
-v2.9.0.
- Noteworthy Enhancements
- * give visibility to templates and partials in Rails 2.1 and later, in
- dev mode and production
- * change active record metrics to capture statistics in adapter log()
- call, resulting in lower overhead and improved visibility into
- different DB operations; only AR operations that are not hitting the
- query cache will be measured to avoid overhead
- * added mongrel_rpm to the gem, a standalone daemon listening for custom
- metric values sent from local processes (experimental); do mongrel_rpm
- --help
- * add API for system monitoring daemons (refer to KB articles); changed
- API for manual starting of the agent; refer to
- NewRelic::Agent.manual_start for details
- * do certificate verification on ssl connections to
- collector.newrelic.com
- * support instances appearing in more than one application by allowing a
- semicolon separated list of names for the newrelic.yml app_name
- setting.
- * combined agent logfiles into a single logfile
- * use rpm server time for transaction traces rather than agent time
-
- Developer Mode (only) Enhancements
- * show partial rendering in traces
- * improved formatting of metric names in traces
- * added number of queries to transactions in the transaction list
- * added some sorting options for the transaction list
- * added a page showing the list of active threads
-
- Compatibility Enhancements
- * ruby 1.9.1 compatibility
- * support concurrency when determining busy times, for 2.2 compatibility
- * in jruby, use Java used heap for memory sampling if the system memory
- is not accessible from an unsupported platform
- * jruby will no longer start the agent now when running the console or
- rake tasks
- * API support for RPM as a footnote add-in
- * webrick support restored
-
- Noteworthy bugfixes
- * sample memory on linux by reading /proc/#{$$}/status file
- * fixed ambiguous 'View' metrics showing up in controller breakdown
- * removed Numeric extensions, including round_to, and to_ms
- * using a different timeout mechanism when we post data to RPM
- * remove usage of Rails::Info which had a side effect of enabling
- ActiveRecord even when it wasn't an active framework
- * moved CPU sampler off background thread and onto the harvest thread
- * tests now run cleanly in any rails app using test:newrelic or
- test:plugins
-
- Agent improvements to support future RPM enhancements
- * add instrumentation to capture metrics on response codes; not yet
- working in rails 2.3.*
- * added http referer to traced errors
- * capture gem requirements from rails
- * capture cpu utilization adjusted for processor count
- * transaction sampling
-
-v2.8.10.
- * fix thin support with rails 2.3.2 when using script/server
- * fix incompatibility with rails 2.3.2 and script/server options
- processing
- * minor tweak to environment gathering for gem mode
-
-v2.8.9.
- * fix problem finding the newrelic controller in dev mode
- * fix incompatibility with older versions of optparse
- * fix potential jvm problem with jruby
- * remove test:all task definition to avoid conflicts
- * change error message about window sampler in windows not supported to a
- warning message
-
-v2.8.8.
- * fix error with jruby on windows
- * fix problem where webrick was being incorrectly detected causing some
- problems with mongrel application assignments--had to disable webrick
- for now
-
-v2.8.7.
- * fix for ssl connection hanging problems
- * fix problem recognizing mongrel in rails 2.3.2
- * fastcgi support in rails 2.3.2
- * put back webrick support
-
-v2.8.6.
- * fix for capture_params when using file uploads in controller actions
- * use pure ruby NS lookup for collector host to eliminate possibly
- blocking applications
-
-v2.8.5.
- * fix reference to CommandError which was breaking some cap scripts
- * fix incompatibility with Rails 2.0 in the server API
- * fix problem with litespeed with Lite accounts
- * fix problem when ActiveRecord is disabled
- * moved merb instrumentation to Merb::Controller instead of
- AbstractController to address incompatibility with MailController
- * fix problem in devmode displaying sql with embedded urls
-
-v2.8.4.
- * fix bug in capistrano recipe causing cap commands to fail with error
- about not finding Version class
-
-v2.8.3.
- * refactor unit tests so they will run in a generic rails environment
- * require classes in advance to avoid autoloading. this is to address
- incompatibilities with desert as well as more flexibility in gem
- initialization
- * fixed newrelic_helper.rb 1.9 incompatibility
-
-v2.8.2.
- * fix Ruby 1.9 syntax compatibility errors
- * update the class loading sanity check, will notify server of errors
- * fix agent output on script and rake task execution
-
-v2.8.1.
- * Convert the deployment information upload script to an executable and
- put in the bin directory. When installed as a gem this command is
- symlinked to /usr/bin. Usage: newrelic_cmd deployments --help
- * Fix issue invoking api when host is not set in newrelic.yml
- * Fix deployments api so it will work from a gem
- * Fix thin incompatibility in developer mode
-
-v2.8.0.
- * add beta of api in new_relic_api.rb
- * instrumented dynamic finders in ActiveRecord
- * preliminary support for capturing deployment information via capistrano
- * change memory sampler for solaris to use /usr/bin/ps
- * allow ERB in newrelic.yml file
- * merged support for merb into this version
- * fix incompatibility in the developer mode with the safe_erb plugin
- * fix module namespace issue causing an error accessing
- NewRelic::Instrumentation modules
- * fix issue where the agent sometimes failed to start up if there was a
- transient network problem
- * fix IgnoreSilentlyException message
-
-v2.7.4.
- * fix error when trying to serialize some kinds of Enumerable objects
- * added extra debug logging
- * added app_name to app mapping
-
-v2.7.3.
- * fix compatibility issue with 1.8.5 causing error with Dir.glob
-
-v2.7.2.
- * fix problem with passenger edge not being a detected environment
-
-v2.7.1.
- * fix problem with skipped dispatcher instrumentation
-
-v2.7.0.
- * Repackage to support both plugin and Gem installation
- * Support passenger/litespeed/jruby application naming
- * Update method for calculating dispatcher queue time
- * Show stack traces in RPM Transaction Traces
- * Capture error source for TemplateErrors
- * Clean up error stack traces.
- * Support query plans from postgres
- * Performance tuning
- * bugfixes
-
-v2.5.3.
- * fix error in transaction tracing causing traces not to show up
-
-v2.5.2.
- * fixes for postgres explain plan support
-
-v2.5.1.
- * bugfixes
-
-v2.5.0.
- * add agent support for rpm 1.1 features
- * Fix regression error with thin support
-
-v2.4.3.
- * added 'newrelic_ignore' controller class method with :except and :only options for finer grained control
- over the blocking of instrumentation in controllers.
- * bugfixes
-
-v2.4.2.
- * error reporting in early access
-
-v2.4.1.
- * bugfix: initializing developer mode
-
-v2.4.0.
- * Beta support for LiteSpeed and Passenger
-
-v2.3.7.
- * bugfixes
-
-v2.3.6.
- * bugfixes
-
-v2.3.5.
- * bugfixes: pie chart data, rails 1.1 compability
-
-v2.3.4.
- * bugfix
-
-v2.3.3.
- * bugfix for non-mysql databases
-
-v2.3.2.
- * bugfixes
- * Add enhancement for Transaction Traces early access feature
-
-v2.3.1.
- * bugfixes
-
-v2.3.0.
- + Add support for Transaction Traces early access feature
-
-v2.2.2.
- * bugfixes
-
-v2.2.1.
- + Add rails 2.1 support for Developer Mode
- + Changes to memory sampler: Add support for JRuby and fix Solaris support.
- * Stop catching exceptions and start catching StandardError; other exception cleanup
- * Add protective exception catching to the stats engine
- * Improved support for thin domain sockets
- * Support JRuby environments
-
-v2.1.6.
- * bugfixes
-
-v2.1.5.
- * bugfixes
-
-v2.1.4.
- * bugfixes
-
-v2.1.3.
- * bugfixes
-
-v2.1.2.
- * bugfixes
-
-v2.1.1.
- * bugfixes
-
-v2.1.0.
- * release for private beta
-
-
View
15 v2_13_1/InstallationNotes.md
@@ -1,15 +0,0 @@
-
-PLEASE NOTE:
-
-Developer Mode is now a Rack middleware.
-
-RPM Developer Mode is no longer available in Rails 2.1 and earlier.
-However, starting in version 2.12 you can use Developer Mode in any
-Rack based framework, in addition to Rails. To install developer mode
-in a non-Rails application, just add NewRelic::Rack::DeveloperMode to
-your middleware stack.
-
-If you are using JRuby, we recommend using at least version 1.4 or
-later because of issues with the implementation of the timeout library.
-
-Refer to the README.md file for more information.
View
37 v2_13_1/LICENSE
@@ -1,37 +0,0 @@
-Copyright (c) 2008-2009 New Relic, Inc. All rights reserved.
-
-Certain inventions disclosed in this file may be claimed within
-patents owned or patent applications filed by New Relic, Inc. or third
-parties.
-
-Subject to the terms of this notice, New Relic grants you a
-nonexclusive, nontransferable license, without the right to
-sublicense, to (a) install and execute one copy of these files on any
-number of workstations owned or controlled by you and (b) distribute
-verbatim copies of these files to third parties. As a condition to the
-foregoing grant, you must provide this notice along with each copy you
-distribute and you must not remove, alter, or obscure this notice. All
-other use, reproduction, modification, distribution, or other
-exploitation of these files is strictly prohibited, except as may be set
-forth in a separate written license agreement between you and New
-Relic. The terms of any such license agreement will control over this
-notice. The license stated above will be automatically terminated and
-revoked if you exceed its scope or violate any of the terms of this
-notice.
-
-This License does not grant permission to use the trade names,
-trademarks, service marks, or product names of New Relic, except as
-required for reasonable and customary use in describing the origin of
-this file and reproducing the content of this notice. You may not
-mark or brand this file with any trade name, trademarks, service
-marks, or product names other than the original brand (if any)
-provided by New Relic.
-
-Unless otherwise expressly agreed by New Relic in a separate written
-license agreement, these files are provided AS IS, WITHOUT WARRANTY OF
-ANY KIND, including without any implied warranties of MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, TITLE, or NON-INFRINGEMENT. As a
-condition to your use of these files, you are solely responsible for
-such use. New Relic will have no liability to you for direct,
-indirect, consequential, incidental, special, or punitive damages or
-for lost profits or data.
View
172 v2_13_1/README.rdoc
@@ -1,172 +0,0 @@
-= New Relic RPM
-
-New Relic RPM is a Ruby performance management system, developed by
-New Relic, Inc (http://www.newrelic.com). RPM provides you with deep
-information about the performance of your Ruby on Rails or Merb
-application as it runs in production. The New Relic Agent is
-dual-purposed as a either a Rails plugin or a Gem, hosted on
-github[http://github.com/newrelic/rpm/tree/master] and Rubyforge.
-
-The New Relic Agent runs in one of two modes:
-
-==== Production Mode
-
-Low overhead instrumentation that captures detailed information on
-your application running in production and transmits them to
-rpm.newrelic.com where you can monitor them in real time.
-
-==== Developer Mode
-
-A Rack middleware that maps /newrelic to an application for showing
-detailed performance metrics on a page by page basis. Installed
-automatically in Rails applications.
-
-== Supported Environments
-
-* Ruby 1.8.6, 1.8.7 or 1.9.1, including REE
-* JRuby 1.3 minimum
-* Rails 1.2.6 or later for Production Mode
-* Rails 2.2 or later for Developer Mode
-* Merb 1.0 or later
-* Sinatra
-* Rack
-
-Any Rack based framework should work but may not be tested. Install
-RPM as a gem and add the Developer Mode middleware if desired. Report
-any problems to support@newrelic.com.
-
-You can also monitor non-web applications. Refer to the "Other
-Environments" section under "Getting Started".
-
-= Getting Started
-
-Install the RPM agent as a gem. If you are using Rails you can
-install the gem as a plug-in--details below.
-
- gem install newrelic_rpm
-
-To monitor your applications in production, create an account at
-http://newrelic.com/get-RPM.html. There you can
-sign up for a free Lite account or one of our paid subscriptions.
-
-Once you receive the welcome e-mail with a license key and
-+newrelic.yml+ file, copy the +newrelic.yml+ file into your app config
-directory.
-
-All agent configuration is done in the +newrelic.yml+ file. This file
-is by default read from the +config+ directory of the application root
-and is subsequently searched for in the application root directory,
-and then in a <tt>~/.newrelic</tt> directory
-
-=== Rails Installation
-
-You can install the agent as a plug-in or a Gem. To install the agent
-as a Rails plug-in, do the following:
-
- script/plugin install http://newrelic.rubyforge.org/svn/newrelic_rpm
-
-If using the Agent as a gem, edit +environment.rb+ and add to the initalizer block:
-
- config.gem "newrelic_rpm"
-
-=== Merb Installation
-
-To monitor a merb app install the newrelic_rpm gem and add
-
- dependency 'newrelic_rpm'
-
-to your init.rb file.
-
-=== Sinatra Installation
-
-To use RPM with a Sinatra app, add
- require 'newrelic_rpm'
-in your Sinatra app, below the Sinatra require directive.
-
-Then make sure you set RACK_ENV to the environment corresponding to the
-configuration definitions in the newrelic.yml file; i.e., development,
-staging, production, etc.
-
-To use Developer Mode in Sinatra, add NewRelic::Rack::DeveloperMode to
-the middleware stack. See the +config.ru+ sample below.
-
-=== Other Environments
-
-You can use RPM to monitor any Ruby application. Add
- require 'newrelic_rpm'
-to your startup sequence and then manually start the agent using
- NewRelic::Agent.manual_start
-
-To instrument Rack based applications, refer to the docs in
-NewRelic::Agent::Instrumentation::Rack.
-
-Refer to the docs in NewRelic for details on how to monitor other web
-frameworks, background jobs, and daemons.
-
-Also, see if your environment is already supported by the
-rpm_contrib[http://newrelic.github.com/rpm_contrib] gem.
-
-== Developer Mode
-
-When running the RPM Developer Mode, the RPM Agent will track the
-performance of every HTTP request serviced by your application, and
-store in memory this information for the last 100 HTTP transactions.
-
-To view this performance information, including detailed SQL statement
-analysis, open +/newrelic+ in your web application. For instance if
-you are running mongrel or thin on port 3000, enter the following into
-your browser:
-
- http://localhost:3000/newrelic
-
-Developer Mode is only initialized if the +developer_mode+ setting in
-the newrelic.yml file is set to true. By default, it is turned off in
-all environments but +development+.
-
-==== Developer Mode in Rails
-
-Developer Mode is available automatically in Rails Applications
-based on Rails 2.3 and later. No additional configuration is
-required.
-
-For earlier versions of Rails that support Rack, you can use
-a +config.ru+ as below.
-
-==== Developer Mode in Rack Applications
-
-Developer Mode is available for any Rack based application such as
-Sinatra by installing the NewRelic::Rack::DeveloperMode
-middleware. This middleware passes all requests that do not start with
-/newrelic.
-
-Here's an example entry for Developer Mode in a +config.ru+ file:
-
- require 'new_relic/rack_app'
- use NewRelic::Rack::DeveloperMode
-
-
-== Production Mode
-
-When your application runs in the production environment, the New
-Relic agent runs in production mode. It connects to the New Relic RPM
-service and sends deep performance data to the RPM service for your
-analysis. To view this data, log in to http://rpm.newrelic.com.
-
-NOTE: You must have a valid account and license key to view this data
-online. Refer to instructions in *Getting Started*, below.
-
-
-= Support
-
-Reach out to us--and to fellow RPM users--at
-support.newrelic.com[http://support.newrelic.com/discussions/support].
-There you'll find documentation, FAQs, and forums where you can submit
-suggestions and discuss RPM with New Relic staff and other users.
-
-Find a bug? E-mail support@newrelic.com, or post it to
-support.newrelic.com[http://support.newrelic.com/discussions/support].
-
-Thank you, and may your application scale to infinity plus one.
-
-Lew Cirne, Founder and CEO<br/>
-New Relic, Inc.
View
111 v2_13_1/Rakefile
@@ -1,111 +0,0 @@
-require 'rubygems'
-require 'rake'
-require "#{File.dirname(__FILE__)}/lib/new_relic/version.rb"
-require 'rake/testtask'
-
-GEM_NAME = "newrelic_rpm"
-GEM_VERSION = NewRelic::VERSION::STRING
-AUTHORS = "Bill Kayser", "Justin George"
-EMAIL = "support@newrelic.com"
-HOMEPAGE = "http://www.github.com/newrelic/rpm"
-SUMMARY = "New Relic Ruby Performance Monitoring Agent"
-INSTALLATION_NOTES = "InstallationNotes.md"
-RDOC_FILES = FileList['README*','LICENSE','newrelic.yml', 'CHANGELOG']
-
-DESCRIPTION = <<-EOF
-New Relic RPM is a Ruby performance management system, developed by
-New Relic, Inc (http://www.newrelic.com). RPM provides you with deep
-information about the performance of your Ruby on Rails or Merb
-application as it runs in production. The New Relic Agent is
-dual-purposed as a either a Rails plugin or a Gem, hosted on
-http://github.com/newrelic/rpm/tree/master.
-EOF
-
-INSTALLATION_POSTSCRIPT = <<-EOF
-
-Please see http://support.newrelic.com/faqs/docs/ruby-agent-release-notes
-for a complete description of the features and enhancements available
-in version #{GEM_VERSION.split('.')[0..1].join('.')} of the Ruby Agent.
-
-For details on this specific release, refer to the CHANGELOG file.
-
-Notice: Developer Mode now supports only Rails 2.3+ - refer to README
-for instructions for previous versions
-
-EOF
-
-# See http://www.rubygems.org/read/chapter/20
-
-begin
- require 'jeweler'
- Jeweler::Tasks.new do |gem|
- gem.name = GEM_NAME
- gem.description = DESCRIPTION
- gem.summary = SUMMARY
- gem.email = EMAIL
- gem.homepage = HOMEPAGE
- gem.authors = AUTHORS
- gem.version = GEM_VERSION
- gem.files = FileList['**/*']
- gem.test_files = [] # You can't really run the tests unless the gem is installed.
- gem.rdoc_options <<
- "--line-numbers" <<
- "--inline-source" <<
- "--title" << SUMMARY
- "-m" << "README.rdoc"
- gem.files.reject! { |fn| fn =~ /Rakefile|init.rb|#{INSTALLATION_NOTES}|pkg\// }
- gem.add_development_dependency "jeweler"
- gem.add_development_dependency "mocha"
- gem.add_development_dependency "shoulda"
- gem.extra_rdoc_files = RDOC_FILES
- if File.exists?(INSTALLATION_NOTES)
- gem.post_install_message = File.read(INSTALLATION_NOTES) + INSTALLATION_POSTSCRIPT
- else
- gem.post_install_message = INSTALLATION_POSTSCRIPT
- end
- end
- Jeweler::GemcutterTasks.new
-rescue LoadError
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
-end
-
-
-load "#{File.dirname(__FILE__)}/lib/tasks/all.rb"
-
-task :manifest do
- puts "Manifest task is no longer used since switching to jeweler."
-end
-
-task :test => Rake::Task['test:newrelic']
-
-begin
- require 'rcov/rcovtask'
- Rcov::RcovTask.new do |test|
- test.libs << 'test'
- test.pattern = 'test/**/test_*.rb'
- test.verbose = true
- end
-rescue LoadError
- task :rcov do
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
- end
-end
-
-task :test => :check_dependencies
-
-task :default => :test
-
-require 'rake/rdoctask'
-Rake::RDocTask.new do |rdoc|
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = "#{SUMMARY} (v#{GEM_VERSION})"
- rdoc.main = "README.rdoc"
- rdoc.rdoc_files = FileList['lib/**/*.rb'] + RDOC_FILES
- rdoc.inline_source = true
-end
-
-begin
- require 'sdoc_helpers'
-rescue LoadError
- puts "sdoc support not enabled. Please gem install sdoc-helpers."
-end
View
33 v2_13_1/bin/mongrel_rpm
@@ -1,33 +0,0 @@
-#!/usr/bin/env ruby
-require 'rubygems'
-require 'rack'
-require 'rack/handler/mongrel'
-require 'optparse'
-
-port = 3000
-options = { }
-appname = nil
-OptionParser.new do |opts|
- opts.banner = "Usage: #{File.basename($0)} [options] [app_name]"
- opts.on("-p", "--port=port", Integer, "default: #{port}") { | port | }
- opts.on("--[no-]logging", "turn off request logging" ) { | l | options[:logging] = l }
- opts.on("--license=rpm_license_key", "override license key" ) { | l | options[:license_key] = l }
- opts.on("--install", "install a newrelic.yml template" ) { | l | options[:install] = true }
- opts.separator ""
- opts.separator "app_name is the name of the application where the metrics will be stored"
- opts.separator ""
- # The rackup file references this var
- appname = opts.parse!(ARGV.clone).first
-end
-
-options[:app_name] = appname if appname
-
-ru_file = File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "new_relic", "rack", "mongrel_rpm.ru"))
-rackup_code = File.read ru_file
-builder = Rack::Builder.new { eval rackup_code, binding, ru_file }
-
-options = { :Host => '127.0.0.1', :Port => port }
-Rack::Handler::Mongrel.run(builder.to_app, options) do | server |
- NewRelic::Control.instance.log! "Started Mongrel listening for '#{NewRelic::Control.instance.app_names.join(" and ")}' data at #{server.host}:#{server.port}"
-end
-
View
13 v2_13_1/bin/newrelic
@@ -1,13 +0,0 @@
-#!/usr/bin/env ruby
-# executes one of the commands in the new_relic/commands directory
-# pass the name of the command as an argument
-
-$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), '..','lib'))
-require 'new_relic/command'
-begin
- NewRelic::Command.run
-rescue NewRelic::Command::CommandFailure => failure
- STDERR.puts failure.message
- STDERR.puts failure.options if failure.options
- exit 1
-end
View
5 v2_13_1/bin/newrelic_cmd
@@ -1,5 +0,0 @@
-#!/usr/bin/env ruby
-# This command has been renamed "newrelic"
-# executes one of the commands in the new_relic/commands directory
-# pass the name of the command as an argument
-load File.dirname(__FILE__) + '/newrelic'
View
34 v2_13_1/cert/cacert.pem
@@ -1,34 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRp
-b24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs
-YXNzIDEgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZh
-bGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNTIy
-MjM0OFoXDTE5MDYyNTIyMjM0OFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0
-d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDEg
-UG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0
-LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMIGfMA0GCSqGSIb3DQEBAQUA
-A4GNADCBiQKBgQDYWYJ6ibiWuqYvaG9YLqdUHAZu9OqNSLwxlBfw8068srg1knaw0KWlAdcAAxIi
-GQj4/xEjm84H9b9pGib+TunRf50sQB1ZaG6m+FiwnRqP0z/x3BkGgagO4DrdyFNFCQbmD3DD+kCm
-DuJWBQ8YTfwggtFzVXSNdnKgHZ0dwN0/cQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFBoPUn0LBwG
-lN+VYH+Wexf+T3GtZMjdd9LvWVXoP+iOBSoh8gfStadS/pyxtuJbdxdA6nLWI8sogTLDAHkY7FkX
-icnGah5xyf23dKUlRWnFSKsZ4UWKJWsZ7uW7EvV/96aNUcPwnXS3qT6gpf+2SQMT2iLM7XGCK5nP
-Orf1LXLI
------END CERTIFICATE-----
-
------BEGIN CERTIFICATE-----
-MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRp
-b24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs
-YXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZh
-bGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAw
-MTk1NFoXDTE5MDYyNjAwMTk1NFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0
-d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDIg
-UG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0
-LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMIGfMA0GCSqGSIb3DQEBAQUA
-A4GNADCBiQKBgQDOOnHK5avIWZJV16vYdA757tn2VUdZZUcOBVXc65g2PFxTXdMwzzjsvUGJ7SVC
-CSRrCl6zfN1SLUzm1NZ9WlmpZdRJEy0kTRxQb7XBhVQ7/nHk01xC+YDgkRoKWzk2Z/M/VXwbP7Rf
-ZHM047QSv4dk+NoS/zcnwbNDu+97bi5p9wIDAQABMA0GCSqGSIb3DQEBBQUAA4GBADt/UG9vUJSZ
-SWI4OB9L+KXIPqeCgfYrx+jFzug6EILLGACOTb2oWH+heQC1u+mNr0HZDzTuIYEZoDJJKPTEjlbV
-UjP9UNV+mWwD5MlM/Mtsq2azSiGM5bUMMj4QssxsodyamEwCW/POuZ6lcg5Ktz885hZo+L7tdEy8
-W9ViH0Pd
------END CERTIFICATE-----
-
View
37 v2_13_1/init.rb
@@ -1,37 +0,0 @@
-# This is the initialization for the RPM Rails plugin
-require 'new_relic/control'
-
-# If you are having problems seeing data, be sure and check the
-# newrelic_agent log files.
-#
-# If you can't find any log files and you don't see anything in your
-# application log files, try uncommenting the two lines at the
-# bottom of this file to verify the plugin is being loaded,
-# then send the output to support@newrelic.com if you are unable to
-# resolve the issue.
-
-# Initializer for the NewRelic Agent
-
-# After verison 2.0 of Rails we can access the configuration directly.
-# We need it to add dev mode routes after initialization finished.
-
-begin
-
- current_config = if defined?(config)
- config
- elsif defined?(Rails.configuration)
- Rails.configuration
- end
-
- NewRelic::Control.instance.init_plugin :config => current_config
-
-rescue => e
- NewRelic::Control.instance.log! "Error initializing New Relic plugin (#{e})", :error
- NewRelic::Control.instance.log! e.backtrace.join("\n"), :error
- NewRelic::Control.instance.log! "Agent is disabled."
-end
-
-#ClassLoadingWatcher.flag_const_missing = nil
-#
-# ::RAILS_DEFAULT_LOGGER.warn "RPM detected environment: #{NewRelic::Control.instance.local_env.to_s}, RAILS_ENV: #{RAILS_ENV}"
-# ::RAILS_DEFAULT_LOGGER.warn "Enabled? #{NewRelic::Control.instance.agent_enabled?}"
View
9 v2_13_1/install.rb
@@ -1,9 +0,0 @@
-if __FILE__ == $0 || $0 =~ /script\/plugin/
- $LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), 'lib'))
- require 'new_relic/command'
- begin
- NewRelic::Command::Install.new(:quiet => true, :app_name => 'My Application').run
- rescue NewRelic::Command::CommandFailure => e
- $stderr.puts e.message
- end
-end
View
382 v2_13_1/lib/new_relic/agent.rb
@@ -1,382 +0,0 @@
-# = New Relic RPM Agent
-#
-# New Relic RPM is a performance monitoring application for Ruby
-# applications running in production. For more information on RPM
-# please visit http://www.newrelic.com.
-#
-# The New Relic Agent can be installed in Rails applications to gather
-# runtime performance metrics, traces, and errors for display in a
-# Developer Mode UI (mapped to /newrelic in your application server)
-# or for monitoring and analysis at http://rpm.newrelic.com with just
-# about any Ruby application.
-#
-# == Getting Started
-# For instructions on installation and setup, see
-# the README[link:./files/README_rdoc.html] file.
-#
-# == Using with Rack/Metal
-#
-# To instrument Rack middlwares or Metal apps, refer to the docs in
-# NewRelic::Agent::Instrumentation::Rack.
-#
-# == Agent API
-#
-# For details on the Agent API, refer to NewRelic::Agent.
-#
-# == Customizing RPM
-#
-# For detailed information on customizing the RPM Agent
-# please visit our {support and documentation site}[http://support.newrelic.com].
-#
-module NewRelic
- # == Agent APIs
- # This module contains the public API methods for the Agent.
- #
- # For adding custom instrumentation to method invocations, refer to
- # the docs in the class NewRelic::Agent::MethodTracer.
- #
- # For information on how to customize the controller
- # instrumentation, or to instrument something other than Rails so
- # that high level dispatcher actions or background tasks show up as
- # first class operations in RPM, refer to
- # NewRelic::Agent::Instrumentation::ControllerInstrumentation and
- # NewRelic::Agent::Instrumentation::ControllerInstrumentation::ClassMethods.
- #
- # Methods in this module as well as documented methods in
- # NewRelic::Agent::MethodTracer and
- # NewRelic::Agent::Instrumentation::ControllerInstrumentation are
- # available to applications. When the agent is not enabled the
- # method implementations are stubbed into no-ops to reduce overhead.
- #
- # Methods and classes in other parts of the agent are not guaranteed
- # to be available between releases.
- #
- # Refer to the online docs at support.newrelic.com to see how to
- # access the data collected by custom instrumentation, or e-mail
- # support at New Relic for help.
- module Agent
- extend self
-
- require 'new_relic/version'
- require 'new_relic/local_environment'
- require 'new_relic/stats'
- require 'new_relic/metrics'
- require 'new_relic/metric_spec'
- require 'new_relic/metric_data'
- require 'new_relic/metric_parser'
- require 'new_relic/collection_helper'
- require 'new_relic/transaction_analysis'
- require 'new_relic/transaction_sample'
- require 'new_relic/url_rule'
- require 'new_relic/noticed_error'
- require 'new_relic/histogram'
- require 'new_relic/timer_lib'
-
- require 'new_relic/agent/chained_call'
- require 'new_relic/agent/agent'
- require 'new_relic/agent/shim_agent'
- require 'new_relic/agent/method_tracer'
- require 'new_relic/agent/worker_loop'
- require 'new_relic/agent/stats_engine'
- require 'new_relic/agent/transaction_sampler'
- require 'new_relic/agent/error_collector'
- require 'new_relic/agent/busy_calculator'
- require 'new_relic/agent/sampler'
-
- require 'new_relic/agent/instrumentation/controller_instrumentation'
-
- require 'new_relic/agent/samplers/cpu_sampler'
- require 'new_relic/agent/samplers/memory_sampler'
- require 'new_relic/agent/samplers/object_sampler'
- require 'new_relic/agent/samplers/delayed_job_lock_sampler'
- require 'set'
- require 'thread'
- require 'resolv'
-
- # An exception that is thrown by the server if the agent license is invalid.
- class LicenseException < StandardError; end
-
- # An exception that forces an agent to stop reporting until its mongrel is restarted.
- class ForceDisconnectException < StandardError; end
-
- # An exception that forces an agent to restart.
- class ForceRestartException < StandardError; end
-
- # Used to blow out of a periodic task without logging a an error, such as for routine
- # failures.
- class ServerConnectionException < StandardError; end
-
- # Used for when a transaction trace or error report has too much
- # data, so we reset the queue to clear the extra-large item
- class PostTooBigException < ServerConnectionException; end
-
- # Reserved for future use. Meant to represent a problem on the server side.
- class ServerError < StandardError; end
-
- class BackgroundLoadingError < StandardError; end
-
- @agent = nil
-
- # The singleton Agent instance. Used internally.
- def agent #:nodoc:
- raise "Plugin not initialized!" if @agent.nil?
- @agent
- end
-
- def agent= new_instance #:nodoc:
- @agent = new_instance
- end
-
- alias instance agent #:nodoc:
-
- # Get or create a statistics gatherer that will aggregate numerical data
- # under a metric name.
- #
- # +metric_name+ should follow a slash separated path convention. Application
- # specific metrics should begin with "Custom/".
- #
- # Return a NewRelic::Stats that accepts data
- # via calls to add_data_point(value).
- def get_stats(metric_name, use_scope=false)
- @agent.stats_engine.get_stats(metric_name, use_scope)
- end
-
- alias get_stats_no_scope get_stats
-
- # Get the logger for the agent. Available after the agent has initialized.
- # This sends output to the agent log file.
- def logger
- NewRelic::Control.instance.log
- end
-
- # Call this to manually start the Agent in situations where the Agent does
- # not auto-start.
- #
- # When the app environment loads, so does the Agent. However, the
- # Agent will only connect to RPM if a web front-end is found. If
- # you want to selectively monitor ruby processes that don't use
- # web plugins, then call this method in your code and the Agent
- # will fire up and start reporting to RPM.
- #
- # Options are passed in as overrides for values in the
- # newrelic.yml, such as app_name. In addition, the option +log+
- # will take a logger that will be used instead of the standard
- # file logger. The setting for the newrelic.yml section to use
- # (ie, RAILS_ENV) can be overridden with an :env argument.
- #
- def manual_start(options={})
- raise unless Hash === options
- NewRelic::Control.instance.init_plugin({ :agent_enabled => true, :sync_startup => true }.merge(options))
- end
-
- # Register this method as a callback for processes that fork
- # jobs.
- #
- # If the master/parent connects to the agent prior to forking the
- # agent in the forked process will use that agent_run. Otherwise
- # the forked process will establish a new connection with the
- # server.
- #
- # Use this especially when you fork the process to run background
- # jobs or other work. If you are doing this with a web dispatcher
- # that forks worker processes then you will need to force the
- # agent to reconnect, which it won't do by default. Passenger and
- # Unicorn are already handled, nothing special needed for them.
- #
- # Options:
- # * <tt>:force_reconnect => true</tt> to force the spawned process to
- # establish a new connection, such as when forking a long running process.
- # The default is false--it will only connect to the server if the parent
- # had not connected.
- # * <tt>:keep_retrying => false</tt> if we try to initiate a new
- # connection, this tells me to only try it once so this method returns
- # quickly if there is some kind of latency with the server.
- def after_fork(options={})
- agent.after_fork(options)
- end
-
- # Clear out any unsent metric data.
- def reset_stats
- agent.reset_stats
- end
-
- # Shutdown the agent. Call this before exiting. Sends any queued data
- # and kills the background thread.
- def shutdown
- agent.shutdown
- end
-
- # Add instrumentation files to the agent. The argument should be
- # a glob matching ruby scripts which will be executed at the time
- # instrumentation is loaded. Since instrumentation is not loaded
- # when the agent is not running it's better to use this method to
- # register instrumentation than just loading the files directly,
- # although that probably also works.
- def add_instrumentation file_pattern
- NewRelic::Control.instance.add_instrumentation file_pattern
- end
-
- # This method sets the block sent to this method as a sql
- # obfuscator. The block will be called with a single String SQL
- # statement to obfuscate. The method must return the obfuscated
- # String SQL. If chaining of obfuscators is required, use type =
- # :before or :after
- #
- # type = :before, :replace, :after
- #
- # Example:
- #
- # NewRelic::Agent.set_sql_obfuscator(:replace) do |sql|
- # my_obfuscator(sql)
- # end
- #
- def set_sql_obfuscator(type = :replace, &block)
- agent.set_sql_obfuscator type, &block
- end
-
-
- # This method sets the state of sql recording in the transaction
- # sampler feature. Within the given block, no sql will be recorded
- #
- # usage:
- #
- # NewRelic::Agent.disable_sql_recording do
- # ...
- # end
- #
- def disable_sql_recording
- state = agent.set_record_sql(false)
- begin
- yield
- ensure
- agent.set_record_sql(state)
- end
- end
-
- # This method disables the recording of transaction traces in the given
- # block. See also #disable_all_tracing
- def disable_transaction_tracing
- state = agent.set_record_tt(false)
- begin
- yield
- ensure
- agent.set_record_tt(state)
- end
- end
-
- # Cancel the collection of the current transaction in progress, if
- # any. Only affects the transaction started on this thread once
- # it has started and before it has completed.
- def abort_transaction!
- # The class may not be loaded if the agent is disabled
- if defined? NewRelic::Agent::Instrumentation::MetricFrame
- NewRelic::Agent::Instrumentation::MetricFrame.abort_transaction!
- end
- end
-
- # Yield to the block without collecting any metrics or traces in
- # any of the subsequent calls. If executed recursively, will keep
- # track of the first entry point and turn on tracing again after
- # leaving that block. This uses the thread local
- # +newrelic_untrace+
- def disable_all_tracing
- agent.push_trace_execution_flag(false)
- yield
- ensure
- agent.pop_trace_execution_flag
- end
-
- # Check to see if we are capturing metrics currently on this thread.
- def is_execution_traced?
- Thread.current[:newrelic_untraced].nil? || Thread.current[:newrelic_untraced].last != false
- end
-
- # Set a filter to be applied to errors that RPM will track. The
- # block should evalute to the exception to track (which could be
- # different from the original exception) or nil to ignore this
- # exception.
- #
- # The block is yielded to with the exception to filter.
- #
- # Return the new block or the existing filter Proc if no block is passed.
- #
- def ignore_error_filter(&block)
- agent.error_collector.ignore_error_filter(&block)
- end
-
- # Record the given error in RPM. It will be passed through the
- # #ignore_error_filter if there is one.
- #
- # * <tt>exception</tt> is the exception which will be recorded. May also be
- # an error message.
- # Options:
- # * <tt>:uri</tt> => The request path, minus any request params or query string.
- # * <tt>:referer</tt> => The URI of the referer
- # * <tt>:metric</tt> => The metric name associated with the transaction
- # * <tt>:request_params</tt> => Request parameters, already filtered if necessary
- # * <tt>:custom_params</tt> => Custom parameters
- #
- # Anything left over is treated as custom params.
- #
- def notice_error(exception, options={})
- NewRelic::Agent::Instrumentation::MetricFrame.notice_error(exception, options)
- end
-
- # Add parameters to the current transaction trace (and traced error if any)
- # on the call stack.
- #
- def add_custom_parameters(params)
- NewRelic::Agent::Instrumentation::MetricFrame.add_custom_parameters(params)
- end
-
- # The #add_request_parameters method is aliased to #add_custom_parameters
- # and is now deprecated.
- alias add_request_parameters add_custom_parameters #:nodoc:
-
- # Yield to a block that is run with a database metric name
- # context. This means the Database instrumentation will use this
- # for the metric name if it does not otherwise know about a model.
- # This is re-entrant.
- #
- # * <tt>model</tt> is the DB model class
- # * <tt>method</tt> is the name of the finder method or other
- # method to identify the operation with.
- def with_database_metric_name(model, method, &block)
- if frame = NewRelic::Agent::Instrumentation::MetricFrame.current
- frame.with_database_metric_name(model, method, &block)
- else
- yield
- end
- end
-
- # Record a web transaction from an external source. This will
- # process the response time, error, and score an apdex value.
- #
- # First argument is a float value, time in seconds. Option
- # keys are strings.
- #
- # == Identifying the transaction
- # * <tt>'uri' => uri</tt> to record the value for a given web request.
- # If not provided, just record the aggregate dispatcher and apdex scores.
- # * <tt>'metric' => metric_name</tt> to record with a general metric name
- # like +OtherTransaction/Background/Class/method+. Ignored if +uri+ is
- # provided.
- #
- # == Error options
- # Provide one of the following:
- # * <tt>'is_error' => true</tt> if an unknown error occurred
- # * <tt>'error_message' => msg</tt> if an error message is available
- # * <tt>'exception' => exception</tt> if a ruby exception is recorded
- #
- # == Misc options
- # Additional information captured in errors
- # * <tt>'referer' => referer_url</tt>
- # * <tt>'request_params' => hash</tt> to record a set of name/value pairs as the
- # request parameters.
- # * <tt>'custom_params' => hash</tt> to record extra information in traced errors
- #
- def record_transaction(response_sec, options = {})
- agent.record_transaction(response_sec, options)
- end
- end
-end
View
741 v2_13_1/lib/new_relic/agent/agent.rb
@@ -1,741 +0,0 @@
-require 'socket'
-require 'net/https'
-require 'net/http'
-require 'logger'
-require 'zlib'
-require 'stringio'
-
-module NewRelic
- module Agent
-
- # The Agent is a singleton that is instantiated when the plugin is
- # activated. It collects performance data from ruby applications
- # in realtime as the application runs, and periodically sends that
- # data to the NewRelic server.
- class Agent
-
- # Specifies the version of the agent's communication protocol with
- # the NewRelic hosted site.
-
- PROTOCOL_VERSION = 8
- # 14105: v8 (tag 2.10.3)
- # (no v7)
- # 10379: v6 (not tagged)
- # 4078: v5 (tag 2.5.4)
- # 2292: v4 (tag 2.3.6)
- # 1754: v3 (tag 2.3.0)
- # 534: v2 (shows up in 2.1.0, our first tag)
-
-
- def initialize
-
- @launch_time = Time.now
-
- @metric_ids = {}
- @histogram = NewRelic::Histogram.new(NewRelic::Control.instance.apdex_t / 10)
- @stats_engine = NewRelic::Agent::StatsEngine.new
- @transaction_sampler = NewRelic::Agent::TransactionSampler.new
- @stats_engine.transaction_sampler = @transaction_sampler
- @error_collector = NewRelic::Agent::ErrorCollector.new
-
- @request_timeout = NewRelic::Control.instance.fetch('timeout', 2 * 60)
-
- @last_harvest_time = Time.now
- @obfuscator = method(:default_sql_obfuscator)
- end
-
- module ClassMethods
- # Should only be called by NewRelic::Control
- def instance
- @instance ||= self.new
- end
- end
-
- module InstanceMethods
-
- attr_reader :obfuscator
- attr_reader :stats_engine
- attr_reader :transaction_sampler
- attr_reader :error_collector
- attr_reader :record_sql
- attr_reader :histogram
- attr_reader :metric_ids
- attr_reader :url_rules
-
- def record_transaction(duration_seconds, options={})
- is_error = options['is_error'] || options['error_message'] || options['exception']
- metric = options['metric']
- metric ||= options['uri'] # normalize this with url rules
- raise "metric or uri arguments required" unless metric
- metric_info = NewRelic::MetricParser::MetricParser.for_metric_named(metric)
-
- if metric_info.is_web_transaction?
- NewRelic::Agent::Instrumentation::MetricFrame.record_apdex(metric_info, duration_seconds, duration_seconds, is_error)
- histogram.process(duration_seconds)
- end
- metrics = metric_info.summary_metrics
-
- metrics << metric
- metrics.each do |name|
- stats = stats_engine.get_stats_no_scope(name)
- stats.record_data_point(duration_seconds)
- end
-
- if is_error
- if options['exception']
- e = options['exception']
- elsif options['error_message']
- e = Exception.new options['error_message']
- else
- e = Exception.new 'Unknown Error'
- end
- error_collector.notice_error e, :uri => options['uri'], :metric => metric
- end
- # busy time ?
- end
-
- # This method is deprecated. Use NewRelic::Agent.manual_start
- def manual_start(ignored=nil, also_ignored=nil)
- raise "This method no longer supported. Instead use the class method NewRelic::Agent.manual_start"
- end
-
- # This method should be called in a forked process after a fork.
- # It assumes the parent process initialized the agent, but does
- # not assume the agent started.
- #
- # The call is idempotent, but not re-entrant.
- #
- # * It clears any metrics carried over from the parent process
- # * Restarts the sampler thread if necessary
- # * Initiates a new agent run and worker loop unless that was done
- # in the parent process and +:force_reconnect+ is not true
- #
- # Options:
- # * <tt>:force_reconnect => true</tt> to force the spawned process to
- # establish a new connection, such as when forking a long running process.
- # The default is false--it will only connect to the server if the parent
- # had not connected.
- # * <tt>:keep_retrying => false</tt> if we try to initiate a new
- # connection, this tells me to only try it once so this method returns
- # quickly if there is some kind of latency with the server.
- def after_fork(options={})
-
- # @connected gets false after we fail to connect or have an error
- # connecting. @connected has nil if we haven't finished trying to connect.
- # or we didn't attempt a connection because this is the master process
-
- # log.debug "Agent received after_fork notice in #$$: [#{control.agent_enabled?}; monitor=#{control.monitor_mode?}; connected: #{@connected.inspect}; thread=#{@worker_thread.inspect}]"
- return if !control.agent_enabled? or
- !control.monitor_mode? or
- @connected == false or
- @worker_thread && @worker_thread.alive?
-
- log.info "Starting the worker thread in #$$ after forking."
-
- # Clear out stats that are left over from parent process
- reset_stats
-
- # Don't ever check to see if this is a spawner. If we're in a forked process
- # I'm pretty sure we're not also forking new instances.
- start_worker_thread(options)
- @stats_engine.start_sampler_thread
- end
-
- # True if we have initialized and completed 'start'
- def started?
- @started
- end
-
- # Return nil if not yet connected, true if successfully started
- # and false if we failed to start.
- def connected?
- @connected
- end
-
- # Attempt a graceful shutdown of the agent.
- def shutdown
- return if not started?
- if @worker_loop
- @worker_loop.stop
-
- log.debug "Starting Agent shutdown"
-
- # if litespeed, then ignore all future SIGUSR1 - it's
- # litespeed trying to shut us down
-
- if control.dispatcher == :litespeed
- Signal.trap("SIGUSR1", "IGNORE")
- Signal.trap("SIGTERM", "IGNORE")
- end
-
- begin
- NewRelic::Agent.disable_all_tracing do
- graceful_disconnect
- end
- rescue => e
- log.error e
- log.error e.backtrace.join("\n")
- end
- end
- @started = nil
- end
-
- def start_transaction
- @stats_engine.start_transaction
- end
-
- def end_transaction
- @stats_engine.end_transaction
- end
-
- def set_record_sql(should_record)
- prev = Thread::current[:record_sql]
- Thread::current[:record_sql] = should_record
- prev.nil? || prev
- end
-
- def set_record_tt(should_record)
- prev = Thread::current[:record_tt]
- Thread::current[:record_tt] = should_record
- prev.nil? || prev
- end
- # Push flag indicating whether we should be tracing in this
- # thread.
- def push_trace_execution_flag(should_trace=false)
- (Thread.current[:newrelic_untraced] ||= []) << should_trace
- end
-
- # Pop the current trace execution status. Restore trace execution status
- # to what it was before we pushed the current flag.
- def pop_trace_execution_flag
- Thread.current[:newrelic_untraced].pop if Thread.current[:newrelic_untraced]
- end
-
- def set_sql_obfuscator(type, &block)
- if type == :before
- @obfuscator = NewRelic::ChainedCall.new(block, @obfuscator)
- elsif type == :after
- @obfuscator = NewRelic::ChainedCall.new(@obfuscator, block)
- elsif type == :replace
- @obfuscator = block
- else
- fail "unknown sql_obfuscator type #{type}"
- end
- end
-
- def log
- NewRelic::Agent.logger
- end
-
- # Start up the agent. This verifies that the agent_enabled? is
- # true and initializes the sampler based on the current
- # configuration settings. Then it will fire up the background
- # thread for sending data to the server if applicable.
- def start
- if started?
- control.log! "Agent Started Already!", :error
- return
- end
- return if !control.agent_enabled?
- @started = true
- @local_host = determine_host
-
- if control.dispatcher.nil? || control.dispatcher.to_s.empty?
- log.info "No dispatcher detected."
- else
- log.info "Dispatcher: #{control.dispatcher.to_s}"
- end
- log.info "Application: #{control.app_names.join(", ")}" unless control.app_names.empty?
-
- sampler_config = control.fetch('transaction_tracer', {})
- # TODO: Should move this state into the transaction sampler instance
- @should_send_samples = @config_should_send_samples = sampler_config.fetch('enabled', true)
- @should_send_random_samples = sampler_config.fetch('random_sample', false)
- @explain_threshold = sampler_config.fetch('explain_threshold', 0.5).to_f
- @explain_enabled = sampler_config.fetch('explain_enabled', true)
- @record_sql = sampler_config.fetch('record_sql', :obfuscated).to_sym
-
- # use transaction_threshold: 4.0 to force the TT collection
- # threshold to 4 seconds
- # use transaction_threshold: apdex_f to use your apdex t value
- # multiplied by 4
- # undefined transaction_threshold defaults to 2.0
- apdex_f = 4 * NewRelic::Control.instance.apdex_t
- @slowest_transaction_threshold = sampler_config.fetch('transaction_threshold', 2.0)
- if @slowest_transaction_threshold =~ /apdex_f/i
- @slowest_transaction_threshold = apdex_f
- end
- @slowest_transaction_threshold = @slowest_transaction_threshold.to_f
-
- log.warn "Agent is configured to send raw SQL to RPM service" if @record_sql == :raw
-
- case
- when !control.monitor_mode?
- log.warn "Agent configured not to send data in this environment - edit newrelic.yml to change this"
- when !control.license_key
- log.error "No license key found. Please edit your newrelic.yml file and insert your license key."
- when control.license_key.length != 40
- log.error "Invalid license key: #{control.license_key}"
- when [:passenger, :unicorn].include?(control.dispatcher)
- log.info "Connecting workers after forking."
- else
- # Do the connect in the foreground if we are in sync mode
- NewRelic::Agent.disable_all_tracing { connect(:keep_retrying => false) } if control.sync_startup
-
- # Start the event loop and initiate connection if necessary
- start_worker_thread
-
- # Our shutdown handler needs to run after other shutdown handlers
- # that may be doing things like running the app (hello sinatra).
- if control.send_data_on_exit
- if RUBY_VERSION =~ /rubinius/i
- list = at_exit { shutdown }
- # move the shutdown handler to the front of the list, to
- # execute last:
- list.unshift(list.pop)
- elsif !defined?(JRuby) or !defined?(Sinatra::Application)
- at_exit { at_exit { shutdown } }
- end
- end
- end
- log.info "New Relic RPM Agent #{NewRelic::VERSION::STRING} Initialized: pid = #$$"
- log.info "Agent Log found in #{NewRelic::Control.instance.log_file}" if NewRelic::Control.instance.log_file
- end
-
- # Clear out the metric data, errors, and transaction traces. Reset the histogram data.
- def reset_stats
- @stats_engine.reset_stats
- @unsent_errors = []
- @traces = nil
- @unsent_timeslice_data = {}
- @last_harvest_time = Time.now
- @launch_time = Time.now
- @histogram = NewRelic::Histogram.new(NewRelic::Control.instance.apdex_t / 10)
- end
-
- private
- def collector
- @collector ||= control.server
- end
-
- # Try to launch the worker thread and connect to the server.
- #
- # See #connect for a description of connection_options.
- def start_worker_thread(connection_options = {})
- log.debug "Creating RPM worker thread."
- @worker_thread = Thread.new do
- begin
- NewRelic::Agent.disable_all_tracing do
- # We try to connect. If this returns false that means
- # the server rejected us for a licensing reason and we should
- # just exit the thread. If it returns nil
- # that means it didn't try to connect because we're in the master.
- connect(connection_options)
- if @connected
- # disable transaction sampling if disabled by the server and we're not in dev mode
- if !control.developer_mode? && !@should_send_samples
- @transaction_sampler.disable
- else
- @transaction_sampler.enable # otherwise ensure TT's are enabled
- end
-
- log.info "Reporting performance data every #{@report_period} seconds."
- log.debug "Running worker loop"
- # Note if the agent attempts to report more frequently than allowed by the server
- # the server will start dropping data.
- @worker_loop = WorkerLoop.new
- @worker_loop.run(@report_period) do
- harvest_and_send_timeslice_data
- harvest_and_send_slowest_sample if @should_send_samples
- harvest_and_send_errors if error_collector.enabled
- end
- else
- log.debug "No connection. Worker thread finished."
- end
- end
- rescue NewRelic::Agent::ForceRestartException => e
- log.info e.message
- # disconnect and start over.
- # clear the stats engine
- reset_stats
- @metric_ids = {}
- @connected = nil
- # Wait a short time before trying to reconnect
- sleep 30
- retry
- rescue NewRelic::Agent::ForceDisconnectException => e
- # when a disconnect is requested, stop the current thread, which
- # is the worker thread that gathers data and talks to the
- # server.
- log.error "RPM forced this agent to disconnect (#{e.message})"
- @connected = false
- rescue NewRelic::Agent::ServerConnectionException => e
- log.error "Unable to establish connection with the server. Run with log level set to debug for more information."
- log.debug("#{e.class.name}: #{e.message}\n#{e.backtrace.first}")
- @connected = false
- rescue Exception => e
- log.error "Terminating worker loop: #{e.class.name}: #{e}\n #{e.backtrace.join("\n ")}"
- @connected = false
- end # begin
- end # thread new
- @worker_thread['newrelic_label'] = 'Worker Loop'
- end
-
- def control
- NewRelic::Control.instance
- end
-
- # Connect to the server and validate the license. If successful,
- # @connected has true when finished. If not successful, you can
- # keep calling this. Return false if we could not establish a
- # connection with the server and we should not retry, such as if
- # there's a bad license key.
- #
- # Set keep_retrying=false to disable retrying and return asap, such as when
- # invoked in the foreground. Otherwise this runs until a successful
- # connection is made, or the server rejects us.
- #
- # * <tt>:keep_retrying => false</tt> to only try to connect once, and
- # return with the connection set to nil. This ensures we may try again
- # later (default true).
- # * <tt>force_reconnect => true</tt> if you want to establish a new connection
- # to the server before running the worker loop. This means you get a separate
- # agent run and RPM sees it as a separate instance (default is false).
- def connect(options)
- # Don't proceed if we already connected (@connected=true) or if we tried
- # to connect and were rejected with prejudice because of a license issue
- # (@connected=false).
- return if !@connected.nil? && !options[:force_reconnect]
- keep_retrying = options[:keep_retrying].nil? || options[:keep_retrying]
-
- # wait a few seconds for the web server to boot, necessary in development
- connect_retry_period = keep_retrying ? 10 : 0
- connect_attempts = 0
- @agent_id = nil
- begin
- sleep connect_retry_period.to_i
- log.debug "Connecting Process to RPM: #$0"
- host = invoke_remote(:get_redirect_host)
- @collector = control.server_from_host(host) if host
- environment = control['send_environment_info'] != false ? control.local_env.snapshot : []
- log.debug "Connecting with validation seed/token: #{control.validate_seed}/#{control.validate_token}" if control.validate_seed
- connect_data = invoke_remote :connect,
- :pid => $$,
- :host => @local_host,
- :app_name => control.app_names,
- :language => 'ruby',
- :agent_version => NewRelic::VERSION::STRING,
- :environment => environment,
- :settings => control.settings,
- :validate => {:seed => control.validate_seed,
- :token => control.validate_token }
-
- @agent_id = connect_data['agent_run_id']
- @report_period = connect_data['data_report_period']
- @url_rules = connect_data['url_rules']
-
- control.log! "Connected to NewRelic Service at #{@collector}"
- log.debug "Agent Run = #{@agent_id}."
- log.debug "Connection data = #{connect_data.inspect}"
-
- # Ask the server for permission to send transaction samples.
- # determined by subscription license.
- @should_send_samples = @config_should_send_samples && connect_data['collect_traces']
-
- if @should_send_samples
- if @should_send_random_samples
- @transaction_sampler.random_sampling = true
- @transaction_sampler.sampling_rate = connect_data['sampling_rate']
- log.info "Transaction sampling enabled, rate = #{@transaction_sampler.sampling_rate}"
- end
- log.debug "Transaction tracing threshold is #{@slowest_transaction_threshold} seconds."
- else
- log.debug "Transaction traces will not be sent to the RPM service."
- end
-
- # Ask for permission to collect error data
- error_collector.enabled = error_collector.config_enabled && connect_data['collect_errors']
-
- log.debug "Errors will be sent to the RPM service." if error_collector.enabled
-
- @connected_pid = $$
- @connected = true
-
- rescue NewRelic::Agent::LicenseException => e
- log.error e.message
- log.info "Visit NewRelic.com to obtain a valid license key, or to upgrade your account."
- @connected = false
-
- rescue Timeout::Error, StandardError => e
- if e.instance_of? NewRelic::Agent::ServerConnectionException
- log.info "Unable to establish connection with New Relic RPM Service at #{control.server}: #{e.message}"
- log.debug e.backtrace.join("\n")
- else
- log.error "Error establishing connection with New Relic RPM Service at #{control.server}: #{e.message}"
- log.debug e.backtrace.join("\n")
- end
- # retry logic
- if keep_retrying
- connect_attempts += 1
- case connect_attempts
- when 1..2
- connect_retry_period, period_msg = 60, "1 minute"
- when 3..5
- connect_retry_period, period_msg = 60 * 2, "2 minutes"
- else
- connect_retry_period, period_msg = 5 * 60, "5 minutes"
- end
- log.info "Will re-attempt in #{period_msg}"
- retry
- else
- @connected = nil
- end
- end
- end
-
- def determine_host
- Socket.gethostname
- end
-
- def determine_home_directory
- control.root
- end
-
- def is_application_spawner?
- $0 =~ /ApplicationSpawner|^unicorn\S* master/
- end
-
- def harvest_and_send_timeslice_data
-
- NewRelic::Agent::BusyCalculator.harvest_busy
-
- now = Time.now
-
- @unsent_timeslice_data ||= {}
- @unsent_timeslice_data = @stats_engine.harvest_timeslice_data(@unsent_timeslice_data, @metric_ids)
-
- begin
- # In this version of the protocol, we get back an assoc array of spec to id.
- metric_ids = invoke_remote(:metric_data, @agent_id,
- @last_harvest_time.to_f,
- now.to_f,
- @unsent_timeslice_data.values)
-
- rescue Timeout::Error
- # assume that the data was received. chances are that it was
- metric_ids = nil
- end
-
- metric_ids.each do | spec, id |
- @metric_ids[spec] = id
- end if metric_ids
-
- log.debug "#{now}: sent #{@unsent_timeslice_data.length} timeslices (#{@agent_id}) in #{Time.now - now} seconds"
-
- # if we successfully invoked this web service, then clear the unsent message cache.
- @unsent_timeslice_data = {}
- @last_harvest_time = now
-
- # handle_messages
-
- # note - exceptions are logged in invoke_remote. If an exception is encountered here,
- # then the metric data is downsampled for another timeslices
- end
-
- def harvest_and_send_slowest_sample
- @traces = @transaction_sampler.harvest(@traces, @slowest_transaction_threshold)
-
- unless @traces.empty?
- now = Time.now
- log.debug "Sending (#{@traces.length}) transaction traces"
- begin
- # take the traces and prepare them for sending across the
- # wire. This includes gathering SQL explanations, stripping
- # out stack traces, and normalizing SQL. note that we
- # explain only the sql statements whose segments' execution
- # times exceed our threshold (to avoid unnecessary overhead
- # of running explains on fast queries.)
- options = { :keep_backtraces => true }
- options[:record_sql] = @record_sql unless @record_sql == :off
- options[:explain_sql] = @explain_threshold if @explain_enabled
- traces = @traces.collect {|trace| trace.prepare_to_send(options)}
- invoke_remote :transaction_sample_data, @agent_id, traces
- rescue PostTooBigException
- # we tried to send too much data, drop the first trace and
- # try again
- retry if @traces.shift
- end
-
- log.debug "Sent slowest sample (#{@agent_id}) in #{Time.now - now} seconds"
- end
-
- # if we succeed sending this sample, then we don't need to keep
- # the slowest sample around - it has been sent already and we
- # can collect the next one
- @traces = nil
-
- # note - exceptions are logged in invoke_remote. If an
- # exception is encountered here, then the slowest sample of is
- # determined of the entire period since the last reported
- # sample.
- end
-
- def harvest_and_send_errors
- @unsent_errors = @error_collector.harvest_errors(@unsent_errors)
- if @unsent_errors && @unsent_errors.length > 0
- log.debug "Sending #{@unsent_errors.length} errors"
- begin
- invoke_remote :error_data, @agent_id, @unsent_errors
- rescue PostTooBigException
- @unsent_errors.shift
- retry
- end
- # if the remote invocation fails, then we never clear
- # @unsent_errors, and therefore we can re-attempt to send on
- # the next heartbeat. Note the error collector maxes out at
- # 20 instances to prevent leakage
- @unsent_errors = []
- end
- end
-
- def compress_data(object)
- dump = Marshal.dump(object)
-
- # this checks to make sure mongrel won't choke on big uploads
- check_post_size(dump)
-
- # we currently optimize for CPU here since we get roughly a 10x
- # reduction in message size with this, and CPU overhead is at a
- # premium. For extra-large posts, we use the higher compression
- # since otherwise it actually errors out.
-
- dump_size = dump.size
-
- # Compress if content is smaller than 64kb. There are problems
- # with bugs in Ruby in some versions that expose us to a risk of
- # segfaults if we compress aggressively.
- return [dump, 'identity'] if dump_size < (64*1024)
-
- # medium payloads get fast compression, to save CPU
- # big payloads get all the compression possible, to stay under
- # the 2,000,000 byte post threshold
- compression = dump_size < 2000000 ? Zlib::BEST_SPEED : Zlib::BEST_COMPRESSION
-
- [Zlib::Deflate.deflate(dump, compression), 'deflate']
- end
-
- def check_post_size(post_string)
- # TODO: define this as a config option on the server side
- return if post_string.size < control.post_size_limit
- log.warn "Tried to send too much data: #{post_string.size} bytes"
- raise PostTooBigException
- end
-
- def send_request(opts)
- request = Net::HTTP::Post.new(opts[:uri], 'CONTENT-ENCODING' => opts[:encoding], 'HOST' => opts[:collector].name)
- request.content_type = "application/octet-stream"
- request.body = opts[:data]
-
- log.debug "Connect to #{opts[:collector]}#{opts[:uri]}"
-
- response = nil
- http = control.http_connection(collector)
- http.read_timeout = nil
- begin
- NewRelic::TimerLib.timeout(@request_timeout) do
- response = http.request(request)
- end
- rescue Timeout::Error
- log.warn "Timed out trying to post data to RPM (timeout = #{@request_timeout} seconds)" unless @request_timeout < 30
- raise
- end
- if response.is_a? Net::HTTPServiceUnavailable
- raise NewRelic::Agent::ServerConnectionException, "Service unavailable (#{response.code}): #{response.message}"
- elsif response.is_a? Net::HTTPGatewayTimeOut
- log.debug("Timed out getting response: #{response.message}")
- raise Timeout::Error, response.message
- elsif response.is_a? Net::HTTPRequestEntityTooLarge
- raise PostTooBigException
- elsif !(response.is_a? Net::HTTPSuccess)
- raise NewRelic::Agent::ServerConnectionException, "Unexpected response from server (#{response.code}): #{response.message}"
- end
- response
- end
-
- def decompress_response(response)
- if response['content-encoding'] != 'gzip'
- log.debug "Uncompressed content returned"
- return response.body
- end
- log.debug "Decompressing return value"
- i = Zlib::GzipReader.new(StringIO.new(response.body))
- i.read
- end
-
- def check_for_exception(response)
- dump = decompress_response(response)
- value = Marshal.load(dump)
- raise value if value.is_a? Exception
- value
- end
-
- def remote_method_uri(method)
- uri = "/agent_listener/#{PROTOCOL_VERSION}/#{control.license_key}/#{method}"
- uri << "?run_id=#{@agent_id}" if @agent_id
- uri
- end
-
- # send a message via post
- def invoke_remote(method, *args)
- #determines whether to zip the data or send plain
- post_data, encoding = compress_data(args)
-
- response = send_request({:uri => remote_method_uri(method), :encoding => encoding, :collector => collector, :data => post_data})
-
- # raises the right exception if the remote server tells it to die
- return check_for_exception(response)
- rescue NewRelic::Agent::ForceRestartException => e
- log.info e.message
- raise
- rescue SystemCallError, SocketError => e
- # These include Errno connection errors
- raise NewRelic::Agent::ServerConnectionException, "Recoverable error connecting to the server: #{e}"
- end
-
- def graceful_disconnect
- if @connected
- begin
- @request_timeout = 10
- log.debug "Flushing unsent metric data to server"
- @worker_loop.run_task
- if @connected_pid == $$
- log.debug "Sending RPM service agent run shutdown message"
- invoke_remote :shutdown, @agent_id, Time.now.to_f
- else
- log.debug "This agent connected from parent process #{@connected_pid}--not sending shutdown"
- end
- log.debug "Graceful disconnect complete"
- rescue Timeout::Error, StandardError
- end
- else
- log.debug "Bypassing graceful disconnect - agent not connected"
- end
- end
- def default_sql_obfuscator(sql)
- sql = sql.dup
- # This is hardly readable. Use the unit tests.
- # remove single quoted strings:
- sql.gsub!(/'(.*?[^\\'])??'(?!')/, '?')
- # remove double quoted strings:
- sql.gsub!(/"(.*?[^\\"])??"(?!")/, '?')
- # replace all number literals
- sql.gsub!(/\d+/, "?")
- sql
- end
- end
-
- extend ClassMethods
- include InstanceMethods
- end
- end
-end
View
91 v2_13_1/lib/new_relic/agent/busy_calculator.rb
@@ -1,91 +0,0 @@
-module NewRelic
- module Agent
- # This module supports calculation of actual time spent processing requests over the course of
- # one harvest period. It's similar to what you would get if you just added up all the
- # execution times of controller calls, however that will be inaccurate when requests
- # span the minute boundaries. This module manages accounting of requests not yet
- # completed.
- #
- # Calls are re-entrant. All start calls must be paired with finish
- # calls, or a reset call.
- module BusyCalculator
-
- extend self
-
- # For testability, add accessors:
- attr_reader :harvest_start, :accumulator
-
- def dispatcher_start(time)
- Thread.current[:busy_entries] ||= 0
- callers = Thread.current[:busy_entries] += 1
- return if callers > 1
- @lock.synchronize do
- @entrypoint_stack.push time
- end
- end
-
- def dispatcher_finish(end_time = Time.now)
- callers = Thread.current[:busy_entries] -= 1
- # Ignore nested calls
- return if callers > 0
- @lock.synchronize do
- if @entrypoint_stack.empty?
- NewRelic::Agent.logger.error("Stack underflow tracking dispatcher entry and exit!\n #{caller.join(" \n")}")
- else
- @accumulator += (end_time - @entrypoint_stack.pop).to_f
- end
- end
- end
-
- def busy_count
- @entrypoint_stack.size
- end
-
- # Reset the state of the information accumulated by all threads,
- # but only reset the recursion counter for this thread.
- def reset
- @entrypoint_stack = []
- Thread.current[:busy_entries] = 0
- @lock ||= Mutex.new
- @accumulator = 0
- @harvest_start = Time.now