rack-insight 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. data/.gitignore +13 -0
  2. data/.rspec +1 -0
  3. data/.simplecov +4 -0
  4. data/.travis.yml +8 -0
  5. data/CHANGELOG +58 -0
  6. data/Gemfile +3 -0
  7. data/Gemfile.lock +82 -0
  8. data/LICENSE +24 -0
  9. data/README.md +189 -0
  10. data/Rakefile +27 -0
  11. data/TODO +7 -0
  12. data/lib/rack-insight.rb +1 -0
  13. data/lib/rack/insight.rb +19 -0
  14. data/lib/rack/insight/app.rb +198 -0
  15. data/lib/rack/insight/config.rb +30 -0
  16. data/lib/rack/insight/database.rb +193 -0
  17. data/lib/rack/insight/enable-button.rb +43 -0
  18. data/lib/rack/insight/filtered_backtrace.rb +45 -0
  19. data/lib/rack/insight/instrumentation.rb +9 -0
  20. data/lib/rack/insight/instrumentation/backstage.rb +10 -0
  21. data/lib/rack/insight/instrumentation/client.rb +20 -0
  22. data/lib/rack/insight/instrumentation/instrument.rb +109 -0
  23. data/lib/rack/insight/instrumentation/package-definition.rb +58 -0
  24. data/lib/rack/insight/instrumentation/probe-definition.rb +20 -0
  25. data/lib/rack/insight/instrumentation/probe.rb +196 -0
  26. data/lib/rack/insight/instrumentation/setup.rb +32 -0
  27. data/lib/rack/insight/logger.rb +53 -0
  28. data/lib/rack/insight/options.rb +116 -0
  29. data/lib/rack/insight/panel.rb +135 -0
  30. data/lib/rack/insight/panel_app.rb +31 -0
  31. data/lib/rack/insight/panels-content.rb +22 -0
  32. data/lib/rack/insight/panels-header.rb +18 -0
  33. data/lib/rack/insight/panels/active_record_panel.rb +46 -0
  34. data/lib/rack/insight/panels/active_resource_panel.rb +48 -0
  35. data/lib/rack/insight/panels/active_resource_panel/query.rb +27 -0
  36. data/lib/rack/insight/panels/cache_panel.rb +68 -0
  37. data/lib/rack/insight/panels/cache_panel/panel_app.rb +46 -0
  38. data/lib/rack/insight/panels/cache_panel/stats.rb +90 -0
  39. data/lib/rack/insight/panels/log_panel.rb +53 -0
  40. data/lib/rack/insight/panels/memory_panel.rb +36 -0
  41. data/lib/rack/insight/panels/mongo_panel.rb +41 -0
  42. data/lib/rack/insight/panels/mongo_panel/mongo_extension.rb +24 -0
  43. data/lib/rack/insight/panels/mongo_panel/stats.rb +46 -0
  44. data/lib/rack/insight/panels/rails_info_panel.rb +19 -0
  45. data/lib/rack/insight/panels/redis_panel.rb +42 -0
  46. data/lib/rack/insight/panels/redis_panel/redis_extension.rb +23 -0
  47. data/lib/rack/insight/panels/redis_panel/stats.rb +50 -0
  48. data/lib/rack/insight/panels/request_variables_panel.rb +70 -0
  49. data/lib/rack/insight/panels/speedtracer_panel.rb +89 -0
  50. data/lib/rack/insight/panels/speedtracer_panel/profiling.rb +29 -0
  51. data/lib/rack/insight/panels/speedtracer_panel/trace-app.rb +52 -0
  52. data/lib/rack/insight/panels/speedtracer_panel/tracer.rb +213 -0
  53. data/lib/rack/insight/panels/sphinx_panel.rb +41 -0
  54. data/lib/rack/insight/panels/sphinx_panel/stats.rb +94 -0
  55. data/lib/rack/insight/panels/sql_panel.rb +53 -0
  56. data/lib/rack/insight/panels/sql_panel/panel_app.rb +37 -0
  57. data/lib/rack/insight/panels/sql_panel/query.rb +94 -0
  58. data/lib/rack/insight/panels/templates_panel.rb +58 -0
  59. data/lib/rack/insight/panels/templates_panel/rendering.rb +81 -0
  60. data/lib/rack/insight/panels/timer_panel.rb +40 -0
  61. data/lib/rack/insight/params_signature.rb +61 -0
  62. data/lib/rack/insight/path-filter.rb +23 -0
  63. data/lib/rack/insight/public/__insight__/bookmarklet.html +10 -0
  64. data/lib/rack/insight/public/__insight__/bookmarklet.js +223 -0
  65. data/lib/rack/insight/public/__insight__/insight.css +235 -0
  66. data/lib/rack/insight/public/__insight__/insight.js +127 -0
  67. data/lib/rack/insight/public/__insight__/jquery-1.3.2.js +4376 -0
  68. data/lib/rack/insight/public/__insight__/jquery.tablesorter.min.js +1 -0
  69. data/lib/rack/insight/public/__insight__/spinner.gif +0 -0
  70. data/lib/rack/insight/rack_static_bug_avoider.rb +16 -0
  71. data/lib/rack/insight/redirect_interceptor.rb +25 -0
  72. data/lib/rack/insight/render.rb +72 -0
  73. data/lib/rack/insight/request-recorder.rb +22 -0
  74. data/lib/rack/insight/rspec_matchers.rb +33 -0
  75. data/lib/rack/insight/toolbar.rb +69 -0
  76. data/lib/rack/insight/version.rb +7 -0
  77. data/lib/rack/insight/views/enable-button.html.erb +21 -0
  78. data/lib/rack/insight/views/error.html.erb +17 -0
  79. data/lib/rack/insight/views/headers_fragment.html.erb +20 -0
  80. data/lib/rack/insight/views/panels/active_record.html.erb +17 -0
  81. data/lib/rack/insight/views/panels/active_resource.html.erb +47 -0
  82. data/lib/rack/insight/views/panels/cache.html.erb +93 -0
  83. data/lib/rack/insight/views/panels/execute_sql.html.erb +32 -0
  84. data/lib/rack/insight/views/panels/explain_sql.html.erb +32 -0
  85. data/lib/rack/insight/views/panels/log.html.erb +21 -0
  86. data/lib/rack/insight/views/panels/mongo.html.erb +32 -0
  87. data/lib/rack/insight/views/panels/profile_sql.html.erb +32 -0
  88. data/lib/rack/insight/views/panels/rails_info.html.erb +19 -0
  89. data/lib/rack/insight/views/panels/redis.html.erb +46 -0
  90. data/lib/rack/insight/views/panels/request_variables.html.erb +25 -0
  91. data/lib/rack/insight/views/panels/speedtracer/serverevent.html.erb +10 -0
  92. data/lib/rack/insight/views/panels/speedtracer/servertrace.html.erb +12 -0
  93. data/lib/rack/insight/views/panels/speedtracer/traces.html.erb +18 -0
  94. data/lib/rack/insight/views/panels/sphinx.html.erb +32 -0
  95. data/lib/rack/insight/views/panels/sql.html.erb +43 -0
  96. data/lib/rack/insight/views/panels/templates.html.erb +6 -0
  97. data/lib/rack/insight/views/panels/timer.html.erb +19 -0
  98. data/lib/rack/insight/views/panels/view_cache.html.erb +19 -0
  99. data/lib/rack/insight/views/redirect.html.erb +16 -0
  100. data/lib/rack/insight/views/request_fragment.html.erb +25 -0
  101. data/lib/rack/insight/views/toolbar.html.erb +29 -0
  102. data/rack-insight.gemspec +40 -0
  103. data/spec/custom_matchers.rb +0 -0
  104. data/spec/fixtures/config.ru +8 -0
  105. data/spec/fixtures/dummy_panel.rb +2 -0
  106. data/spec/fixtures/sample_app.rb +72 -0
  107. data/spec/fixtures/star_trek_panel.rb +1 -0
  108. data/spec/insight_spec.rb +163 -0
  109. data/spec/instrumentation_spec.rb +188 -0
  110. data/spec/rack/insight/config_spec.rb +20 -0
  111. data/spec/rack/insight/panels/active_record_panel_spec.rb +43 -0
  112. data/spec/rack/insight/panels/active_resource_panel_spec.rb +40 -0
  113. data/spec/rack/insight/panels/cache_panel_spec.rb +178 -0
  114. data/spec/rack/insight/panels/log_panel_spec.rb +44 -0
  115. data/spec/rack/insight/panels/memory_panel_spec.rb +21 -0
  116. data/spec/rack/insight/panels/mongo_panel_spec_pending.rb +52 -0
  117. data/spec/rack/insight/panels/rails_info_panel_spec.rb +29 -0
  118. data/spec/rack/insight/panels/redis_panel_spec.rb +67 -0
  119. data/spec/rack/insight/panels/speedtracer_panel_spec.rb +86 -0
  120. data/spec/rack/insight/panels/sql_panel_spec.rb +146 -0
  121. data/spec/rack/insight/panels/templates_panel_spec.rb +86 -0
  122. data/spec/rack/insight/panels/timer_panel_spec.rb +38 -0
  123. data/spec/rcov.opts +1 -0
  124. data/spec/spec.opts +1 -0
  125. data/spec/spec_helper.rb +111 -0
  126. metadata +380 -0
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ *.sw?
2
+ *.gem
3
+ .bundle/
4
+ .conductor/
5
+ corundum/
6
+ doc/
7
+ rack-insight-test.log
8
+ rack-insight.sqlite
9
+ notions-and-tests/
10
+ pkg/
11
+ .sass-cache/
12
+ .yardoc/
13
+ gh-pages/
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.simplecov ADDED
@@ -0,0 +1,4 @@
1
+ SimpleCov.start do
2
+ coverage_dir "corundum/docs/coverage"
3
+ add_filter "./spec"
4
+ end
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 1.9.2
5
+ - jruby-19mode
6
+ - rbx-19mode
7
+ - ruby-head
8
+ - jruby-head
data/CHANGELOG ADDED
@@ -0,0 +1,58 @@
1
+ == 0.5.0 / 2012-08-29 - transition to rack_insight
2
+
3
+ * Compatibility
4
+
5
+ * Restructure gem so Insight is inside a namespace, because I have classes named Insight that are obscured by
6
+ logical_insight gem when loaded. Logical also seemed like it may be a class name somewhere, hence going back to
7
+ the Rack namespace a la rack-bug. Keeping the (now nested) Insight namespace as well, because - genetics.
8
+
9
+ *Other
10
+
11
+ * Fix spelling of retreive => retrieve (Peter Boling)
12
+ * Remove redundant time method from cache_panel/stats.rb
13
+
14
+ == 0.4.X - last of logical_insight
15
+
16
+ * New features
17
+
18
+ * Can use LoggerPanel on ruby stdlib Logger in non-rails app (Tim Connor)
19
+
20
+ * Bug fixes
21
+
22
+ * Fix profile, explain and select in the queries tab, fixes issue #22 (ebertech)
23
+
24
+ * Minor fixes
25
+
26
+ * Explicitly require 'digest/sha1' (Jérémy Lecour)
27
+ * Eliminate unreachable code in params signature validation (Tim Connor)
28
+
29
+ * Compatibilty
30
+
31
+ * Make Redis panel compatible with latest redis-rb gem, without breaking older redis-rb versions (Luke Melia)
32
+
33
+ * Other
34
+
35
+ * Refactoring and code cleanup (Tim Connor)
36
+ * Testing cleanup - better isolation of Rails vs. non-Rails in tests (Tim Connor)
37
+
38
+ == 0.3.0 / 2010-05-28
39
+
40
+ * New features
41
+
42
+ * Log panel includes log level and timestamp (Tim Connor)
43
+ * Sphinx panel (George Chatzigeorgiou)
44
+ * Backtraces for Redis panel (Luke Melia & Joey Aghion)
45
+
46
+ * Minor fixes
47
+
48
+ * Don't "enable" rack bug if you hit cancel on the bookmarklet prompt (Mischa Fierer)
49
+
50
+ * Compatibilty
51
+
52
+ * backtrace filtering now supports more than just Rails (Alex Chaffee)
53
+ * compatibility with current rack-test (Luke Melia & Joey Aghion)
54
+ * update Sinatra sample app (Tim Conner)
55
+
56
+ == 0.2.1
57
+
58
+ * The beginning of recorded history
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,82 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rack-insight (0.5.0)
5
+ rack
6
+ sqlite3 (>= 1.3.3)
7
+ uuidtools (>= 2.1.2)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ archive-tar-minitar (0.5.2)
13
+ columnize (0.3.6)
14
+ diff-lcs (1.1.3)
15
+ linecache19 (0.5.12)
16
+ ruby_core_source (>= 0.1.4)
17
+ nokogiri (1.5.4)
18
+ rack (1.3.5)
19
+ rack-protection (1.1.4)
20
+ rack
21
+ rack-test (0.6.1)
22
+ rack (>= 1.0)
23
+ rake (0.9.2.2)
24
+ redcarpet (2.1.1)
25
+ reek (1.2.12)
26
+ ripper_ruby_parser (~> 0.0.7)
27
+ ruby2ruby (~> 1.2.5)
28
+ ruby_parser (~> 2.0)
29
+ sexp_processor (~> 3.0)
30
+ ripper_ruby_parser (0.0.8)
31
+ sexp_processor (~> 3.0)
32
+ roodi (2.1.0)
33
+ ruby_parser
34
+ rspec (2.11.0)
35
+ rspec-core (~> 2.11.0)
36
+ rspec-expectations (~> 2.11.0)
37
+ rspec-mocks (~> 2.11.0)
38
+ rspec-core (2.11.1)
39
+ rspec-expectations (2.11.2)
40
+ diff-lcs (~> 1.1.3)
41
+ rspec-mocks (2.11.2)
42
+ ruby-debug-base19 (0.11.25)
43
+ columnize (>= 0.3.1)
44
+ linecache19 (>= 0.5.11)
45
+ ruby_core_source (>= 0.1.4)
46
+ ruby-debug19 (0.11.6)
47
+ columnize (>= 0.3.1)
48
+ linecache19 (>= 0.5.11)
49
+ ruby-debug-base19 (>= 0.11.19)
50
+ ruby2ruby (1.2.5)
51
+ ruby_parser (~> 2.0)
52
+ sexp_processor (~> 3.0)
53
+ ruby_core_source (0.1.5)
54
+ archive-tar-minitar (>= 0.5.2)
55
+ ruby_parser (2.3.1)
56
+ sexp_processor (~> 3.0)
57
+ sexp_processor (3.2.0)
58
+ sinatra (1.3.1)
59
+ rack (~> 1.3, >= 1.3.4)
60
+ rack-protection (~> 1.1, >= 1.1.2)
61
+ tilt (~> 1.3, >= 1.3.3)
62
+ sqlite3 (1.3.6)
63
+ tilt (1.3.3)
64
+ uuidtools (2.1.3)
65
+ webrat (0.7.3)
66
+ nokogiri (>= 1.2.0)
67
+ rack (>= 1.0)
68
+ rack-test (>= 0.5.3)
69
+
70
+ PLATFORMS
71
+ ruby
72
+
73
+ DEPENDENCIES
74
+ rack-insight!
75
+ rake
76
+ redcarpet
77
+ reek (>= 1.2.8)
78
+ roodi (>= 2.1.0)
79
+ rspec (>= 2.11.0)
80
+ ruby-debug19
81
+ sinatra
82
+ webrat
data/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ Copyright (c) 2012 Peter H. Boling as rack-insight
2
+ Copyright (c) 2011-12 LR Design as logical-insight
3
+ Copyright (c) 2009 Bryan Helmkamp as rack-bug
4
+
5
+ MIT License
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining
8
+ a copy of this software and associated documentation files (the
9
+ "Software"), to deal in the Software without restriction, including
10
+ without limitation the rights to use, copy, modify, merge, publish,
11
+ distribute, sublicense, and/or sell copies of the Software, and to
12
+ permit persons to whom the Software is furnished to do so, subject to
13
+ the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be
16
+ included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,189 @@
1
+ Rack::Insight
2
+ =========
3
+
4
+ Rack::Insight began life as an fork of Logical::Insight by LRDesign. I started a
5
+ fork because LogicalInsight was namespaced as "Insight", which is causing namespace
6
+ collisions everywhere I have an Insight model. I had to re-namespace all the code.
7
+ I also needed to build a few extension gems with additional panels, and added the
8
+ Config class to allow for custom panel load paths, and other future extensions
9
+ that don't work in the *use Middleware* declaration. It should be *even* easier
10
+ to extend than LogicalInsight was, because extension gems can access the Config class
11
+ and truly bolt-on cleanly.
12
+
13
+ Having made really significant architectural changes, I'll be keeping Rack::Insight
14
+ a separate project for the forseeable future.
15
+
16
+ * Forked From: [logical-insight](http://github.com/LRDesign/logical-insight), [documentation](http://lrdesign.github.com/rack-insight/)
17
+ * Which Was Forked From: [rack-bug](http://github.com/brynary/rack-bug)
18
+
19
+ Description
20
+ -----------
21
+
22
+ Rack::Insight adds a diagnostics toolbar to Rack apps. When enabled, it injects a floating div
23
+ allowing exploration of logging, database queries, template rendering times, etc. Rack::Insight
24
+ stores debugging info over many requests, incuding AJAX requests.
25
+
26
+ Features
27
+ --------
28
+
29
+ * Password-based security
30
+ * IP-based security
31
+ * Rack::Insight instrumentation/reporting is broken up into panels.
32
+ * Panels in default configuration:
33
+ * Rails Info
34
+ * Timer
35
+ * Request Variables
36
+ * SQL
37
+ * Active Record
38
+ * Cache
39
+ * Templates
40
+ * Log
41
+ * Memory
42
+ * Other bundled panels:
43
+ * Redis
44
+ * Speedtracer
45
+ * Retired panels - if needed they could come back quickly:
46
+ * Sphinx
47
+ * Mongo
48
+ * The API for adding your own panels is simple and very powerful
49
+ * Consistent interface to instrument application code
50
+ * Consistent timing across panels
51
+ * Easy to add sub-applications for more detailed reports (c.f. SQLPanel)
52
+ * The documentation is scarce, so there's a feeling of adventure :/
53
+
54
+ Rails quick start
55
+ ---------------------------
56
+
57
+ Add this to your Gemfile
58
+ gem "rack-insight"
59
+
60
+ In config/environments/development.rb, add:
61
+
62
+ config.middleware.use "Rack::Insight::App",
63
+ :secret_key => "someverylongandveryhardtoguesspreferablyrandomstring"
64
+
65
+ Any environment with Rack::Insight loaded will have a link to "Rack::Insight" added to as
66
+ the last child of BODY to normal responses. Clicking that link will load the
67
+ toolbar. It's set with an id of "rack-insight-enabler", so it can be styled
68
+ to go somewhere more noticeable. E.g. "position: absolute; top: 0; left: 0"
69
+
70
+ Using with non-Rails Rack apps
71
+ ------------------------------
72
+
73
+ Just 'use Rack::Insight' as any other middleware. See the SampleApp in the
74
+ spec/fixtures folder for an example Sinatra app.
75
+
76
+ If you wish to use the logger panel define the LOGGER constant that is a ruby
77
+ Logger or ActiveSupport::BufferedLogger
78
+
79
+ Configuring custom panels
80
+ -------------------------
81
+
82
+ Specify the set of panels you want, in the order you want them to appear:
83
+
84
+ require "rack-insight"
85
+
86
+ ActionController::Dispatcher.middleware.use "Rack::Insight::App",
87
+ :secret_key => "someverylongandveryhardtoguesspreferablyrandomstring",
88
+ :panel_files => %w[
89
+ timer_panel
90
+ request_variables_panel
91
+ redis_panel
92
+ templates_panel
93
+ log_panel
94
+ memory_panel
95
+ ]
96
+
97
+ By default panel files are looked up by prepending "rack/insight/panels/" and requiring them.
98
+ Subclasses of Rack::Insight::Panel are loaded and added to the toolbar. This makes
99
+ it easier to work with the configuration and extend Rack::Insight with plugin gems.
100
+
101
+ If you need to customize the load paths where Rack::Insight will look for panels you can configure the load paths in an
102
+ initializer. Example config/initializers/rack_insight.rb:
103
+
104
+ Rack::Insight::Config.configure do |config|
105
+
106
+ # Note: The parent directory of the 'special' directory must already be in Ruby's load path.
107
+ config[:panel_load_paths] = File.join('special','path')
108
+
109
+ # Example 1: Do not load any of the regular Rack::Insight panels:
110
+ config[:panel_load_paths] = File.join('my','custom','panel','directory')
111
+
112
+ # Example 2: Add your custom path to the existing load paths, to have your panels join the party!
113
+ config[:panel_load_paths] << 'custom/panels'
114
+
115
+ end
116
+
117
+ Running Rack::Insight in staging or production
118
+ ------------------------------------------
119
+
120
+ We have have found that Rack::Insight is fast enough to run in production for specific troubleshooting efforts.
121
+
122
+ ### Configuration ####
123
+
124
+ Add the middleware configuration to an initializer or the appropriate
125
+ environment files, taking the rest of this section into consideration.
126
+
127
+ ### Security ####
128
+
129
+ Restrict access to particular IP addresses:
130
+
131
+ require "ipaddr"
132
+
133
+ ActionController::Dispatcher.middleware.use "Rack::Insight::App"
134
+ :secret_key => "someverylongandveryhardtoguesspreferablyrandomstring",
135
+ :ip_masks => [IPAddr.new("2.2.2.2/0")]
136
+
137
+ Restrict access using a password:
138
+
139
+ ActionController::Dispatcher.middleware.use "Rack::Insight::App",
140
+ :secret_key => "someverylongandveryhardtoguesspreferablyrandomstring",
141
+ :password => "yourpassword"
142
+
143
+ #### custom file path for the logging database ####
144
+
145
+ Logical Rack::Insight uses SQLite to store data from requests, and outputs a database
146
+ file in the root directory. If you need the file to be created at another
147
+ location (i.e. Heroku), you can pass a custom file path.
148
+
149
+ ActionController::Dispatcher.middleware.use "Rack::Insight::App"
150
+ :secret_key => "someverylongandveryhardtoguesspreferablyrandomstring",
151
+ :database_path => "tmp/my_insight_db.sqlite"
152
+
153
+ Authors
154
+ -------
155
+
156
+ - Maintained by [Judson Lester](mailto:judson@lrdesign.com)
157
+ - Contributions from Luke Melia, Joey Aghion, Tim Connor, and more
158
+ - Based on Rack::Bug by Bryan Helmkamp
159
+
160
+ Thanks
161
+ ------
162
+ Rack::Insight owes a lot to both LogicalInsight and Rack::Bug, as the basis projects. There's a lot of smart
163
+ in there. Many thanks to Evan, Judson, and Bryan for building them.
164
+
165
+ Inspiration for Rack::Bug is primarily from the Django debug toolbar.
166
+ Additional ideas from Rails footnotes, Rack's ShowException middleware, Oink,
167
+ and Rack::Cache
168
+
169
+ License
170
+ -------
171
+
172
+ See LICENSE.txt in this directory.
173
+
174
+ Notes
175
+ -----
176
+
177
+ Legacy files: would like to re-include them, but they need work
178
+
179
+ lib/insight/views/panels/mongo.html.erb
180
+ lib/insight/panels/mongo_panel/mongo_extension.rb
181
+ lib/insight/panels/mongo_panel/stats.rb
182
+ lib/insight/panels/mongo_panel.rb
183
+
184
+ lib/insight/views/panels/sphinx.html.erb
185
+ lib/insight/panels/sphinx_panel/stats.rb
186
+ lib/insight/panels/sphinx_panel.rb
187
+
188
+ This one is mostly just a curiosity
189
+ lib/insight/panels/speedtracer_panel/profiling.rb
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+
4
+ require 'rake'
5
+
6
+ require 'rspec/core'
7
+ require 'rspec/core/rake_task'
8
+ RSpec::Core::RakeTask.new(:spec) do |spec|
9
+ spec.pattern = FileList['spec/**/*_spec.rb']
10
+ end
11
+
12
+ require 'reek/rake/task'
13
+ Reek::Rake::Task.new do |t|
14
+ t.fail_on_error = true
15
+ t.verbose = false
16
+ t.source_files = 'lib/**/*.rb'
17
+ end
18
+
19
+ require 'roodi'
20
+ require 'roodi_task'
21
+ RoodiTask.new do |t|
22
+ t.verbose = false
23
+ end
24
+
25
+ task :default => :spec
26
+
27
+ Bundler::GemHelper.install_tasks
data/TODO ADDED
@@ -0,0 +1,7 @@
1
+ Speedtracer Resymbolization: seems like it would be possible to get Speedtracer to pull up the Ruby code that was slow... ????
2
+
3
+ Speedtracer call tagging: right now we just say "everything is either HTTP or METHOD" - maybe more accurate tagging would be useful.
4
+
5
+ Config: panels in required files automatically turned on - explicit exclude?
6
+
7
+ Config: Explore other parts that may benefit from a config option.
@@ -0,0 +1 @@
1
+ require 'rack/insight'
@@ -0,0 +1,19 @@
1
+ require 'rack/insight/app'
2
+
3
+ module Rack
4
+ module Insight
5
+ class << self
6
+ def enable
7
+ Thread.current["rack-insight.enabled"] = true
8
+ end
9
+
10
+ def disable
11
+ Thread.current["rack-insight.enabled"] = false
12
+ end
13
+
14
+ def enabled?
15
+ Thread.current["rack-insight.enabled"] == true
16
+ end
17
+ end
18
+ end
19
+ end