Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

rpm_contrib is deprecated

  • Loading branch information...
commit 34e434e1c0313339ec9bea1cf2f105633070d24d 1 parent e1bf281
Jason R. Clark jasonrclark authored
Showing with 2 additions and 1,790 deletions.
  1. +0 −5 .document
  2. +0 −154 CHANGELOG
  3. +0 −13 Gemfile
  4. +0 −20 LICENSE
  5. +2 −340 README.md
  6. +0 −79 Rakefile
  7. +0 −14 lib/new_relic/control/camping.rb
  8. +0 −35 lib/rpm_contrib.rb
  9. +0 −11 lib/rpm_contrib/agent_compatibility.rb
  10. +0 −5 lib/rpm_contrib/detection.rb
  11. +0 −24 lib/rpm_contrib/detection/camping.rb
  12. +0 −16 lib/rpm_contrib/instrumentation.rb
  13. +0 −22 lib/rpm_contrib/instrumentation/active_messaging.rb
  14. +0 −74 lib/rpm_contrib/instrumentation/aws.rb
  15. +0 −50 lib/rpm_contrib/instrumentation/camping.rb
  16. +0 −30 lib/rpm_contrib/instrumentation/cassandra.rb
  17. +0 −41 lib/rpm_contrib/instrumentation/crack.rb
  18. +0 −53 lib/rpm_contrib/instrumentation/curb.rb
  19. +0 −26 lib/rpm_contrib/instrumentation/elastic_search.rb
  20. +0 −28 lib/rpm_contrib/instrumentation/kyototycoon.rb
  21. +0 −55 lib/rpm_contrib/instrumentation/mongo.rb
  22. +0 −21 lib/rpm_contrib/instrumentation/mongoid.rb
  23. +0 −29 lib/rpm_contrib/instrumentation/paperclip.rb
  24. +0 −41 lib/rpm_contrib/instrumentation/picky.rb
  25. +0 −30 lib/rpm_contrib/instrumentation/sinatra.rb
  26. +0 −22 lib/rpm_contrib/instrumentation/thinking_sphinx.rb
  27. +0 −33 lib/rpm_contrib/instrumentation/typhoeus.rb
  28. +0 −22 lib/rpm_contrib/instrumentation/ultrasphinx.rb
  29. +0 −41 lib/rpm_contrib/instrumentation/yajl.rb
  30. +0 −31 lib/rpm_contrib/language_support.rb
  31. +0 −17 lib/rpm_contrib/samplers.rb
  32. +0 −175 newrelic.yml
  33. +0 −81 rpm_contrib.gemspec
  34. +0 −9 test/helper.rb
  35. +0 −19 test/schema.rb
  36. +0 −69 test/test_curb.rb
  37. +0 −55 test/test_picky.rb
5 .document
View
@@ -1,5 +0,0 @@
-README.rdoc
-lib/**/*.rb
-bin/*
-features/**/*.feature
-LICENSE
154 CHANGELOG
View
@@ -1,154 +0,0 @@
-* Version 2.2.0
- - Final version of rpm_contrib, with post-install deprecation message
- - Use Addressable::URI from Curb instrumentation (Amir Yalon)
-
-* Version 2.1.11
- - Removed Resque instrumentation in favor of instrumentation in main agent https://github.com/newrelic/rpm (version 3.4.0)
-
-* Version 2.1.10
- - Removed Workling instrumentation in favor of https://github.com/aurorafeint/newrelic-workling
-
-* Version 2.1.9
- - Removed riak-client and ripple instrumentation in favor of
- https://github.com/alinpopa/newrelic-riak
-
-* Version 2.1.8
- - Removed redis instrumenation in favor of https://github.com/evanphx/newrelic-redis
- - [FIX] adding check for aws-sdk (Tom Caspy)
- - Improved Mongo instrumenation from pull request #16 titanous/mongoid-instrumentation
-
-* Version 2.1.7
-
- Community contributed instrumentation
- - ThinkingSphinx instrumentation improvement (Martin Sarsale)
- - Picky search engine instrumentation (Niko Dittmann)
- Community Contributed Bug Fixes
- - Fix instrumentation injection for ActiveMessaging (W. Andrew Loe III)
- Other
- - Improvements to resque instrumentation detection of if its in a forking ruby implementation
-
-* Version 2.1.6
-
- Community contributed instrumentation
- - ThinkingSphinx instrumentation (W. Andrew Loe III)
- - Riak instrumentation (Bryce Kerley)
- - KyotoTycoon instrumentation (Keisuke Kawahara)
- Community Contributed Bug Fixes
- - MongoDB instrumentation (Kenn Ejima)
- - Yajl instrumentation (Chris Griego)
- - UltraSphinx instrumentation (Jonathan Rudenberg)
- - Renamed ActiveMQ instrumentation to ActiveMessaging (W. Andrew Loe III)
-
-* Version 2.1.5
-
- Changed the resque detection so it does not depend on the load
- order of resque => rpm_contrib => newrelic_rpm. The gems can be
- installed in any order.
-
-* Version 2.1.4
-
- Updated requirements to latest agent with some bug fixes for background jobs
- Converted instrumentation to install with DependencyDetection in the latest Agent
- Changed Resque instrumentation from a plugin back to method chaining
- Fixed several reported bugs related to resque
-
-* Version 2.1.3
-
- Fixed typo in Resque instrumentation
- Fixed double loading of AWS instrumentation
-
-* Version 2.1.2
-
- Add a manual shutdown to the Resque instrumentation to make sure data is saved and sent - thanks to Jade Rubick
-
-* Version 2.1.1
-
- Fix namespacing problem with Resque
- Add instrumentation to Mongo::Cursor #refresh and #close - thanks to Chris Griego
-
-* Version 2.1.0
-
- Included instrumentation from the community:
- - Alexey Palazhchenko - mongo ORM-agnostic instrumentation
- - Michael Breen - Elastic Search
- - Paul Ingles - Sinatra Template instrumentation
- - Siddharth Dawara - Typhoeus instrumentation
- - Rob Meyer - ActiveMQ instrumentation
- - Greg Hazel - Curb instrumentation
- - Ben Poweski - Crack and Yajl instrumentation
- - Chad Ingram and Scott Fleckenstein - Workling instrumentation
- - Adam Weller - UltraSphinx instrumentation
- - Liron Yahdav - work on the Resque instrumentation
-
-* Version 2.0.1
-
- Fixed an error with Bundler and RubyGems 1.8.2 which caused the gem to always fail to load
-
-* Version 2.0.0
-
- Updated to use the latest version of the Ruby Agent
-
-* Version 1.0.13
-
- Removed use of 'metaclass' - no longer available from ActiveSupport as of Rails 3
- Contributed by Chris Griego
-
-* Version 1.0.12
-
- Better support for initialization within a Rails 3 application
- rpm_contrib now depends on newrelic_rpm >= 2.13.1
-
-* Version 1.0.11
-
- AWS/S3 instrumentation contributed by Brian Doll
- Cassandra instrumentation contributed by Ashley Martens
- Updated Redis instrumentation for 1.x and 2.x contributed by Karl Baum
-
-* Version 1.0.10
-
- Mongoid support contributed by Karl Baum
-
-* Version 1.0.9
-
- Fixed dependency specification on newrelic_rpm
-
-* Version 1.0.8
-
- Redis instrumentation contributed by Ashley Martens
- Authlogic moved into RPM Ruby Agent
-
-* Version 1.0.7
-
- Resque instrumentation now supports the resque-multi-job-forks plugin
-
-* Version 1.0.6
-
- Update newrelic dependency: depends on 2.11.1
-
-* Version 1.0.5
-
- Clear stats in forked resque jobs
-
-* Version 1.0.4
-
- Resque support
-
-* Version 1.0.3
-
- MongoDB instrumentation contributed by John Nunemaker
-
-* Version 1.0.2
-
- Improved Camping support
-
-* Version 1.0.1
-
- Removed DelayedJob, put back in core agent
-
-* Version 1.0.0
-
- Initial Release:
- - Camping
- - Authlogic
- - DelayedJob
- - Paperclip
13 Gemfile
View
@@ -1,13 +0,0 @@
-source :rubygems
-
-gem 'newrelic_rpm', '>=3.1.1'
-
-group :test do
- gem 'resque'
- gem 'json'
- gem 'mocha'
-end
-
-group :build do
- gem 'jeweler'
-end
20 LICENSE
View
@@ -1,20 +0,0 @@
-Copyright (c) 2009-2010 New Relic, Inc.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
342 README.md
View
@@ -1,341 +1,3 @@
-# The RPM Contrib Gem
+# rpm_contrib is deprecated
-The `rpm_contrib` gem contains instrumentation for the New Relic RPM agent
-contributed by the community of RPM users. It requires the RPM Agent to run.
-
-## Deprecation of RPM Contrib
-
-Over the next several months we are planning to phase out the rpm_contrib gem.
-We plan to migrate the existing instrumentation into separate projects that
-instrument indivdual libraries or frameworks. We see this as having a number of
-advantages for newrelic users. We will provide a list of recommended
-instrumentation projects.
-
-### Request for Maintainers
-
-If you're interested in maintaining instrumentation for a specific
-library/framework, please let us know. We'd love to work with you and promote
-your project. -The New Relic Ruby Agent Team
-
-## extends_newrelic_rpm
-We've started tracking gems that extend the New Relic Ruby agent via a git
-repository at http://github.com/newrelic/extends_newrelic_rpm. Check that out for
-a longer list of projects if you don't find what you need listed directly here.
-
-## New Relic Ruby Agent Plugins (Seperate Projects)
-
-Here is a list of instrumentation projects for various Ruby libraries:
-
-#### Redis
-
-As of version 2.1.8 Redis instrumentation has been removed from rpm_contrib.
-Please use Evan Phoenix's `newrelic-redis` gem instead.
-
-https://github.com/evanphx/newrelic-redis
-
-#### Mongoid 3 / Moped
-
-Instrumentation for Mongoid 3 / Moped:
-
-https://github.com/stevebartholomew/newrelic_moped
-
-#### Mongoid 2 / Mongo:
-
-https://github.com/raphaelcm/newrelic_mongo
-
-#### Faraday
-
-Instrumentation for the HTTP client library Faraday is available at:
-
-https://github.com/Viximo/newrelic-faraday
-
-#### Riak-Client and Ripple
-
-Riak client and ripple instrumentation are available at:
-
-https://github.com/alinpopa/newrelic-riak
-
-#### Workling
-
-Workling instrumenatation can be found at:
-
-https://github.com/aurorafeint/newrelic-workling
-
-#### Sequel
-
-`newrelic_rpm` version 3.6.2 supports Sequel directly.
-Older agent versions can use the Sequel gem found at:
-
-https://github.com/realestate-com-au/newrelic-sequel
-
-#### Excon
-
-Instrumentation for the Excon gem can be found at:
-
-https://github.com/helle/newrelic-excon
-
-#### Typhoeus
-
-Instrumentation for the Typhoeus gem can be found at:
-
-https://github.com/sportngin/newrelic-typhoeus
-
-## Getting Started
-
-To use the rpm_contrib gem, install the `rpm_contrib` gem from rubygems.org.
-It will also install the required version of the `newrelic_rpm` gem if it's not
-already installed.
-
-For Rails 3.0 and when using Bundler, add these dependencies to your Gemfile:
-
- gem 'rpm_contrib'
- gem 'newrelic_rpm'
-
-For Rails 2.1 and later, add these dependencies to your in your environment.rb:
-
- config.gem 'rpm_contrib'
- config.gem 'newrelic_rpm'
-
-For other frameworks, make sure you load rubygems if it isn't already, then just
-require the rpm_contrib gem:
-
- require 'rubygems'
- require 'rpm_contrib'
-
-In non-Rails frameworks, it's important that the New Relic Agent gets
-loaded as late as possible, or that the final initialization hook is called
-after all other frameworks have loaded:
-
- DependencyDetection.detect!
-
-### Troubleshooting Startup
-
-If you've set up your gems to load as described above and you are still not seeing
-data in RPM, there may be a bug in detecting your framework. Try setting the
-environment variable `NEWRELIC_DISPATCHER` to the name of your app server (Camping,
-Resque, Rake, etc), and please report to us if this fixes the problem so we can
-fix the auto-detection logic.
-
-If this does not help then set the `log_level` to `debug` in the `newrelic.yml` file
-and examine the `newrelic_agent.log` file for errors after restarting your app.
-
-
-## Supported Frameworks
-
-A number of frameworks are supported in the contrib gem. They are all turned on
-by default but you can add settings to your newrelic.yml to disable any of them.
-
-### ActiveMessaging
-
-The gem will detect the underlying ActiveMessaging::Processor class and instrument the `on_message` method
-
-It can be disabled with the `disable_active_messaging` flag in your newrelic.yml file.
-
-### Cassandra
-
-The gem will instrument Cassandra so it should be visible in transaction traces and the web transactions page.
-
-You can disable it with `disable_cassandra_instrumentation` in your newrelic.yml file.
-
-### Camping
-
-The gem will detect a Camping app but you need to manually add the
-instrumentation to your configuration file. See
-RPMContrib::Instrumentation::Camping for more information.
-
-In addition you will need to load the gems in the following order: 1) Camping, 2) rpm_contrib,
-3) newrelic_rpm.
-
-### Crack
-
-The gem will instrument the Crack parsers for JSON and XML - you
-should see them in transaction traces and the web transactions page.
-
-You can disable it with `disable_crack` in your newrelic.yml file.
-
-### Curb
-
-The gem will instrument both Curl::Easy and Curl::Multi - they should show up similarly to Net::HTTP in the UI
-
-You can disable it with `disable_curb` in your newrelic.yml file.
-
-### Elastic Search
-
-The gem will instrument ElasticSearch::Client. The metrics should show up in the UI
-
-You can disable it with `disable_elastic_search_instrumentation` in your newrelic.yml file.
-
-### KyotoTycoon
-
-The gem will instrument KyotoTycoon.
-
-You can disable it with `disable_kyototycoon` in your newrelic.yml file.
-
-### Paperclip
-
-No special configuration required for Paperclip visibility.
-
-You can disable it by setting `disable_paperclip` to true in your newrelic.yml file.
-
-### Picky
-
-The gem will instrument the [Picky semantic search engine](http://florianhanke.com/picky/) so it should be visible in transaction traces and the web transactions page.
-
-You can disable it with `disable_picky` in your newrelic.yml file.
-
-### MongoDB
-
-Our instrumentation works on the underlying 'Mongo' library.
-
-You can disable it by setting 'disable_mongodb' to true in your newrelic.yml file.
-
-### Redis
-
-Redis instrumentation has been removed from rpm_contrib.
-
-Please use Evan Phoenix's `newrelic-redis` gem instead.
-https://github.com/evanphx/newrelic-redis
-
-### Sinatra view instrumentation
-
-This adds instrumentation to the `render` methods in Sinatra::Base
-
-You can disable it with `disable_sinatra_template` in your newrelic.yml file.
-
-### ThinkingSphinx instrumentation
-
-This adds instrumentation to the `initialize` and `results` method of ThinkingSphinx::Search
-
-You can disable it with `disable_thinking_sphinx` in your newrelic.yml file.
-
-
-### Typhoeus instrumentation
-
-This adds instrumentation to the Typhoeus::Request class for 'GET' requests
-
-You can disable it with `disable_typhoeus` in your newrelic.yml file.
-
-### Ultrasphinx instrumentation
-
-This adds basic instrumentation to the `run` and `results` method of Ultrasphinx::Search
-
-You can disable it with `disable_ultrasphinx` in your newrelic.yml file.
-
-### YAJL
-
-This adds instrumentation to the YAJL json parser
-
-You can disable it with `disable_yajl_instrumentation` in your newrelic.yml file.
-
-### AWS/S3
-
-Get metrics on how S3 is performing for you in production. To disable AWS/S3, set
-'disable_aws-s3' to true in your newrelic.yml file. For more information on this
-instrumentation, check out [our blog](http://blog.newrelic.com/2010/07/06/monitoring-aws-s3/).
-
-# How to Add Custom Instrumentation
-
-We encourage contributions to this project and will provide whatever assistance
-we can to those wishing to develop instrumentation for other open source Ruby
-libraries.
-
-When adding instrumentation to this gem, be sure and get familiar with the [RPM
-Agent API](http://newrelic.github.com/rpm/classes/NewRelic/Agent.html) and
-contact support@newrelic.com with any questions.
-
-There are several extension points in the agent you can take advantage of with
-this gem.
-
-* Custom tracers which measure methods and give visibility to
- otherwise unmeasured libraries.
-* Samplers which sample some value about once a minute.
-* Dispatcher support for web request handlers which would otherwise be undetected.
- In order for the agent to turn on in 'auto' mode it needs to discover a
- web dispatcher, or be [started manually](http://support.newrelic.com/faqs/general/manual-start).
-* Framework support, for alternatives to Rails like Camping or Ramaze
-
-## Custom Tracers
-
-Custom tracers for frameworks should be added to the `lib/rpm_contrib/instrumentation`
-directory. These files are loaded at the time the Agent starts. **They will not
-be loaded if the Agent does not start up.**
-
-It is important that you wrap any instrumentation with the checks necessary to
-determine if the code being instrumented is loaded. You can't add code to the
-contrib gem that will break when run in any other context besides yours.
-
-
-For details on how to define custom tracers, refer to the [support documentation
-on adding custom
-tracers](http://support.newrelic.com/faqs/docs/custom-metric-collection). You
-can also get detailed information on the API from the [Agent method tracing
-rdocs](http://newrelic.github.com/rpm/classes/NewRelic/Agent/MethodTracer.html),
-especially the
-[add_method_tracer](http://newrelic.github.com/rpm/classes/NewRelic/Agent/MethodTracer/ClassMethods.html)
-docs.
-
-A good example can be found in `lib/rpm_contrib/instrumentation/paperclip.rb`.
-
-## Samplers
-
-You can add samplers which will record metrics approximately once a minute.
-Samplers are useful for capturing generic instrumentation for display in [custom
-views](http://support.newrelic.com/faqs/docs/custom-dashboard-specification).
-
-Samplers should extend the
-[`NewRelic::Agent::Sampler`](http://newrelic.github.com/rpm/classes/NewRelic/Agent/Sampler.html)
-class. They should be placed in the `samplers` directory.
-
-Refer to examples in the RPM agent to see how to get started.
-
-## Supporting New Dispatchers
-
-If you want to add support for a new dispatcher which is not being recognized by
-default by the RPM agent, add code to the `rpm_contrib/detection` directory.
-This code needs to define a module in the `NewRelic::LocalEnvironment` class.
-This module will be accessed at the time environment detection takes place, when
-the agent is initialized.
-
-This module should define the method `discover_dispatcher` and return the name
-of the dispatcher if detected, or defer to super. See
-`rpm_contrib/detection/camping.rb` for a good example.
-
-## Supporting New Frameworks
-
-Supporting new frameworks can be pretty involved and generally involves both
-adding custom instrumentation as well as framework and dispatcher detection.
-
-In addition it will be necessary to define a new control class with the same
-name as the framework. This control class must go in `new_relic/control`.
-
-Refer to the camping example in this gem to see how this is done in general.
-
-If you decide to tackle any new frameworks, contact support@newrelic.com and
-we'll be happy to help you work through it.
-
-# Note on Patches/Pull Requests
-
-* Fork the http://www.github.com/newrelic/rpm_contrib project.
-* Add instrumentation files to `lib/rpm_contrib/instrumentation`. These
- files will be loaded when the RPM agent is initialized.
-* Add samplers to `lib/rpm_contrib/samplers`. These classes are
- installed automatically when the RPM agent is initialized.
-* Add tests.
-* Update README.md
-* Commit, do not mess with the Rakefile, version, or history. (if you
- want to have your own version, that is fine but bump version in a
- commit by itself I can ignore when I pull)
-* Send me a pull request. Bonus points for topic branches.
-
-# Further Information
-
-Refer to the Agent API Documentation at http://newrelic.github.com/rpm
-
-See the support site faqs at http://support.newrelic.com/faqs for additional
-tips and documentation.
-
-Contact support@newrelic.com for help.
-
-### Copyright
-
-Copyright (c) 2009-2010 New Relic. See LICENSE for details.
+Please see [extends_newrelic_rpm](https://github.com/newrelic/extends_newrelic_rpm) for a list of custom, third party instrumentation for New Relic.
79 Rakefile
View
@@ -1,79 +0,0 @@
-require 'rubygems'
-require "bundler/setup"
-require 'rake'
-# See http://www.rubygems.org/read/chapter/20
-
-def version
- @rpm_contrib_version ||= File.read("CHANGELOG")[/Version ([\d\.]+\w*)$/, 1]
-end
-
-RDOC_FILES = FileList['README*','LICENSE','CHANGELOG']
-SUMMARY = "Contributed Instrumentation for New Relic RPM"
-DESCRIPTION = <<-EOF
-Community contributed instrumentation for various frameworks based on
-the New Relic Ruby monitoring gem newrelic_rpm.
-EOF
-
-begin
- require 'jeweler'
- Jeweler::Tasks.new do |gem|
- gem.name = "rpm_contrib"
- gem.summary = SUMMARY
- gem.description = DESCRIPTION
- gem.email = "support@newrelic.com"
- gem.homepage = "http://github.com/newrelic/rpm_contrib"
- gem.authors = [ "Bill Kayser", "Jon Guymon" ]
- gem.add_dependency 'newrelic_rpm', '>=3.1.1'
- gem.version = version
- gem.files = FileList['LICENSE', 'README*', 'lib/**/*.rb', 'bin/*', '[A-Z]*', 'test/**/*'].to_a
- gem.files.exclude *File.read(File.join(File.dirname(__FILE__), '.gitignore')).split
- gem.rdoc_options <<
- "--line-numbers" <<
- "--inline-source" <<
- "--title" << SUMMARY <<
- "-m" << "README.md"
- gem.extra_rdoc_files = RDOC_FILES
- end
- Jeweler::GemcutterTasks.new
-rescue LoadError
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
-end
-
-require 'rake/testtask'
-Rake::TestTask.new(:test) do |test|
- test.libs << 'lib' << 'test'
- test.pattern = 'test/**/test_*.rb'
- test.verbose = true
-end
-
-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 = "rpm_contrib #{version}"
- rdoc.main = "README.md"
- 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
14 lib/new_relic/control/camping.rb
View
@@ -1,14 +0,0 @@
-require 'new_relic/control/ruby'
-# This is the framework control object for Camping apps.
-# It is loaded by virtue of detecting 'camping' as the framework
-# in the rpm_contrib/detection/camping.rb file. It gets loaded
-# by the new_relic/control.rb file.
-class NewRelic::Control #:nodoc:
- class Camping < NewRelic::Control::Ruby
- def init_config(options)
- super
- @local_env.dispatcher = 'camping'
- self['app_name'] ||= 'Camping Application'
- end
- end
-end
35 lib/rpm_contrib.rb
View
@@ -1,35 +0,0 @@
-RPM_CONTRIB_LIB = File.dirname(__FILE__)
-
-module RPMContrib; end
-
-require 'rpm_contrib/detection'
-
-require 'newrelic_rpm'
-require 'rpm_contrib/agent_compatibility'
-require 'rpm_contrib/instrumentation'
-
-# Load all the Sampler class definitions. These will register
-# automatically with the agent.
-require 'rpm_contrib/samplers'
-
-if defined? Rails
- # Rails 3.x+
- if Rails.respond_to?(:version) && Rails.version.to_s =~ /^(3|4)/
- module NewRelic
- class Railtie < Rails::Railtie
- initializer("rpm_contrib.start_plugin"){ NewRelic::Control.instance.init_plugin }
- end
- end
- # Rails 2.x
- elsif defined?(Rails) && Rails.respond_to?(:configuration)
- Rails.configuration.after_initialize { NewRelic::Control.instance.init_plugin }
- else
- raise "The rpm_contrib gem supports Rails 2.2+ only."
- end
-else
- # If not running Rails, it is important that you load the contrib gem as late
- # as possible so the agent initializes after everything else. Either that
- # or make the following call yourself at the end of your startup sequence
- # (it is idempotent).
- NewRelic::Control.instance.init_plugin
-end
11 lib/rpm_contrib/agent_compatibility.rb
View
@@ -1,11 +0,0 @@
-if NewRelic::VERSION::STRING < '3.2.0'
- module DependencyDetection
- def self.dependency_by_name(name)
- @@items.find {|i| i.name == name }
- end
-
- class Dependent
- attr_reader :name
- end
- end
-end
5 lib/rpm_contrib/detection.rb
View
@@ -1,5 +0,0 @@
-# Currently the only framework we are detecting with an agent
-# patch is camping. You need to specify the camping gem prior
-# to the contrib gem and newrelic agent gem in order for this to work.
-require 'rpm_contrib/detection/camping'
-
24 lib/rpm_contrib/detection/camping.rb
View
@@ -1,24 +0,0 @@
-module NewRelic #:nodoc:
- # The class defined in the
- # newrelic_rpm[http://newrelic.github.com/rpm] which can be amended
- # to support new frameworks by defining modules in this namespace.
- class LocalEnvironment #:nodoc:
- module Camping
- def discover_framework
- if defined?(::Camping)
- puts "framework is camping"
- @framework = 'camping'
- else
- super
- end
- end
- def discover_dispatcher
- super
- if defined?(::Camping) && @dispatcher.nil?
- @dispatcher = 'camping'
- end
- end
- end
- end
-end
-
16 lib/rpm_contrib/instrumentation.rb
View
@@ -1,16 +0,0 @@
-require 'newrelic_rpm'
-module RpmContrib
- # Contributed instrumentation files for use with newrelic_rpm gem
- module Instrumentation
- end
-end
-
-pattern = File.expand_path "../instrumentation/**/*.rb", __FILE__
-Dir.glob pattern do |file|
- begin
- require file.to_s
- rescue Exception => e
- NewRelic::Agent.logger.error "Skipping instrumentation file '#{file}': #{e}"
- NewRelic::Agent.logger.debug e.backtrace.join("\n")
- end
-end
22 lib/rpm_contrib/instrumentation/active_messaging.rb
View
@@ -1,22 +0,0 @@
-# ActiveMessaging Instrumentation
-
-DependencyDetection.defer do
- @name = :active_messaging
-
- depends_on do
- defined?(::ActiveMessaging::Processor) && !NewRelic::Control.instance['disable_active_messaging'] &&
- !NewRelic::Control.instance['disable_active_mq']
- end
-
- executes do
- NewRelic::Agent.logger.debug 'Installing ActiveMessaging instrumentation'
- end
-
- executes do
- ::ActiveMessaging::Processor.class_eval do
- include NewRelic::Agent::MethodTracer
-
- add_method_tracer :on_message, 'ActiveMessaging/OnMessage'
- end
- end
-end
74 lib/rpm_contrib/instrumentation/aws.rb
View
@@ -1,74 +0,0 @@
-# AWS Instrumentation by Brian Doll of New Relic
-DependencyDetection.defer do
- @name = :aws
-
- depends_on do
- defined?(::AWS::S3::Connection) && !NewRelic::Control.instance['disable_aws-s3']
- end
-
- executes do
- NewRelic::Agent.logger.debug 'Installing AWS instrumentation'
- end
-
-
- executes do
- # Instrument connections to the AWS-S3 service
- if defined?(::AWS::S3::Connection)
- ::AWS::S3::Connection::Management::ClassMethods.module_eval do
- add_method_tracer :establish_connection!, 'AWS-S3/establish_connection!'
- end
- else #using aws-sdk
- ::AWS::S3.class_eval do
- add_method_tracer :initialize, 'AWS-S3/establish_connection!'
- end
- end
-
- # Instrument methods on Bucket
- ::AWS::S3::Bucket.instance_eval do
- class << self
- add_method_tracer :create, 'AWS-S3/Bucket/create'
- add_method_tracer :find, 'AWS-S3/Bucket/find'
- add_method_tracer :objects, 'AWS-S3/Bucket/objects'
- add_method_tracer :delete, 'AWS-S3/Bucket/delete'
- add_method_tracer :list, 'AWS-S3/Bucket/list'
- end
- end
-
- # Instrument methods on Bucket instances
- ::AWS::S3::Bucket.class_eval do
- add_method_tracer :[], 'AWS-S3/Bucket/#{self.name}/[]'
- add_method_tracer :new_object,'AWS-S3/Bucket/#{self.name}/new_objects'
- add_method_tracer :objects, 'AWS-S3/Bucket/#{self.name}/objects'
- add_method_tracer :delete, 'AWS-S3/Bucket/#{self.name}/delete'
- add_method_tracer :delete_all,'AWS-S3/Bucket/#{self.name}/delete_all'
- add_method_tracer :update, 'AWS-S3/Bucket/#{self.name}/update'
- end
-
- # Instrument methods on S3Object
- ::AWS::S3::S3Object.instance_eval do
- class << self
- add_method_tracer :about, 'AWS-S3/S3Object/about'
- add_method_tracer :copy, 'AWS-S3/S3Object/copy'
- add_method_tracer :delete, 'AWS-S3/S3Object/delete'
- add_method_tracer :rename, 'AWS-S3/S3Object/rename'
- add_method_tracer :store, 'AWS-S3/S3Object/store'
- end
- end
-
- # Instrument methods on S3Object instances
- # Metric names are aggregated across all S3Objects since having a metric for
- # every single S3Object instance and method pair would be fairly useless
- ::AWS::S3::S3Object.class_eval do
- add_method_tracer :value, 'AWS-S3/S3Objects/value'
- add_method_tracer :about, 'AWS-S3/S3Objects/about'
- add_method_tracer :metadata, 'AWS-S3/S3Objects/metadata'
- add_method_tracer :store, 'AWS-S3/S3Objects/store'
- add_method_tracer :delete, 'AWS-S3/S3Objects/delete'
- add_method_tracer :copy, 'AWS-S3/S3Objects/copy'
- add_method_tracer :rename, 'AWS-S3/S3Objects/rename'
- add_method_tracer :etag, 'AWS-S3/S3Objects/etag'
- add_method_tracer :owner, 'AWS-S3/S3Objects/owner'
- end
- end
-end
-
50 lib/rpm_contrib/instrumentation/camping.rb
View
@@ -1,50 +0,0 @@
-module RPMContrib
- module Instrumentation
- # == Instrumentation for Camping
- # To instrument all controllers do the following:
- # 1. Add require 'rpm_contrib' after loading camping.
- # 2. Add an include at the end of your main Camping app module
- # 3. Run the following command to get the NewRelic license key to use: heroku config -all
- # 4. Create a newrelic.yml under the /config folder with the following content:
- #
- # common: &default_settings
- # license_key: 'PASTE THE VALUE OF NEW_RELIC_LICENSE_KEY HERE'
- # app_name: PASTE THE NAME OF YOUR CAMPING APP HERE
- # monitor_mode: true
- #
- # production:
- # <<: *default_settings
- #
- # Camping code example:
- # -------------------------------------------------------------------------------------
- #
- # require "rpm_contrib"
- #
- # Camping.goes :NewRelicCampingTest
- #
- # module NewRelicCampingTest
- # # your code
- #
- # include RPMContrib::Instrumentation::Camping
- #
- # end
- #
- #
- module Camping
-
- def self.included(mod)
- require 'new_relic/agent/instrumentation/controller_instrumentation'
- # Since the Camping::Base module is essentially copied
- # into the main module (the mod passed in) of a Camping app
- # using the Camping.goes :NewRelicCampingTest syntax
- # we need to evaluate "weld" the NewRelic plugin in the context of the new Base
-
- (Kernel.const_get(mod.name)::Base).module_eval do
- include NewRelic::Agent::Instrumentation::ControllerInstrumentation
- add_transaction_tracer :service
- end
- end
-
- end #RPMContrib::Instrumentation::Camping
- end
-end
30 lib/rpm_contrib/instrumentation/cassandra.rb
View
@@ -1,30 +0,0 @@
-DependencyDetection.defer do
- @name = :cassandra
-
- depends_on do
- defined?(::Cassandra) && !NewRelic::Control.instance['disable_cassandra_instrumentation']
- end
-
- executes do
- NewRelic::Agent.logger.debug 'Installing Cassandra instrumentation'
- end
-
- executes do
- ::Cassandra.class_eval do
- add_method_tracer :insert, 'Database/Cassandra/insert'
- add_method_tracer :remove, 'Database/Cassandra/remove'
- add_method_tracer :clear_column_family!, 'Database/Cassandra/clear_column_family!'
- add_method_tracer :clear_keyspace!, 'Database/Cassandra/clear_keyspace!'
- add_method_tracer :count_columns, 'Database/Cassandra/count_columns'
- add_method_tracer :multi_count_columns, 'Database/Cassandra/multi_count_columns'
- add_method_tracer :get_columns, 'Database/Cassandra/get_columns'
- add_method_tracer :multi_get_columns, 'Database/Cassandra/multi_get_columns'
- add_method_tracer :get, 'Database/Cassandra/get'
- add_method_tracer :multi_get, 'Database/Cassandra/multi_get'
- add_method_tracer :exists?, 'Database/Cassandra/exists?'
- add_method_tracer :get_range, 'Database/Cassandra/get_range'
- add_method_tracer :count_range, 'Database/Cassandra/count_range'
- add_method_tracer :batch, 'Database/Cassandra/batch'
- end
- end
-end
41 lib/rpm_contrib/instrumentation/crack.rb
View
@@ -1,41 +0,0 @@
-DependencyDetection.defer do
- @name = :crack_json
-
- depends_on do
- defined?(::Crack::JSON) && !NewRelic::Control.instance['disable_crack']
- end
-
- executes do
- NewRelic::Agent.logger.debug 'Installing Crack::JSON instrumentation'
- end
-
- executes do
- ::Crack::JSON.class_eval do
- class << self
- include NewRelic::Agent::MethodTracer
- add_method_tracer :parse, 'Parser/#{self.name}/parse'
- end
- end
- end
-end
-
-DependencyDetection.defer do
- @name = :crack_xml
-
- depends_on do
- defined?(::Crack::XML) && !NewRelic::Control.instance['disable_crack']
- end
-
- executes do
- NewRelic::Agent.logger.debug 'Installing Crack::XML instrumentation'
- end
-
- executes do
- ::Crack::XML.class_eval do
- class << self
- include NewRelic::Agent::MethodTracer
- add_method_tracer :parse, 'Parser/#{self.name}/parse'
- end
- end
- end
-end
53 lib/rpm_contrib/instrumentation/curb.rb
View
@@ -1,53 +0,0 @@
-DependencyDetection.defer do
- @name = :curb
-
- depends_on do
- defined?(::Curl) and not NewRelic::Control.instance['disable_curb']
- end
-
- executes do
- NewRelic::Agent.logger.debug 'Installing Curb instrumentation'
- end
-
- executes do
- ::Curl::Easy.class_eval do
- URI_CLASS = defined?(::Addressable) ? ::Addressable::URI : URI
- def host
- self.url.respond_to?(:host) ? self.url.host : URI_CLASS.parse(self.url).host
- end
-
- # TODO: http, http_delete, http_get, http_post, http_head, http_put
- def perform_with_newrelic_trace(*args, &block)
- metrics = ["External/#{host}/Curl::Easy","External/#{host}/all"]
- if NewRelic::Agent::Instrumentation::MetricFrame.recording_web_transaction?
- metrics << "External/allWeb"
- else
- metrics << "External/allOther"
- end
- self.class.trace_execution_scoped metrics do
- perform_without_newrelic_trace(*args, &block)
- end
- end
- alias perform_without_newrelic_trace perform
- alias perform perform_with_newrelic_trace
- end
-
- ::Curl::Multi.class_eval do
- # TODO: http
- def perform_with_newrelic_trace(*args, &block)
- metrics = ["External/Curl::Multi"]
- if NewRelic::Agent::Instrumentation::MetricFrame.recording_web_transaction?
- metrics << "External/allWeb"
- else
- metrics << "External/allOther"
- end
- self.class.trace_execution_scoped metrics do
- perform_without_newrelic_trace(*args, &block)
- end
- end
- alias perform_without_newrelic_trace perform
- alias perform perform_with_newrelic_trace
- end
- end
-end
-
26 lib/rpm_contrib/instrumentation/elastic_search.rb
View
@@ -1,26 +0,0 @@
-# == Elastic Search Instrumentation
-#
-DependencyDetection.defer do
- @name = :elastic_search
-
- depends_on do
- defined?(::ElasticSearch::Client) && !NewRelic::Control.instance['disable_elastic_search_instrumentation']
- end
-
- executes do
- NewRelic::Agent.logger.debug 'Installing Elastic Search instrumentation'
- end
-
- executes do
- ::ElasticSearch::Client.class_eval do
- add_method_tracer :index, 'ActiveRecord/ElasticSearch/index'
- add_method_tracer :get, 'ActiveRecord/ElasticSearch/get'
- add_method_tracer :delete, 'ActiveRecord/ElasticSearch/delete'
- add_method_tracer :search, 'ActiveRecord/ElasticSearch/search'
- add_method_tracer :scroll, 'ActiveRecord/ElasticSearch/scroll'
- add_method_tracer :count, 'ActiveRecord/ElasticSearch/count'
- add_method_tracer :bulk, 'ActiveRecord/ElasticSearch/bulk'
- end
- end
-end
-
28 lib/rpm_contrib/instrumentation/kyototycoon.rb
View
@@ -1,28 +0,0 @@
-# KyotoTycoon instrumentation
-
-DependencyDetection.defer do
- @name = :kyototycoon
-
- depends_on do
- defined?(::KyotoTycoon) && !NewRelic::Control.instance['disable_kyototycoon']
- end
-
- executes do
- NewRelic::Agent.logger.debug 'Installing KyotoTycoon instrumentation'
- end
-
- executes do
- ::KyotoTycoon.class_eval do
- require 'new_relic/agent/method_tracer'
- include NewRelic::Agent::MethodTracer
-
- [:get, :remove, :set, :add, :replace,
- :append, :cas, :increment, :decrement, :increment_double,
- :set_bulk, :get_bulk, :remove_bulk, :clear, :vacuum,
- :sync, :report, :status, :match_prefix, :match_regex,
- :keys].each do |method|
- add_method_tracer method
- end
- end
- end
-end
55 lib/rpm_contrib/instrumentation/mongo.rb
View
@@ -1,55 +0,0 @@
-# Mongo Instrumentation contributed by Alexey Palazhchenko
-DependencyDetection.defer do
- @name = :mongodb
-
- depends_on do
- defined?(::Mongo) and not NewRelic::Control.instance['disable_mongodb']
- end
-
- executes do
- NewRelic::Agent.logger.debug 'Installing MongoDB instrumentation'
- end
-
- executes do
- ::Mongo::Logging.class_eval do
- include NewRelic::Agent::MethodTracer
-
- def instrument_with_newrelic_trace(name, payload = {}, &blk)
- payload = {} if payload.nil?
- collection = payload[:collection]
- if collection == '$cmd'
- f = payload[:selector].first
- name, collection = f if f
- end
-
- trace_execution_scoped("Database/#{collection}/#{name}") do
- t0 = Time.now
- res = instrument_without_newrelic_trace(name, payload, &blk)
- NewRelic::Agent.instance.transaction_sampler.notice_sql(payload.inspect, nil, (Time.now - t0).to_f)
- res
- end
- end
-
- alias_method :instrument_without_newrelic_trace, :instrument
- alias_method :instrument, :instrument_with_newrelic_trace
- end
- class Mongo::Collection; include Mongo::Logging; end
- class Mongo::Connection; include Mongo::Logging; end
- class Mongo::Cursor; include Mongo::Logging; end
-
- # cursor refresh is not currently instrumented in mongo driver, so not picked up by above - have to add our own here
- ::Mongo::Cursor.class_eval do
- include NewRelic::Agent::MethodTracer
-
- def send_get_more_with_newrelic_trace
- trace_execution_scoped("Database/#{collection.name}/refresh") do
- send_get_more_without_newrelic_trace
- end
- end
- alias_method :send_get_more_without_newrelic_trace, :send_get_more
- alias_method :send_get_more, :send_get_more_with_newrelic_trace
- add_method_tracer :close, 'Database/#{collection.name}/close'
- end
- end
-
-end
21 lib/rpm_contrib/instrumentation/mongoid.rb
View
@@ -1,21 +0,0 @@
-DependencyDetection.defer do
- @name = :mongoid
-
- depends_on do
- defined?(::Mongoid) && Mongoid::VERSION.to_i == 2 && !NewRelic::Control.instance['disable_mongoid']
- end
-
- executes do
- NewRelic::Agent.logger.debug 'Installing Mongoid instrumentation'
- end
-
- executes do
- Mongoid::Collection.class_eval do
- include NewRelic::Agent::MethodTracer
-
- (Mongoid::Collections::Operations::ALL - [:<<, :[]]).each do |method|
- add_method_tracer method, "ActiveRecord/\#{@klass}/#{method}"
- end
- end
- end
-end
29 lib/rpm_contrib/instrumentation/paperclip.rb
View
@@ -1,29 +0,0 @@
-DependencyDetection.defer do
- @name = :paperclip
-
- depends_on do
- defined?(::Paperclip) && !NewRelic::Control.instance['disable_paperclip']
- end
-
- executes do
- NewRelic::Agent.logger.debug 'Installing Paperclip instrumentation'
- end
-
- executes do
- ::Paperclip::Attachment.class_eval do
- add_method_tracer :save, 'Paperclip/#{name}/save'
- add_method_tracer :assign, 'Paperclip/#{name}/assign'
- add_method_tracer :post_process, 'Paperclip/#{name}/post_process'
- end
-
- ::Paperclip::Storage::Filesystem.class_eval do
- add_method_tracer :flush_deletes, 'Paperclip/Storage/flush_deletes'
- add_method_tracer :flush_writes, 'Paperclip/Storage/flush_writes'
- end
-
- ::Paperclip::Storage::S3.class_eval do
- add_method_tracer :flush_deletes, 'Paperclip/Storage/flush_deletes'
- add_method_tracer :flush_writes, 'Paperclip/Storage/flush_writes'
- end
- end
-end
41 lib/rpm_contrib/instrumentation/picky.rb
View
@@ -1,41 +0,0 @@
-if defined?(::Picky)
-
- class Picky::NewRelic
- def self.obfuscate_tokens tokens
- tokens.map { |t|
- o = 'xxx'
- o += '~' if t.similar?
- o += '*' if t.partial?
- o = t.qualifiers.sort.join(',') + ':' + o if t.qualifiers && t.qualifiers.respond_to?(:join)
- o
- }.sort.join(' ')
- end
- end
-
-end
-
-DependencyDetection.defer do
- @name = :picky
-
- depends_on do
- defined?(::Picky::Search) && !NewRelic::Control.instance['disable_picky']
- end
-
- executes do
- NewRelic::Agent.logger.debug 'Installing Picky instrumentation'
- end
-
- executes do
- ::Picky::Search.class_eval do
- include NewRelic::Agent::MethodTracer
-
- def execute_with_newrelic_trace *args
- metrics = "Custom/Picky/search: #{Picky::NewRelic.obfuscate_tokens args[0]}"
- self.class.trace_execution_scoped(metrics){ execute_without_newrelic_trace(*args) }
- end
-
- alias_method :execute_without_newrelic_trace, :execute
- alias_method :execute, :execute_with_newrelic_trace
- end
- end
-end
30 lib/rpm_contrib/instrumentation/sinatra.rb
View
@@ -1,30 +0,0 @@
-DependencyDetection.defer do
- @name = :sinatra_view
-
- depends_on do
- defined?(::Sinatra::Base) and not NewRelic::Control.instance['disable_sinatra_template']
- end
-
- executes do
- NewRelic::Agent.logger.debug 'Installing Sinatra view instrumentation'
- end
-
- executes do
- ::Sinatra::Base.class_eval do
- def render_with_newrelic_trace(*args, &block)
- engine, file = *args
- return render_without_newrelic_trace(*args, &block) if file == "= yield"
-
- file = "Proc" if file.is_a?(Proc)
- metrics = ["View/#{engine}/#{file}/Rendering"]
-
- self.class.trace_execution_scoped metrics do
- render_without_newrelic_trace(*args, &block)
- end
- end
-
- alias render_without_newrelic_trace render
- alias render render_with_newrelic_trace
- end
- end
-end
22 lib/rpm_contrib/instrumentation/thinking_sphinx.rb
View
@@ -1,22 +0,0 @@
-DependencyDetection.defer do
- @name = :thinking_sphinx
-
- depends_on do
- defined?(::ThinkingSphinx) and not ::NewRelic::Control.instance['disable_thinking_sphinx']
- end
-
- executes do
- NewRelic::Agent.logger.debug 'Installing Thinking Sphinx instrumentation'
- end
-
- executes do
- class ::ThinkingSphinx::Search
- include NewRelic::Agent::MethodTracer
-
- add_method_tracer :initialize
- add_method_tracer :populate
- add_method_tracer :results
- end
- end
-end
-
33 lib/rpm_contrib/instrumentation/typhoeus.rb
View
@@ -1,33 +0,0 @@
-DependencyDetection.defer do
- @name = :typhoeus
-
- depends_on do
- defined?(::Typhoeus) and not ::NewRelic::Control.instance['disable_typhoeus']
- end
-
- executes do
- NewRelic::Agent.logger.debug 'Installing Typhoeus instrumentation'
- end
-
- executes do
- require 'uri'
- ::Typhoeus::Request.instance_eval do
- def get_with_newrelic_trace(*args, &block)
- uri = URI.parse(args.first)
- metrics = ["External/#{uri.host}/Typhoeus/GET","External/#{uri.host}/all"]
- if NewRelic::Agent::Instrumentation::MetricFrame.recording_web_transaction?
- metrics << "External/allWeb"
- else
- metrics << "External/allOther"
- end
- self.class.trace_execution_scoped metrics do
- get_without_newrelic_trace(*args, &block)
- end
- end
- alias get_without_newrelic_trace get
- alias get get_with_newrelic_trace
- end
- end
-end
-
-
22 lib/rpm_contrib/instrumentation/ultrasphinx.rb
View
@@ -1,22 +0,0 @@
-DependencyDetection.defer do
- @name = :ultrasphinx
-
- depends_on do
- defined?(::Ultrasphinx) and not ::NewRelic::Control.instance['disable_ultrasphinx']
- end
-
- executes do
- NewRelic::Agent.logger.debug 'Installing Ultrasphinx instrumentation'
- end
-
- executes do
- class ::Ultrasphinx::Search
- include NewRelic::Agent::MethodTracer
-
- add_method_tracer :run
- add_method_tracer :results
- end
- end
-end
-
-
41 lib/rpm_contrib/instrumentation/yajl.rb
View
@@ -1,41 +0,0 @@
-DependencyDetection.defer do
- @name = :yajl_parser
-
- depends_on do
- defined?(::Yajl::Parser) && !NewRelic::Control.instance['disable_yajl_instrumentation']
- end
-
- executes do
- NewRelic::Agent.logger.debug 'Installing Yajl::Parser instrumentation'
- end
-
- executes do
- ::Yajl::Parser.class_eval do
- class << self
- include ::NewRelic::Agent::MethodTracer
- add_method_tracer :parse, 'Parser/Yajl/parse'
- end
- end
- end
-end
-
-DependencyDetection.defer do
- @name = :yajl_encoder
-
- depends_on do
- defined?(::Yajl::Encoder) && !NewRelic::Control.instance['disable_yajl_instrumentation']
- end
-
- executes do
- NewRelic::Agent.logger.debug 'Installing Yajl::Encoder instrumentation'
- end
-
- executes do
- ::Yajl::Encoder.class_eval do
- class << self
- include ::NewRelic::Agent::MethodTracer
- add_method_tracer :encode, 'Encoder/Yajl/encode'
- end
- end
- end
-end
31 lib/rpm_contrib/language_support.rb
View
@@ -1,31 +0,0 @@
-module RPMContrib::LanguageSupport
- extend self
-
- @@forkable = nil
-
- def can_fork?
- # this is expensive to check, so we should only check once
- return @@forkable if @@forkable != nil
-
- if Process.respond_to?(:fork)
- # if this is not 1.9.2 or higher, we have to make sure
- @@forkable = ::RUBY_VERSION < '1.9.2' ? test_forkability : true
- else
- @@forkable = false
- end
-
- @@forkable
- end
-
- private
-
- def test_forkability
- child = Process.fork { exit! }
- # calling wait here doesn't seem like it should necessary, but it seems to
- # resolve some weird edge cases with resque forking.
- Process.wait child
- true
- rescue NotImplementedError
- false
- end
-end
17 lib/rpm_contrib/samplers.rb
View
@@ -1,17 +0,0 @@
-module RpmContrib
- # Samplers are subclasses of NewRelic::Agent::Sampler which periodically collect metric data in a
- # background thread. Sampler classes belong in the sampler subdirectory and must be loaded before
- # the agent starts.
- module Samplers
- end
-end
-
-pattern = File.expand_path "../samplers/**/*.rb", __FILE__
-Dir.glob pattern do |file|
- begin
- require file.to_s
- rescue Exception => e
- NewRelic::Agent.logger.error "Skipping instrumentation file '#{file}': #{e}"
- NewRelic::Agent.logger.debug e.backtrace.join("\n")
- end
-end
175 newrelic.yml
View
@@ -1,175 +0,0 @@
-#
-# This file configures the NewRelic RPM Agent, NewRelic RPM monitors Rails
-# applications with deep visibility and low overhead. For more information,
-# visit www.newrelic.com.
-#
-# This configuration file is custom generated for rpm_config
-#
-# here are the settings that are common to all environments
-common: &default_settings
- # ============================== LICENSE KEY ===============================
- # You must specify the licence key associated with your New Relic account.
- # This key binds your Agent's data to your account in the New Relic RPM service.
- license_key: 'test'
-
- # Application Name
- # Set this to be the name of your application as you'd like it show up in RPM.
- # RPM will then auto-map instances of your application into a RPM "application"
- # on your home dashboard page. This setting does not prevent you from manually
- # defining applications.
- app_name: rpm_config
-
- # When 'enabled' is turned on, the agent collects performance data
- # by inserting lightweight tracers on key methods inside the rails
- # framework and asynchronously aggregating and reporting this
- # performance data to the NewRelic RPM service at newrelic.com.
- enabled: false
-
- # The newrelic agent generates its own log file to keep its logging
- # information separate from that of your application. Specify its
- # log level here.
- log_level: info
-
- # The newrelic agent communicates with the RPM service via http by
- # default. If you want to communicate via https to increase
- # security, then turn on SSL by setting this value to true. Note,
- # this will result in increased CPU overhead to perform the
- # encryption involved in SSL communication, but this work is done
- # asynchronously to the threads that process your application code,
- # so it should not impact response times.
- ssl: false
-
- # EXPERIMENTAL: enable verification of the SSL certificate sent by
- # the server. This setting has no effect unless SSL is enabled
- # above. This may block your application. Only enable it if the data
- # you send us needs end-to-end verified certificates.
- #
- # This means we cannot cache the DNS lookup, so each request to the
- # RPM service will perform a lookup. It also means that we cannot
- # use a non-blocking lookup, so in a worst case, if you have DNS
- # problems, your app may block indefinitely.
- # verify_certificate: true
-
- # Set your application's Apdex threshold value with the 'apdex_t'
- # setting, in seconds. The apdex_t value determines the buckets used
- # to compute your overall Apdex score.
- # Requests that take less than apdex_t seconds to process will be
- # classified as Satisfying transactions; more than apdex_t seconds
- # as Tolerating transactions; and more than four times the apdex_t
- # value as Frustrating transactions.
- # For more about the Apdex standard, see
- # http://support.newrelic.com/faqs/general/apdex
-
- apdex_t: 0.5
-
- # Proxy settings for connecting to the RPM server.
- #
- # If a proxy is used, the host setting is required. Other settings
- # are optional. Default port is 8080.
- #
- # proxy_host: hostname
- # proxy_port: 8080
- # proxy_user:
- # proxy_pass:
-
-
- # Tells transaction tracer and error collector (when enabled)
- # whether or not to capture HTTP params. When true, the RoR
- # filter_parameter_logging mechanism is used so that sensitive
- # parameters are not recorded
- capture_params: false
-
-
- # Transaction tracer captures deep information about slow
- # transactions and sends this to the RPM service once a
- # minute. Included in the transaction is the exact call sequence of
- # the transactions including any SQL statements issued.
- transaction_tracer:
-
- # Transaction tracer is enabled by default. Set this to false to
- # turn it off. This feature is only available at the Silver and
- # above product levels.
- enabled: true
-
- # Threshold in seconds for when to collect a transaction
- # trace. When the response time of a controller action exceeds
- # this threshold, a transaction trace will be recorded and sent to
- # RPM. Valid values are any float value, or (default) "apdex_f",
- # which will use the threshold for an dissatisfying Apdex
- # controller action - four times the Apdex T value.
- transaction_threshold: apdex_f
-
- # When transaction tracer is on, SQL statements can optionally be
- # recorded. The recorder has three modes, "off" which sends no
- # SQL, "raw" which sends the SQL statement in its original form,
- # and "obfuscated", which strips out numeric and string literals
- record_sql: obfuscated
-
- # Threshold in seconds for when to collect stack trace for a SQL
- # call. In other words, when SQL statements exceed this threshold,
- # then capture and send to RPM the current stack trace. This is
- # helpful for pinpointing where long SQL calls originate from
- stack_trace_threshold: 0.500
-
- # Error collector captures information about uncaught exceptions and
- # sends them to RPM for viewing
- error_collector:
-
- # Error collector is enabled by default. Set this to false to turn
- # it off. This feature is only available at the Silver and above
- # product levels
- enabled: true
-
- # Tells error collector whether or not to capture a source snippet
- # around the place of the error when errors are View related.
- capture_source: true
-
- # To stop specific errors from reporting to RPM, set this property
- # to comma separated values
- #
- #ignore_errors: ActionController::RoutingError, ...
-
- # (Advanced) Uncomment this to ensure the cpu and memory samplers
- # won't run. Useful when you are using the agent to monitor an
- # external resource
- # disable_samplers: true
-
-# override default settings based on your application's environment
-
-# NOTE if your application has other named environments, you should
-# provide newrelic conifguration settings for these enviromnents here.
-
-development:
- <<: *default_settings
- # Turn off communication to RPM service in development mode.
- # NOTE: for initial evaluation purposes, you may want to temporarily
- # turn the agent on in development mode.
- enabled: false
-
- # When running in Developer Mode, the New Relic Agent will present
- # performance information on the last 100 transactions you have
- # executed since starting the mongrel. to view this data, go to
- # http://localhost:3000/newrelic
- developer: true
-
-test:
- <<: *default_settings
- # it almost never makes sense to turn on the agent when running
- # unit, functional or integration tests or the like.
- enabled: false
-
-# Turn on the agent in production for 24x7 monitoring. NewRelic
-# testing shows an average performance impact of < 5 ms per
-# transaction, you you can leave this on all the time without
-# incurring any user-visible performance degredation.
-production:
- <<: *default_settings
- enabled: true
-
-# many applications have a staging environment which behaves
-# identically to production. Support for that environment is provided
-# here. By default, the staging environment has the agent turned on.
-staging:
- <<: *default_settings
- enabled: true
- app_name: rpm_config
81 rpm_contrib.gemspec
View
@@ -1,81 +0,0 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE DIRECTLY
-# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
-# -*- encoding: utf-8 -*-
-
-Gem::Specification.new do |s|
- s.name = "rpm_contrib"
- s.version = "2.2.0"
-
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["Bill Kayser", "Jon Guymon", "Jason Clark"]
- s.date = "2014-06-09"
- s.description = "Deprecated community contributed instrumentation for various frameworks based on New Relic's Ruby monitoring gem newrelic_rpm.\n"
- s.email = "support@newrelic.com"
- s.extra_rdoc_files = [
- "CHANGELOG",
- "LICENSE",
- "README.md"
- ]
- s.files = [
- "CHANGELOG",
- "Gemfile",
- "LICENSE",
- "README.md",
- "Rakefile",
- "lib/new_relic/control/camping.rb",
- "lib/rpm_contrib.rb",
- "lib/rpm_contrib/agent_compatibility.rb",
- "lib/rpm_contrib/detection.rb",
- "lib/rpm_contrib/detection/camping.rb",
- "lib/rpm_contrib/instrumentation.rb",
- "lib/rpm_contrib/instrumentation/active_messaging.rb",
- "lib/rpm_contrib/instrumentation/aws.rb",
- "lib/rpm_contrib/instrumentation/camping.rb",
- "lib/rpm_contrib/instrumentation/cassandra.rb",
- "lib/rpm_contrib/instrumentation/crack.rb",
- "lib/rpm_contrib/instrumentation/curb.rb",
- "lib/rpm_contrib/instrumentation/elastic_search.rb",
- "lib/rpm_contrib/instrumentation/kyototycoon.rb",
- "lib/rpm_contrib/instrumentation/mongo.rb",
- "lib/rpm_contrib/instrumentation/mongoid.rb",
- "lib/rpm_contrib/instrumentation/paperclip.rb",
- "lib/rpm_contrib/instrumentation/picky.rb",
- "lib/rpm_contrib/instrumentation/sinatra.rb",
- "lib/rpm_contrib/instrumentation/thinking_sphinx.rb",
- "lib/rpm_contrib/instrumentation/typhoeus.rb",
- "lib/rpm_contrib/instrumentation/ultrasphinx.rb",
- "lib/rpm_contrib/instrumentation/yajl.rb",
- "lib/rpm_contrib/language_support.rb",
- "lib/rpm_contrib/samplers.rb",
- "test/helper.rb",
- "test/schema.rb",
- "test/test_curb.rb",
- "test/test_picky.rb"
- ]
- s.homepage = "http://github.com/newrelic/rpm_contrib"
- s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Contributed Instrumentation for New Relic RPM", "-m", "README.md"]
- s.require_paths = ["lib"]
- s.rubygems_version = "1.8.10"
- s.summary = "Contributed Instrumentation for New Relic RPM"
- s.post_install_message = <<-EOS
-*********************************************************************
-WARNING: rpm_contrib is deprecated. New Relic recommends moving to
-gems listed at https://github.com/newrelic/extends_newrelic_rpm for
-further instrumentation. :thanks:
-*********************************************************************
-EOS
-
- if s.respond_to? :specification_version then
- s.specification_version = 3
-
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<newrelic_rpm>, [">= 3.1.1"])
- else
- s.add_dependency(%q<newrelic_rpm>, [">= 3.1.1"])
- end
- else
- s.add_dependency(%q<newrelic_rpm>, [">= 3.1.1"])
- end
-end
-
9 test/helper.rb
View
@@ -1,9 +0,0 @@
-require 'rubygems'
-require 'test/unit'
-
-$LOAD_PATH.unshift(File.dirname(__FILE__))
-$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
-
-require File.expand_path("../../lib/rpm_contrib.rb", __FILE__)
-
-require 'schema.rb'
19 test/schema.rb
View
@@ -1,19 +0,0 @@
-# Use this file to add tables you need to do testing
-# These are created in a sqllite memory DB
-
-begin
- require 'sqlite3'
- require 'active_record'
-
- ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
- ActiveRecord::Migration.verbose = false
-
- ActiveRecord::Schema.define do
-
- create_table :stories, :force => true do |table|
- table.string :text
- end
- end
-rescue LoadError
- # Skip AR tests
-end
69 test/test_curb.rb
View
@@ -1,69 +0,0 @@
-require "#{File.dirname(__FILE__)}/helper"
-begin
-require 'curb'
-rescue LoadError
-end
-
-class NewRelic::Agent::NetInstrumentationTest < Test::Unit::TestCase
- include NewRelic::Agent::Instrumentation::ControllerInstrumentation
- def setup
- NewRelic::Agent.manual_start
- @engine = NewRelic::Agent.instance.stats_engine
- @engine.clear_stats
- end
- def test_get
- curl = Curl::Easy.new('http://www.google.com/index.html')
- curl.perform
- assert_match /<head>/, curl.body_str
- assert_equal %w[External/www.google.com/Curl::Easy External/Curl::Multi
- External/allOther External/www.google.com/all].sort,
- @engine.metrics.sort
- end
-
- def test_multi
- multi = Curl::Multi.new
- curl1 = Curl::Easy.new('http://www.google.com/index.html')
- multi.add curl1
- curl2 = Curl::Easy.new('http://www.yahoo.com/')
- multi.add curl2
- multi.perform
- assert_match /<head>/, curl1.body_str
- assert_match /<head>/, curl2.body_str
- assert_equal %w[External/Curl::Multi External/allOther].sort,
- @engine.metrics.sort
- end
-
- def test_background
- perform_action_with_newrelic_trace("task", :category => :task) do
- curl = Curl::Easy.new('http://www.google.com/index.html')
- curl.perform
- assert_match /<head>/, curl.body_str
- end
- assert_equal %w[External/Curl::Multi
- External/Curl::Multi:OtherTransaction/Background/NewRelic::Agent::NetInstrumentationTest/task
- External/www.google.com/Curl::Easy External/allOther External/www.google.com/all
- External/www.google.com/Curl::Easy:OtherTransaction/Background/NewRelic::Agent::NetInstrumentationTest/task].sort,
- @engine.metrics.select{|m| m =~ /^External/}.sort
- end
-
- def test_transactional
- perform_action_with_newrelic_trace("task") do
- curl = Curl::Easy.new('http://www.google.com/index.html')
- curl.perform
- assert_match /<head>/, curl.body_str
- end
- assert_equal %w[External/Curl::Multi
- External/Curl::Multi:Controller/NewRelic::Agent::NetInstrumentationTest/task
- External/www.google.com/Curl::Easy External/allWeb External/www.google.com/all
- External/www.google.com/Curl::Easy:Controller/NewRelic::Agent::NetInstrumentationTest/task].sort,
- @engine.metrics.select{|m| m =~ /^External/}.sort
- end
- def test_ignore
- NewRelic::Agent.disable_all_tracing do
- curl = Curl::Easy.new('http://www.google.com/index.html')
- curl.http_post('data')
- end
- assert_equal 0, @engine.metrics.size
- end
-
-end if defined? ::Curl::Easy
55 test/test_picky.rb
View
@@ -1,55 +0,0 @@
-require 'picky'
-
-require "#{File.dirname(__FILE__)}/helper"
-
-class NewRelic::Agent::PickyIntrumentationTest < Test::Unit::TestCase
-
- def tokens_for *tokens
- tokens.map{|t|
- token = 'whatever'
-
- token.extend Module.new{
- define_method(:'partial?'){ t[:partial] }
- define_method(:'similar?'){ t[:similar] }
- define_method(:'qualifiers'){ t[:qualifiers] }
- }
-
- token
- }
- end
-
- def test_obfuscate_tokens
- tokens = tokens_for({})
- assert_equal 'xxx', Picky::NewRelic.obfuscate_tokens(tokens)
-
- tokens = tokens_for({:similar => true})
- assert_equal 'xxx~', Picky::NewRelic.obfuscate_tokens(tokens)
-
- tokens = tokens_for({:partial => true})
- assert_equal 'xxx*', Picky::NewRelic.obfuscate_tokens(tokens)
-
- tokens = tokens_for({:qualifiers => [:haha]})
- assert_equal 'haha:xxx', Picky::NewRelic.obfuscate_tokens(tokens)
-
- tokens = tokens_for( {:partial => true}, {:similar => true} )
- assert_equal 'xxx* xxx~', Picky::NewRelic.obfuscate_tokens(tokens)
-
- tokens = tokens_for( {:similar => true}, {:partial => true} )
- assert_equal 'xxx* xxx~', Picky::NewRelic.obfuscate_tokens(tokens)
-
- tokens = tokens_for( {:partial => true}, {:partial => true} )
- assert_equal 'xxx* xxx*', Picky::NewRelic.obfuscate_tokens(tokens)
-
- tokens = tokens_for(
- {:similar => true, :qualifiers => [:bla]},
- {:partial => true, :qualifiers => [:bla, :blub]}
- )
- assert_equal 'bla,blub:xxx* bla:xxx~', Picky::NewRelic.obfuscate_tokens(tokens)
-
- tokens = tokens_for(
- {:similar => true, :qualifiers => [:bla]},
- {:partial => true, :qualifiers => [:blub, :bla]}
- )
- assert_equal 'bla,blub:xxx* bla:xxx~', Picky::NewRelic.obfuscate_tokens(tokens)
- end
-end
Please sign in to comment.
Something went wrong with that request. Please try again.