Skip to content

Commit

Permalink
Initial Release of Rack::Insight
Browse files Browse the repository at this point in the history
  • Loading branch information
pboling committed Aug 30, 2012
1 parent 3f30862 commit 9238d48
Show file tree
Hide file tree
Showing 123 changed files with 851 additions and 960 deletions.
17 changes: 15 additions & 2 deletions History.txt → CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
== HEAD
== 0.5.0 / 2012-08-29 - transition to rack_insight

* Compatibility

* Restructure gem so Insight is inside a namespace, because I have classes named Insight that are obscured by
logical_insight gem when loaded. Logical also seemed like it may be a class name somewhere, hence going back to
the Rack namespace a la rack-bug. Keeping the (now nested) Insight namespace as well, because - genetics.

*Other

* Fix spelling of retreive => retrieve (Peter Boling)
* Remove redundant time method from cache_panel/stats.rb

== 0.4.X - last of logical_insight

* New features

Expand All @@ -21,7 +34,7 @@

* Refactoring and code cleanup (Tim Connor)
* Testing cleanup - better isolation of Rails vs. non-Rails in tests (Tim Connor)

== 0.3.0 / 2010-05-28

* New features
Expand Down
71 changes: 24 additions & 47 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,58 +1,36 @@
PATH
remote: .
specs:
logical-insight (0.4.7)
sqlite3 (~> 1.3.3)
uuid (~> 2.3.1)
rack-insight (0.5.0)
rack
sqlite3 (>= 1.3.3)
uuidtools (>= 2.1.2)

GEM
remote: http://gemcutter.org/
specs:
archive-tar-minitar (0.5.2)
chunky_png (1.2.5)
columnize (0.3.4)
compass (0.12.1)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
sass (~> 3.1)
corundum (0.0.17)
bundler (~> 1.1.0)
compass (>= 0.12.1)
mailfactory (~> 1.4.0)
mattock (>= 0.2.11)
nokogiri
rake-rubygems (>= 0.2.0)
rdoc
rspec (>= 2.0)
sass (>= 3.1)
simplecov (>= 0.5.4)
yard
diff-lcs (1.1.3)
fssm (0.2.9)
json (1.7.3)
linecache19 (0.5.12)
ruby_core_source (>= 0.1.4)
macaddr (1.6.0)
systemu (~> 2.2.0)
mailfactory (1.4.0)
mime-types (>= 1.13.1)
mattock (0.2.12)
tilt (> 0)
valise (>= 0.6)
mime-types (1.18)
multi_json (1.3.5)
nokogiri (1.5.2)
rack (1.3.5)
rack-protection (1.1.4)
rack
rack-test (0.6.1)
rack (>= 1.0)
rake (0.9.2.2)
rake-rubygems (0.2.0)
rake (>= 0.8.7)
rdoc (3.12)
json (~> 1.4)
redcarpet (2.1.1)
reek (1.2.12)
ripper_ruby_parser (~> 0.0.7)
ruby2ruby (~> 1.2.5)
ruby_parser (~> 2.0)
sexp_processor (~> 3.0)
ripper_ruby_parser (0.0.8)
sexp_processor (~> 3.0)
roodi (2.1.0)
ruby_parser
rspec (2.10.0)
rspec-core (~> 2.10.0)
rspec-expectations (~> 2.10.0)
Expand All @@ -69,36 +47,35 @@ GEM
columnize (>= 0.3.1)
linecache19 (>= 0.5.11)
ruby-debug-base19 (>= 0.11.19)
ruby2ruby (1.2.5)
ruby_parser (~> 2.0)
sexp_processor (~> 3.0)
ruby_core_source (0.1.5)
archive-tar-minitar (>= 0.5.2)
sass (3.1.18)
simplecov (0.6.4)
multi_json (~> 1.0)
simplecov-html (~> 0.5.3)
simplecov-html (0.5.3)
ruby_parser (2.3.1)
sexp_processor (~> 3.0)
sexp_processor (3.2.0)
sinatra (1.3.1)
rack (~> 1.3, >= 1.3.4)
rack-protection (~> 1.1, >= 1.1.2)
tilt (~> 1.3, >= 1.3.3)
sqlite3 (1.3.6)
systemu (2.2.0)
tilt (1.3.3)
uuid (2.3.5)
macaddr (~> 1.0)
valise (0.6)
uuidtools (2.1.3)
webrat (0.7.3)
nokogiri (>= 1.2.0)
rack (>= 1.0)
rack-test (>= 0.5.3)
yard (0.8.1)

PLATFORMS
ruby

DEPENDENCIES
corundum (~> 0.0.13)
logical-insight!
rack-insight!
rake
redcarpet
reek (>= 1.2.8)
roodi (>= 2.1.0)
rspec
ruby-debug19
sinatra
Expand Down
24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Copyright (c) 2012 Peter H. Boling as rack-insight
Copyright (c) 2011-12 LR Design as logical-insight
Copyright (c) 2009 Bryan Helmkamp as rack-bug

MIT License

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.
19 changes: 0 additions & 19 deletions MIT-LICENSE.txt

This file was deleted.

101 changes: 67 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
Insight
Rack::Insight
=========

Insight began life as an LRDesign fork of Rack::Bug by brynary. We started a
fork because, at the time, the main project wasn't making progress on Rails 3
support. Since then we've rewritten a lot of the code to make it more modular,
easier to extend, and to store information about multiple requests so you can
use it to inspect your AJAX requests (or any past request), not just previous
page loads.
Rack::Insight began life as an fork of Logical::Insight by LRDesign. I started a
fork because LogicalInsight was namespaced as "Insight", which is causing namespace
collisions everywhere I have an Insight model. I had to re-namespace all the code.
I also needed to build a few extension gems with additional panels, and added the
Config class to allow for custom panel load paths, and other future extensions
that don't work in the *use Middleware* declaration. It should be *even* easier
to extend than LogicalInsight was, because extension gems can access the Config class
and truly bolt-on cleanly.

Having made really significant architectural changes, we'll be keeping Insight
Having made really significant architectural changes, I'll be keeping Rack::Insight
a separate project for the forseeable future.

* Forked From: [rack-bug](http://github.com/brynary/rack-bug)

* [Full documentation](http://lrdesign.github.com/logical-insight/)
* Forked From: [logical-insight](http://github.com/LRDesign/logical-insight), [documentation](http://lrdesign.github.com/rack-insight/)
* Which Was Forked From: [rack-bug](http://github.com/brynary/rack-bug)

Description
-----------

Insight adds a diagnostics toolbar to Rack apps. When enabled, it injects a floating div
allowing exploration of logging, database queries, template rendering times, etc. Insight
Rack::Insight adds a diagnostics toolbar to Rack apps. When enabled, it injects a floating div
allowing exploration of logging, database queries, template rendering times, etc. Rack::Insight
stores debugging info over many requests, incuding AJAX requests.

Features
--------

* Password-based security
* IP-based security
* Insight instrumentation/reporting is broken up into panels.
* Rack::Insight instrumentation/reporting is broken up into panels.
* Panels in default configuration:
* Rails Info
* Timer
Expand All @@ -54,22 +55,22 @@ Rails quick start
---------------------------

Add this to your Gemfile
gem "logical-insight"
gem "rack-insight"

In config/environments/development.rb, add:

config.middleware.use "Insight::App",
config.middleware.use "Rack::Insight::App",
:secret_key => "someverylongandveryhardtoguesspreferablyrandomstring"

Any environment with Insight loaded will have a link to "Insight" added to as
Any environment with Rack::Insight loaded will have a link to "Rack::Insight" added to as
the last child of BODY to normal responses. Clicking that link will load the
toolbar. It's set with an id of "logical-insight-enabler", so it can be styled
toolbar. It's set with an id of "rack-insight-enabler", so it can be styled
to go somewhere more noticeable. E.g. "position: absolute; top: 0; left: 0"

Using with non-Rails Rack apps
------------------------------

Just 'use Insight' as any other middleware. See the SampleApp in the
Just 'use Rack::Insight' as any other middleware. See the SampleApp in the
spec/fixtures folder for an example Sinatra app.

If you wish to use the logger panel define the LOGGER constant that is a ruby
Expand All @@ -80,9 +81,9 @@ Configuring custom panels

Specify the set of panels you want, in the order you want them to appear:

require "logical-insight"
require "rack-insight"

ActionController::Dispatcher.middleware.use "Insight::App",
ActionController::Dispatcher.middleware.use "Rack::Insight::App",
:secret_key => "someverylongandveryhardtoguesspreferablyrandomstring",
:panel_files => %w[
timer_panel
Expand All @@ -93,14 +94,30 @@ Specify the set of panels you want, in the order you want them to appear:
memory_panel
]

Files are looked up by prepending "insight/panels/" and requiring them.
Subclasses of Insight::Panel are loaded and added to the toolbar. This makes
it easier to work with the configuration and extend Insight with plugin gems.
By default panel files are looked up by prepending "rack/insight/panels/" and requiring them.
Subclasses of Rack::Insight::Panel are loaded and added to the toolbar. This makes
it easier to work with the configuration and extend Rack::Insight with plugin gems.

If you need to customize the load paths where Rack::Insight will look for panels you can configure the load paths in an
initializer. Example config/initializers/rack_insight.rb:

Rack::Insight::Config.configure do |config|

# Note: The parent directory of the 'special' directory must already be in Ruby's load path.
config[:panel_load_paths] = File.join('special','path')

# Example 1: Do not load any of the regular Rack::Insight panels:
config[:panel_load_paths] = File.join('my','custom','panel','directory')

# Example 2: Add your custom path to the existing load paths, to have your panels join the party!
config[:panel_load_paths] << 'custom/panels'

end

Running Insight in staging or production
Running Rack::Insight in staging or production
------------------------------------------

We have have found that Insight is fast enough to run in production for specific troubleshooting efforts.
We have have found that Rack::Insight is fast enough to run in production for specific troubleshooting efforts.

### Configuration ####

Expand All @@ -113,23 +130,23 @@ Restrict access to particular IP addresses:

require "ipaddr"

ActionController::Dispatcher.middleware.use "Insight::App"
ActionController::Dispatcher.middleware.use "Rack::Insight::App"
:secret_key => "someverylongandveryhardtoguesspreferablyrandomstring",
:ip_masks => [IPAddr.new("2.2.2.2/0")]

Restrict access using a password:

ActionController::Dispatcher.middleware.use "Insight::App",
ActionController::Dispatcher.middleware.use "Rack::Insight::App",
:secret_key => "someverylongandveryhardtoguesspreferablyrandomstring",
:password => "yourpassword"

#### custom file path for the logging database ####

Logical Insight uses SQLite to store data from requests, and outputs a database
Logical Rack::Insight uses SQLite to store data from requests, and outputs a database
file in the root directory. If you need the file to be created at another
location (i.e. Heroku), you can pass a custom file path.

ActionController::Dispatcher.middleware.use "Insight::App"
ActionController::Dispatcher.middleware.use "Rack::Insight::App"
:secret_key => "someverylongandveryhardtoguesspreferablyrandomstring",
:database_path => "tmp/my_insight_db.sqlite"

Expand All @@ -142,15 +159,31 @@ Authors

Thanks
------
Insight owes a lot to Rack::Bug, as the basis project. There's a lot of smart
in there. Many thanks to Bryan for building it.
Rack::Insight owes a lot to both LogicalInsight and Rack::Bug, as the basis projects. There's a lot of smart
in there. Many thanks to Evan, Judson, and Bryan for building them.

Inspiration for Rack::Bug is primarily from the Django debug toolbar.
Additional ideas from Rails footnotes, Rack's ShowException middleware, Oink,
and Rack::Cache


License
-------

See MIT-LICENSE.txt in this directory.
See LICENSE.txt in this directory.

Notes
-----

Legacy files: would like to re-include them, but they need work

lib/insight/views/panels/mongo.html.erb
lib/insight/panels/mongo_panel/mongo_extension.rb
lib/insight/panels/mongo_panel/stats.rb
lib/insight/panels/mongo_panel.rb

lib/insight/views/panels/sphinx.html.erb
lib/insight/panels/sphinx_panel/stats.rb
lib/insight/panels/sphinx_panel.rb

This one is mostly just a curiosity
lib/insight/panels/speedtracer_panel/profiling.rb
Loading

0 comments on commit 9238d48

Please sign in to comment.