Skip to content
This repository has been archived by the owner on Oct 1, 2019. It is now read-only.

Commit

Permalink
first version of the rpm agent gem
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill Kayser committed Oct 31, 2008
0 parents commit ab5dedc
Show file tree
Hide file tree
Showing 95 changed files with 8,091 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.DS\_Store
.svn/
*~
pkg/
*.gem

17 changes: 17 additions & 0 deletions .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>
37 changes: 37 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Copyright (c) 2008 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.
57 changes: 57 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
=============
NEW RELIC RPM
=============

NewRelic RPM is a Ruby performance management system, developed by New Relic, Inc.
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 distributed as
a either a Rails plugin or a Gem.

Our testing shows that this agent introduces minimal overhead: in production, a
typical controller action will be impacted by less than 5 milliseconds in
response time. (That's significantly less time than is typically spent in mapping
a request to the appropriate controller action.) So, you can run RPM all the
time, and always have access to the information you need to resolve performance
problems and ensure your application can scale to meet the demands of your
business.

The New Relic Agent runs in one of two modes:

DEVELOPER MODE
------------
Developer mode is on by default when you run your application in the development
environment (but not when it runs in other environments.) When running in
developer mode, the RPM will track the performance of every http request serviced
by your application, and store in memory this information for the last 100 http
transactions.

When running in Developer Mode, the RPM will also add a few pages to
your application that allow you to analyze this performance information. (Don't
worry - those pages are not added to your application's routes when you run in
production mode.)

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

PRODUCTION MODE
---------------
When your application runs in the production environment, the NewRelic 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, login
to http://rpm.newrelic.com.

NOTE: you must have a valid account and license key to view this data online.
When you sign up for an account at newrelic.com, you will be provided with a
license key, as well as a default configuration file for NewRelic RPM. You can
either paste your license key into your existing configuration file,
config/newrelic.yml, or you can replace that config file with the one included in
your welcome email.

Thank you, and may your application scale to infinity plus one.

Lew Cirne, Founder and CEO
New Relic, Inc.

38 changes: 38 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
require 'rubygems'
require 'rake/gempackagetask'
require 'lib/new_relic/version.rb'

GEM_NAME = "newrelic"
GEM_VERSION = NewRelic::VERSION::STRING
AUTHOR = "Bill Kayser"
EMAIL = "bkayser@newrelic.com"
HOMEPAGE = "http://www.newrelic.com"
SUMMARY = "Performance Monitoring Agent for New Relic Ruby Performance Monitoring Service"

spec = Gem::Specification.new do |s|
s.rubyforge_project = 'newrelic'
s.name = GEM_NAME
s.version = GEM_VERSION
s.platform = Gem::Platform::RUBY
s.has_rdoc = true
s.extra_rdoc_files = ["README", "LICENSE"]
s.summary = SUMMARY
s.description = s.summary
s.author = AUTHOR
s.email = EMAIL
s.homepage = HOMEPAGE
s.require_path = 'lib'
s.files = %w(install.rb LICENSE README newrelic.yml Rakefile) + Dir.glob("{lib,tasks,test,ui}/**/*")

end

Rake::GemPackageTask.new(spec) do |pkg|
pkg.gem_spec = spec
end

desc "Create a gemspec file"
task :gemspec do
File.open("#{GEM_NAME}.gemspec", "w") do |file|
file.puts spec.to_ruby
end
end
16 changes: 16 additions & 0 deletions init.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This is the initialization for the RPM Rails plugin
##require 'new_relic/config'

# Initializer for the NewRelic Agent
begin

# START THE AGENT
# We install the shim agent unless the tracers are enabled, the plugin
# env setting is not false, and the agent started okay.
NewRelic::Config.instance.start_plugin (defined?(config) ? config : nil)

rescue => e
NewRelic::Config.instance.log! "Error initializing New Relic plugin (#{e})", :error
NewRelic::Config.instance.log! e.backtrace.join("\n"), :error
NewRelic::Config.instance.log! "Agent is disabled."
end
24 changes: 24 additions & 0 deletions install.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
require 'ftools'

puts IO.read(File.join(File.dirname(__FILE__), 'README'))

dest_config_file = File.expand_path("#{File.dirname(__FILE__)}/../../../config/newrelic.yml")
src_config_file = "#{File.dirname(__FILE__)}/newrelic.yml"

if File::exists? dest_config_file
puts "\nA config file already exists at #{dest_config_file}.\n"
else
generated_for_user = ""
license_key = "PASTE_YOUR_KEY_HERE"

yaml = eval "%Q[#{File.read(src_config_file)}]"

File.open( dest_config_file, 'w' ) do |out|
out.puts yaml
end

puts "\nInstalling a default configuration file."
puts "To monitor your application in production mode, you must enter a license key."
puts "See #{dest_config_file}"
puts "For a license key, sign up at http://rpm.newrelic.com/signup."
end
20 changes: 20 additions & 0 deletions lib/new_relic/agent.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require 'new_relic/version'
require 'new_relic/local_environment'
require 'new_relic/stats'
require 'new_relic/metric_spec'
require 'new_relic/metric_data'
require 'new_relic/transaction_analysis'
require 'new_relic/transaction_sample'

require 'new_relic/agent/agent'
require 'new_relic/agent/method_tracer'
require 'new_relic/agent/synchronize'
require 'new_relic/agent/worker_loop'
require 'new_relic/agent/stats_engine'
require 'new_relic/agent/collection_helper'
require 'new_relic/agent/transaction_sampler'
require 'new_relic/agent/error_collector'

module NewRelic::Agent

end
Loading

0 comments on commit ab5dedc

Please sign in to comment.