Skip to content

Commit

Permalink
Merge in enhancements and bug fixes from 2.13 development
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill Kayser committed May 18, 2010
1 parent c0b789f commit cad7c73
Show file tree
Hide file tree
Showing 55 changed files with 1,516 additions and 1,344 deletions.
20 changes: 18 additions & 2 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
v2.13.0
* added record_transaction method to the api to allow recording
details from web and background transactions occurring outside RPM
* 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 (experimental)
* 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
* allow customization of log directories with newrelic.yml settings
* optimization to execution time measurement
* optimization to startup sequence

v2.12.1
* 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

Expand All @@ -12,7 +29,7 @@ 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

Expand All @@ -30,7 +47,6 @@ v2.11.0
* 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
Expand Down
73 changes: 41 additions & 32 deletions lib/new_relic/agent.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# = New Relic Agent
# = New Relic RPM Agent
#
# New Relic RPM is a performance monitoring application for Ruby
# applications running in production. For more information on RPM
Expand All @@ -10,43 +10,24 @@
# or for monitoring and analysis at http://rpm.newrelic.com with just
# about any Ruby application.
#
# For detailed information on configuring or customizing the RPM Agent
# please visit our {support and documentation site}[http://support.newrelic.com].
#
# == Starting the Agent as a Gem
#
# For Rails, add:
# config.gem 'newrelic_rpm'
# to your initialization sequence.
#
# For merb, do
# dependency 'newrelic_rpm'
# in the Merb config/init.rb
#
# For Sinatra, just require the +newrelic_rpm+ gem and it will
# automatically detect Sinatra and instrument all the handlers.
#
# For other frameworks, or to manage the agent manually,
# invoke NewRelic::Agent#manual_start directly.
#
# == Configuring the Agent
#
# All agent configuration is done in the <tt>newrelic.yml</tt> 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
# == Getting Started
# For instructions on installation and setup, see
# the README[link:./files/README_rdoc.html] file.
#
# == Using with Rack/Metal
#
# To instrument middlewares, 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].
#
# :main: lib/new_relic/agent.rb
module NewRelic
# == Agent APIs
# This module contains the public API methods for the Agent.
Expand Down Expand Up @@ -79,16 +60,17 @@ module Agent
require 'new_relic/version'
require 'new_relic/local_environment'
require 'new_relic/stats'
require 'new_relic/delayed_job_injection'
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'
Expand All @@ -110,7 +92,6 @@ module Agent
require 'set'
require 'thread'
require 'resolv'
require 'timeout'

# An exception that is thrown by the server if the agent license is invalid.
class LicenseException < StandardError; end
Expand Down Expand Up @@ -326,15 +307,16 @@ def ignore_error_filter(&block)
# 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
# * <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
# Anything left over is treated as custom params.
#
def notice_error(exception, options={})
NewRelic::Agent::Instrumentation::MetricFrame.notice_error(exception, options)
Expand Down Expand Up @@ -365,5 +347,32 @@ 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.
#
# == 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

0 comments on commit cad7c73

Please sign in to comment.