Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bump version

  • Loading branch information...
commit 7ce59fb5892a5cff0623bca2fdab2542a656cc9b 1 parent 7de418d
twinturbo authored
View
2  README.md
@@ -2,8 +2,6 @@
Use this middleware to see how long your app is spending in middleware.
-It does not track per middleware.
-
## Installation
Add this line to your application's Gemfile:
View
23 lib/newrelic-middleware/railtie.rb
@@ -1,7 +1,30 @@
+require 'newrelic_rpm'
+require 'new_relic/agent/method_tracer'
+
module NewRelicMiddleware
class Engine < ::Rails::Engine
initializer "newrelic.middleware-tracking" do |app|
app.config.middleware.insert 0, TrackingSupport
end
+
+ config.after_initialize do |app|
+ app.config.middleware.each do |m|
+ klass = m.klass
+
+ if klass.respond_to? :call
+ klass.class_eval do
+ extend NewRelic::Agent::MethodTracer
+
+ add_method_tracer :call, "Middleware/#{klass}"
+ end
+ else
+ klass.class_eval do
+ include NewRelic::Agent::MethodTracer
+
+ add_method_tracer :call, "Middleware/#{klass}"
+ end
+ end
+ end
+ end
end
end
View
2  lib/newrelic-middleware/version.rb
@@ -1,3 +1,3 @@
module NewRelicMiddleware
- VERSION = "1.0.0"
+ VERSION = "1.1.0"
end
View
2  newrelic-middleware.gemspec
@@ -15,6 +15,8 @@ Gem::Specification.new do |gem|
gem.require_paths = ["lib"]
gem.version = NewRelicMiddleware::VERSION
+ gem.add_dependency "newrelic_rpm"
+
gem.add_development_dependency "rails"
gem.add_development_dependency "rack-test"
end
View
3  test/test_helper.rb
@@ -1,6 +1,3 @@
-require 'simplecov'
-SimpleCov.start
-
require 'newrelic-middleware'
require 'minitest/unit'
Please sign in to comment.
Something went wrong with that request. Please try again.