Skip to content

Commit

Permalink
Creating tag based on branch v2_13_1 @ 20648
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill Kayser committed Sep 8, 2010
1 parent d0847c1 commit 9bba217
Show file tree
Hide file tree
Showing 163 changed files with 21,852 additions and 0 deletions.
7 changes: 7 additions & 0 deletions v2_13_1/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.DS\_Store
.svn/
*~
pkg/
*.gem
!rails
Manifest*
17 changes: 17 additions & 0 deletions v2_13_1/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?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>
462 changes: 462 additions & 0 deletions v2_13_1/CHANGELOG

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions v2_13_1/InstallationNotes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

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.
37 changes: 37 additions & 0 deletions v2_13_1/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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.
172 changes: 172 additions & 0 deletions v2_13_1/README.rdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
= 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.
111 changes: 111 additions & 0 deletions v2_13_1/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
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
33 changes: 33 additions & 0 deletions v2_13_1/bin/mongrel_rpm
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/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

0 comments on commit 9bba217

Please sign in to comment.