Skip to content
Browse files

Update README with Oink::Middleware configuration options and changes…

… to log output
  • Loading branch information...
1 parent 8b3effe commit cc37a73970ced74bcbfe48d0c54b9a7a1c7ec714 Eirik Dentz Sinclair & Noah Davis committed
Showing with 17 additions and 8 deletions.
  1. +17 −8 README.rdoc
View
25 README.rdoc
@@ -32,23 +32,29 @@ Add oink to your Gemfile
gem "oink"
-In most rails environments this is sufficient and oink will be required for you via bundler. If not, add a require statement "require 'oink'" in your app.
+In most rails environments this is sufficient and oink will be required for you via bundler.
+If not, add a require statement "require 'oink'" in your app.
=== Configuration
Oink is middleware for instrumentation during the runtime of your application as well as log parsers for offline crunching of the logs generated by
the middleware.
-The middleware class to include into your stack is "Oink::Middleware". In rails this can be included by adding the following to your
-application.rb or environment.rb file:
+The middleware class to include into your stack is "Oink::Middleware". For rails using an initializer is recommended:
-config.middleware.use "Oink::Middleware"
+ YourApplication::Application.middleware.use Oink::Middleware
-or in an initializer, you can also include it:
+Oink::Middleware writes log entries to log/oink.log in your application root directory by default.
+You can also initialize it with an optional logger instance enabling you write Oink log entries to your application's default log file.
-YouApplication::Application.middleware.use Oink::Middleware
+ YourApplication::Application.middleware.use( Oink::Middleware, :logger => Rails.logger )
-Note that the previous way of configuring oink, as a set of modules to include into rails controllers, is deprecated and is set to be removed shortly.
+Oink::Middleware logs memory and activerecord usage by default.
+You can configure which using the :instruments option:
+
+ YourApplication::Application.middleware.use( Oink::Middleware, :instruments => [:memory] )
+
+Note that the previous way of configuring oink, as a set of modules to include into rails controllers, is deprecated.
== Analyzing logs
@@ -106,12 +112,15 @@ e.g. In verbose mode, oink will print out all the log information from your logs
$ oink --format verbose --threshold=75 /tmp/logs/*
---------------------------------------------------------------------
+
Feb 08 11:39:52 ey33-s00302 rails[9076]: Processing UsersController#show (for 11.187.34.45 at 2009-02-08 11:39:52) [GET]
Feb 08 11:39:52 ey33-s00302 rails[9076]: Parameters: {"action"=>"show", "id"=>"45", "controller"=>"users"}
Feb 08 11:39:52 ey33-s00302 rails[9076]: Rendering template within layouts/application
Feb 08 11:39:52 ey33-s00302 rails[9076]: Rendering users/show
- Feb 08 11:39:54 ey33-s00302 rails[9076]: Memory usage: 316516 | PID: 9076
Feb 08 11:39:54 ey33-s00302 rails[9076]: Completed in 2008ms (View: 1136, DB: 264) | 200 OK [http://www.example.com/users/45]
+ Feb 08 11:39:52 ey33-s00302 rails[9076]: Oink Action: users#show
+ Feb 08 11:39:54 ey33-s00302 rails[9076]: Memory usage: 316516 | PID: 9076
+ Feb 08 11:39:54 ey33-s00302 rails[9076]: Oink Log Entry Complete
---------------------------------------------------------------------
Verbose format prints the summary as well as each action which exceeded the threshold.

0 comments on commit cc37a73

Please sign in to comment.
Something went wrong with that request. Please try again.