Permalink
Browse files

import development from SVN

  • Loading branch information...
jaggederest committed Sep 7, 2010
1 parent 5060d8f commit 944dc0a6c9c8fe8fc2771e58d07aa8a30d00650d
Showing with 1,167 additions and 1,148 deletions.
  1. +2 −2 Rakefile
  2. +50 −50 lib/new_relic/agent.rb
  3. +17 −17 lib/new_relic/agent/agent.rb
  4. +22 −22 lib/new_relic/agent/busy_calculator.rb
  5. +3 −3 lib/new_relic/agent/chained_call.rb
  6. +18 −18 lib/new_relic/agent/error_collector.rb
  7. +11 −11 lib/new_relic/agent/instrumentation/active_record_instrumentation.rb
  8. +2 −2 lib/new_relic/agent/instrumentation/acts_as_solr.rb
  9. +43 −43 lib/new_relic/agent/instrumentation/controller_instrumentation.rb
  10. +6 −6 lib/new_relic/agent/instrumentation/data_mapper.rb
  11. +2 −2 lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb
  12. +8 −8 lib/new_relic/agent/instrumentation/memcache.rb
  13. +4 −4 lib/new_relic/agent/instrumentation/merb/controller.rb
  14. +52 −52 lib/new_relic/agent/instrumentation/metric_frame.rb
  15. +8 −8 lib/new_relic/agent/instrumentation/passenger_instrumentation.rb
  16. +2 −2 lib/new_relic/agent/instrumentation/rack.rb
  17. +10 −10 lib/new_relic/agent/instrumentation/rails/action_controller.rb
  18. +3 −3 lib/new_relic/agent/instrumentation/rails/action_web_service.rb
  19. +5 −5 lib/new_relic/agent/instrumentation/rails/errors.rb
  20. +5 −5 lib/new_relic/agent/instrumentation/rails3/action_controller.rb
  21. +5 −5 lib/new_relic/agent/instrumentation/sinatra.rb
  22. +1 −1 lib/new_relic/agent/instrumentation/sunspot.rb
  23. +55 −55 lib/new_relic/agent/method_tracer.rb
  24. +11 −11 lib/new_relic/agent/sampler.rb
  25. +4 −4 lib/new_relic/agent/samplers/cpu_sampler.rb
  26. +7 −7 lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb
  27. +11 −11 lib/new_relic/agent/samplers/memory_sampler.rb
  28. +1 −1 lib/new_relic/agent/samplers/object_sampler.rb
  29. +1 −1 lib/new_relic/agent/shim_agent.rb
  30. +3 −3 lib/new_relic/agent/stats_engine.rb
  31. +28 −28 lib/new_relic/agent/stats_engine/metric_stats.rb
  32. +14 −14 lib/new_relic/agent/stats_engine/samplers.rb
  33. +25 −25 lib/new_relic/agent/stats_engine/transactions.rb
  34. +56 −56 lib/new_relic/agent/transaction_sampler.rb
  35. +13 −13 lib/new_relic/agent/worker_loop.rb
  36. +6 −6 lib/new_relic/collection_helper.rb
  37. +13 −13 lib/new_relic/command.rb
  38. +19 −19 lib/new_relic/commands/deployments.rb
  39. +15 −15 lib/new_relic/commands/install.rb
  40. +25 −25 lib/new_relic/control.rb
  41. +17 −17 lib/new_relic/control/configuration.rb
  42. +3 −3 lib/new_relic/control/frameworks/external.rb
  43. +6 −6 lib/new_relic/control/frameworks/merb.rb
  44. +17 −17 lib/new_relic/control/frameworks/rails.rb
  45. +10 −27 lib/new_relic/control/frameworks/rails3.rb
  46. +6 −6 lib/new_relic/control/frameworks/ruby.rb
  47. +4 −4 lib/new_relic/control/frameworks/sinatra.rb
  48. +8 −8 lib/new_relic/control/instrumentation.rb
  49. +13 −13 lib/new_relic/control/logging_methods.rb
  50. +2 −2 lib/new_relic/control/profiling.rb
  51. +17 −17 lib/new_relic/control/server_methods.rb
  52. +1 −1 lib/new_relic/delayed_job_injection.rb
  53. +14 −14 lib/new_relic/histogram.rb
  54. +45 −45 lib/new_relic/local_environment.rb
  55. +1 −1 lib/new_relic/merbtasks.rb
  56. +5 −5 lib/new_relic/metric_data.rb
  57. +22 −22 lib/new_relic/metric_parser.rb
  58. +4 −4 lib/new_relic/metric_parser/action_mailer.rb
  59. +8 −8 lib/new_relic/metric_parser/active_merchant.rb
  60. +2 −2 lib/new_relic/metric_parser/active_record.rb
  61. +86 −51 lib/new_relic/metric_parser/apdex.rb
  62. +10 −10 lib/new_relic/metric_parser/controller.rb
  63. +5 −5 lib/new_relic/metric_parser/controller_cpu.rb
  64. +1 −1 lib/new_relic/metric_parser/errors.rb
  65. +3 −3 lib/new_relic/metric_parser/external.rb
  66. +2 −2 lib/new_relic/metric_parser/mem_cache.rb
  67. +7 −7 lib/new_relic/metric_parser/other_transaction.rb
  68. +5 −5 lib/new_relic/metric_parser/view.rb
  69. +1 −1 lib/new_relic/metric_parser/web_frontend.rb
  70. +1 −1 lib/new_relic/metric_parser/web_service.rb
  71. +13 −13 lib/new_relic/metric_spec.rb
  72. +4 −4 lib/new_relic/noticed_error.rb
  73. +31 −31 lib/new_relic/rack/developer_mode.rb
  74. +2 −2 lib/new_relic/rack/metric_app.rb
  75. +9 −9 lib/new_relic/recipes.rb
  76. +57 −57 lib/new_relic/stats.rb
  77. +2 −2 lib/new_relic/timer_lib.rb
  78. +19 −19 lib/new_relic/transaction_analysis.rb
  79. +101 −101 lib/new_relic/transaction_sample.rb
  80. +3 −3 lib/new_relic/url_rule.rb
  81. +9 −9 lib/new_relic/version.rb
  82. +3 −3 lib/newrelic_rpm.rb
  83. +1 −1 lib/tasks/all.rb
  84. +1 −0 test/new_relic/rack/episodes_test.rb
View
@@ -5,7 +5,7 @@ require 'rake/testtask'
GEM_NAME = "newrelic_rpm"
GEM_VERSION = NewRelic::VERSION::STRING
-AUTHOR = "Bill Kayser"
+AUTHORS = "Bill Kayser", "Justin George"
EMAIL = "support@newrelic.com"
HOMEPAGE = "http://www.github.com/newrelic/rpm"
SUMMARY = "New Relic Ruby Performance Monitoring Agent"
@@ -44,7 +44,7 @@ begin
gem.summary = SUMMARY
gem.email = EMAIL
gem.homepage = HOMEPAGE
- gem.author = AUTHOR
+ 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.
View
@@ -12,27 +12,27 @@
#
# == Getting Started
# For instructions on installation and setup, see
-# the README[link:./files/README_rdoc.html] file.
+# the README[link:./files/README_rdoc.html] file.
#
# == Using with Rack/Metal
#
-# To instrument Rack middlwares or Metal apps, refer to the docs in
+# 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
+ # 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
@@ -71,7 +71,7 @@ module Agent
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'
@@ -84,49 +84,49 @@ module Agent
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
@@ -140,18 +140,18 @@ def agent= new_instance #:nodoc:
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
-
+
+ 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
@@ -168,33 +168,33 @@ 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.
+ # 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
+ # * <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
+ # * <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
@@ -204,7 +204,7 @@ def reset_stats
# and kills the background thread.
def shutdown
agent.shutdown
- end
+ end
# Add instrumentation files to the agent. The argument should be
# a glob matching ruby scripts which will be executed at the time
@@ -229,21 +229,21 @@ def add_instrumentation file_pattern
# 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
@@ -252,9 +252,9 @@ def disable_sql_recording
agent.set_record_sql(state)
end
end
-
+
# This method disables the recording of transaction traces in the given
- # block. See also #disable_all_tracing
+ # block. See also #disable_all_tracing
def disable_transaction_tracing
state = agent.set_record_tt(false)
begin
@@ -263,7 +263,7 @@ def disable_transaction_tracing
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.
@@ -273,7 +273,7 @@ def abort_transaction!
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
@@ -285,28 +285,28 @@ def disable_all_tracing
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
+ 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.
- #
+ # 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:
@@ -328,11 +328,11 @@ def notice_error(exception, options={})
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.
@@ -348,9 +348,9 @@ def with_database_metric_name(model, method, &block)
yield
end
end
-
- # Record a web transaction from an external source. This will
- # process the response time, error, and score an apdex value.
+
+ # 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.
@@ -363,7 +363,7 @@ def with_database_metric_name(model, method, &block)
# provided.
#
# == Error options
- # Provide one of the following:
+ # 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
@@ -378,5 +378,5 @@ def with_database_metric_name(model, method, &block)
def record_transaction(response_sec, options = {})
agent.record_transaction(response_sec, options)
end
- end
-end
+ end
+end
Oops, something went wrong.

0 comments on commit 944dc0a

Please sign in to comment.