rack-insight 0.5.26 → 0.5.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +6 -5
- data/CHANGELOG +26 -4
- data/Gemfile.lock +25 -33
- data/README.md +8 -9
- data/lib/rack/insight/config.rb +27 -2
- data/lib/rack/insight/database.rb +20 -7
- data/lib/rack/insight/instrumentation.rb +1 -0
- data/lib/rack/insight/instrumentation/eigen_client.rb +16 -0
- data/lib/rack/insight/logging.rb +11 -13
- data/lib/rack/insight/panel.rb +14 -7
- data/lib/rack/insight/panels/log_panel.rb +2 -1
- data/lib/rack/insight/panels/redis_panel.rb +0 -20
- data/lib/rack/insight/panels/redis_panel/stats.rb +1 -0
- data/lib/rack/insight/panels/speedtracer_panel.rb +3 -0
- data/lib/rack/insight/params_signature.rb +8 -6
- data/lib/rack/insight/rspec_matchers.rb +16 -0
- data/lib/rack/insight/toolbar.rb +1 -0
- data/lib/rack/insight/version.rb +1 -1
- data/rack-insight.gemspec +13 -10
- data/spec/insight_spec.rb +21 -18
- data/spec/instrumentation_spec.rb +45 -2
- data/spec/rack/insight/panels/active_record_panel_spec.rb +7 -7
- data/spec/rack/insight/panels/active_resource_panel_spec.rb +4 -4
- data/spec/rack/insight/panels/cache_panel_spec.rb +6 -6
- data/spec/rack/insight/panels/log_panel_spec.rb +9 -11
- data/spec/rack/insight/panels/memory_panel_spec.rb +1 -1
- data/spec/rack/insight/panels/rails_info_panel_spec.rb +5 -5
- data/spec/rack/insight/panels/redis_panel_spec.rb +17 -3
- data/spec/rack/insight/panels/speedtracer_panel_spec.rb +87 -86
- data/spec/rack/insight/panels/sql_panel_spec.rb +11 -8
- data/spec/rack/insight/panels/templates_panel_spec.rb +8 -7
- data/spec/rack/insight/panels/timer_panel_spec.rb +4 -4
- data/spec/spec_helper.rb +6 -4
- metadata +47 -100
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9014b272efd1a4dacfded3cd104d90138f3e862c
|
4
|
+
data.tar.gz: 737f8d87ce64751c2d453cef210c2ba104cf022a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0e824b8ff9e415506009c9445d938dda476b3b9c6effb38f7c9b74d6e11936f92df929017b51bcd4ecb0a05c8c5999a0c42dc29d8c9fa78f42807d8c4b6a60a3
|
7
|
+
data.tar.gz: f92a70fa12747312cc057ddcbb40ae29123d541fb9f5a2fc5d33d9046456c1086e9932e07d8d6b2f3981da79c17341a67157e3739cab7ca29493f9178a6a1461
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
foss
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-1.9.3-p448
|
data/.travis.yml
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
+
- 2.0.0
|
3
4
|
- 1.9.3
|
4
5
|
- 1.9.2
|
5
|
-
- jruby-19mode
|
6
|
-
- rbx-19mode
|
7
|
-
- ruby-head
|
8
|
-
- jruby-head
|
9
|
-
bundler_args: "--binstubs --without documentation"
|
6
|
+
# - jruby-19mode # Fails to install sqlite3
|
7
|
+
# - rbx-19mode
|
8
|
+
# - ruby-head # Fails to download rubygems.org/latest_specs.4.8.gz
|
9
|
+
# - jruby-head # Fails to install sqlite3
|
10
|
+
bundler_args: "--binstubs --without documentation"
|
data/CHANGELOG
CHANGED
@@ -1,14 +1,36 @@
|
|
1
|
+
== 0.5.27 / 2013-09-03
|
2
|
+
|
3
|
+
* Other
|
4
|
+
|
5
|
+
* Improved configuration of logging and verbosity by Peter Boling
|
6
|
+
|
7
|
+
* Moved VERBOSITY from Logging module into Config class
|
8
|
+
|
9
|
+
* gemspec email should reflect who the current contacts are for the gem by Peter Boling
|
10
|
+
|
11
|
+
* Removed unused development dependencies by Peter Boling
|
12
|
+
|
13
|
+
* All specs passing! by Peter Boling
|
14
|
+
|
15
|
+
* Fixing deprecations by Peter Boling
|
16
|
+
|
17
|
+
* Require the standard Ruby Logger by Peter Boling
|
18
|
+
|
19
|
+
* Convert to .ruby-version by Peter Boling
|
20
|
+
|
21
|
+
* Add license and platform to gemspec by Peter Boling
|
22
|
+
|
1
23
|
== 0.5.26 / 2013-08-06
|
2
24
|
|
3
25
|
* Bug Fixes
|
4
26
|
|
5
|
-
* Dont reload page, just close panel by Harry Walter
|
6
|
-
* Allow panels to scroll when fixed to bottom by Harry Walter
|
7
|
-
* Set position to fixed to keep toolbar at bottom by Harry Walter
|
27
|
+
* Dont reload page, just close panel by Harry Walter
|
28
|
+
* Allow panels to scroll when fixed to bottom by Harry Walter
|
29
|
+
* Set position to fixed to keep toolbar at bottom by Harry Walter
|
8
30
|
|
9
31
|
* Other
|
10
32
|
|
11
|
-
* Update README.md by Agis Anastasopoulos
|
33
|
+
* Update README.md by Agis Anastasopoulos
|
12
34
|
|
13
35
|
== 0.5.25 / 2013-03-15
|
14
36
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rack-insight (0.5.
|
4
|
+
rack-insight (0.5.26)
|
5
5
|
rack
|
6
6
|
sqlite3 (>= 1.3.3)
|
7
7
|
uuidtools (>= 2.1.2)
|
@@ -9,23 +9,17 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
debugger-linecache (1.2.0)
|
18
|
-
debugger-ruby_core_source (1.2.0)
|
19
|
-
diff-lcs (1.2.1)
|
20
|
-
gem-release (0.5.2)
|
21
|
-
nokogiri (1.5.6)
|
12
|
+
diff-lcs (1.2.4)
|
13
|
+
gem-release (0.6.0)
|
14
|
+
mini_portile (0.5.1)
|
15
|
+
nokogiri (1.6.0)
|
16
|
+
mini_portile (~> 0.5.0)
|
22
17
|
rack (1.5.2)
|
23
18
|
rack-protection (1.5.0)
|
24
19
|
rack
|
25
20
|
rack-test (0.6.2)
|
26
21
|
rack (>= 1.0)
|
27
|
-
rake (10.0
|
28
|
-
redcarpet (2.2.2)
|
22
|
+
rake (10.1.0)
|
29
23
|
reek (1.2.13)
|
30
24
|
ripper_ruby_parser (~> 0.0.7)
|
31
25
|
ruby2ruby (~> 1.2.5)
|
@@ -35,27 +29,27 @@ GEM
|
|
35
29
|
sexp_processor (~> 3.0)
|
36
30
|
roodi (2.2.0)
|
37
31
|
ruby_parser (~> 2.3.0)
|
38
|
-
rspec (2.
|
39
|
-
rspec-core (~> 2.
|
40
|
-
rspec-expectations (~> 2.
|
41
|
-
rspec-mocks (~> 2.
|
42
|
-
rspec-core (2.
|
43
|
-
rspec-expectations (2.
|
32
|
+
rspec (2.14.1)
|
33
|
+
rspec-core (~> 2.14.0)
|
34
|
+
rspec-expectations (~> 2.14.0)
|
35
|
+
rspec-mocks (~> 2.14.0)
|
36
|
+
rspec-core (2.14.4)
|
37
|
+
rspec-expectations (2.14.0)
|
44
38
|
diff-lcs (>= 1.1.3, < 2.0)
|
45
|
-
rspec-mocks (2.
|
39
|
+
rspec-mocks (2.14.2)
|
46
40
|
ruby2ruby (1.2.5)
|
47
41
|
ruby_parser (~> 2.0)
|
48
42
|
sexp_processor (~> 3.0)
|
49
43
|
ruby_parser (2.3.1)
|
50
44
|
sexp_processor (~> 3.0)
|
51
45
|
sexp_processor (3.2.0)
|
52
|
-
sinatra (1.4.
|
53
|
-
rack (~> 1.
|
46
|
+
sinatra (1.4.3)
|
47
|
+
rack (~> 1.4)
|
54
48
|
rack-protection (~> 1.4)
|
55
49
|
tilt (~> 1.3, >= 1.3.4)
|
56
50
|
sqlite3 (1.3.7)
|
57
|
-
tilt (1.
|
58
|
-
uuidtools (2.1.
|
51
|
+
tilt (1.4.1)
|
52
|
+
uuidtools (2.1.4)
|
59
53
|
webrat (0.7.3)
|
60
54
|
nokogiri (>= 1.2.0)
|
61
55
|
rack (>= 1.0)
|
@@ -65,13 +59,11 @@ PLATFORMS
|
|
65
59
|
ruby
|
66
60
|
|
67
61
|
DEPENDENCIES
|
68
|
-
|
69
|
-
gem-release (>= 0.5.2)
|
62
|
+
gem-release (>= 0.6.0)
|
70
63
|
rack-insight!
|
71
|
-
rake
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
webrat
|
64
|
+
rake (>= 10.1.0)
|
65
|
+
reek (>= 1.2.13)
|
66
|
+
roodi (>= 2.2.0)
|
67
|
+
rspec (>= 2.14.1)
|
68
|
+
sinatra (>= 1.4.3)
|
69
|
+
webrat (>= 0.7.3)
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ Description
|
|
8
8
|
-----------
|
9
9
|
|
10
10
|
Rack::Insight adds a diagnostics toolbar to Rack apps. When enabled, it injects a floating div
|
11
|
-
allowing exploration of logging, database queries, template rendering times, etc.
|
11
|
+
allowing exploration of logging, database queries, template rendering times, etc. Rack::Insight
|
12
12
|
stores debugging info over many requests, incuding AJAX requests.
|
13
13
|
|
14
14
|
Features
|
@@ -25,7 +25,7 @@ Features
|
|
25
25
|
* Templates
|
26
26
|
* Log (can configure which loggers to watch!)
|
27
27
|
* Memory
|
28
|
-
* SQL
|
28
|
+
* SQL
|
29
29
|
* Active Record (Thanks to [Kevin Glowacz](https://github.com/kjg) for the fix!)
|
30
30
|
* Other bundled panels:
|
31
31
|
* Sphinx (thanks to Oggy for updating this to the rack-insight panel API)
|
@@ -59,7 +59,7 @@ In config/environments/development.rb, add:
|
|
59
59
|
:secret_key => "someverylongandveryhardtoguesspreferablyrandomstring"
|
60
60
|
|
61
61
|
Any environment with Rack::Insight loaded will have a link to "Rack::Insight" added to as
|
62
|
-
the last child of
|
62
|
+
the last child of `<body>` to normal responses. Clicking that link will load the
|
63
63
|
toolbar. It's set with an id of "rack-insight-enabler", so it can be styled
|
64
64
|
to go somewhere more noticeable. E.g. "position: absolute; top: 0; left: 0"
|
65
65
|
|
@@ -69,9 +69,6 @@ Using with non-Rails Rack apps
|
|
69
69
|
Just 'use Rack::Insight' as any other middleware. See the SampleApp in the
|
70
70
|
spec/fixtures folder for an example Sinatra app.
|
71
71
|
|
72
|
-
If you wish to use the logger panel define the LOGGER constant that is a ruby
|
73
|
-
Logger or ActiveSupport::BufferedLogger
|
74
|
-
|
75
72
|
Configure Rack::Insight
|
76
73
|
---------------------
|
77
74
|
|
@@ -91,11 +88,11 @@ Options:
|
|
91
88
|
|
92
89
|
:rails_log_copy - If you are setting :logger to the Rails Logger, you should set this to false (default is true).
|
93
90
|
|
94
|
-
:verbosity - true is default
|
91
|
+
:verbosity - true is default.
|
95
92
|
true is equivalent to relying soley on the logger's log level to determine if a message is logged.
|
96
93
|
Other potential values are:
|
97
94
|
anything falsey => no logging at all
|
98
|
-
Rack::Insight::
|
95
|
+
Rack::Insight::Config::VERBOSITY[*level*] where *level* is one of:
|
99
96
|
:debug, :high, :med, :low, :silent
|
100
97
|
|
101
98
|
:panel_load_paths => [File::join('rack', 'insight', 'panels')] (default)
|
@@ -206,10 +203,12 @@ Restrict access using a password:
|
|
206
203
|
|
207
204
|
#### custom file path for the request recording database ####
|
208
205
|
|
209
|
-
Rack::Insight uses SQLite to store data
|
206
|
+
Rack::Insight uses SQLite to store data across requests, and outputs a database
|
210
207
|
file in the root directory. If you need the file to be created at another
|
211
208
|
location (i.e. Heroku), you can pass a custom file path.
|
212
209
|
|
210
|
+
Please report back if you have success with this on Heroku!
|
211
|
+
|
213
212
|
ActionController::Dispatcher.middleware.use "Rack::Insight::App"
|
214
213
|
:secret_key => "someverylongandveryhardtoguesspreferablyrandomstring",
|
215
214
|
:database_path => "tmp/my_insight_db.sqlite"
|
data/lib/rack/insight/config.rb
CHANGED
@@ -1,5 +1,18 @@
|
|
1
|
+
require 'logger' # Require the standard Ruby Logger
|
2
|
+
|
1
3
|
module Rack::Insight
|
2
4
|
class Config
|
5
|
+
|
6
|
+
VERBOSITY = {
|
7
|
+
:debug => Logger::DEBUG,
|
8
|
+
:high => Logger::INFO,
|
9
|
+
:med => Logger::WARN,
|
10
|
+
:low => Logger::ERROR,
|
11
|
+
# Silent can be used with unless instead of if. Example:
|
12
|
+
# logger.info("some message") unless app.verbose(:silent)
|
13
|
+
:silent => Logger::FATAL
|
14
|
+
}
|
15
|
+
|
3
16
|
class << self
|
4
17
|
attr_reader :config, :verbosity, :log_file, :log_level, :rails_log_copy,
|
5
18
|
:filtered_backtrace, :panel_configs, :silence_magic_insight_warnings,
|
@@ -8,7 +21,7 @@ module Rack::Insight
|
|
8
21
|
@log_file = STDOUT
|
9
22
|
@log_level = ::Logger::DEBUG
|
10
23
|
@logger = nil
|
11
|
-
@verbosity =
|
24
|
+
@verbosity = nil
|
12
25
|
@rails_log_copy = true
|
13
26
|
@filtered_backtrace = true
|
14
27
|
@panel_configs = {
|
@@ -24,7 +37,11 @@ module Rack::Insight
|
|
24
37
|
Mysql2Adapter OracleEnhancedAdapter }.map do |adapter|
|
25
38
|
["ActiveRecord::ConnectionAdapters::#{adapter}", [:instance, :execute]]
|
26
39
|
end ] },
|
27
|
-
:templates => {:probes => {'ActionView::Template' => [:instance, :render]}}
|
40
|
+
:templates => {:probes => {'ActionView::Template' => [:instance, :render]}},
|
41
|
+
:redis => {:probes => defined?(Redis::Client) ?
|
42
|
+
{ 'Redis::Client' => [:instance, :call] } : # Redis >= 3.0.0
|
43
|
+
{ 'Redis' => [:instance, :call_command] } # Redis < 3.0.0
|
44
|
+
}
|
28
45
|
}
|
29
46
|
@silence_magic_insight_warnings = false
|
30
47
|
@database = {
|
@@ -43,6 +60,7 @@ module Rack::Insight
|
|
43
60
|
# end
|
44
61
|
:panel_load_paths => [File::join('rack', 'insight', 'panels')],
|
45
62
|
:logger => @logger,
|
63
|
+
:verbosity => @verbosity,
|
46
64
|
:log_file => @log_file,
|
47
65
|
:log_level => @log_level,
|
48
66
|
:rails_log_copy => @rails_log_copy, # Only has effect when logger is the Rack::Insight::Logger, or a logger behaving like it
|
@@ -74,6 +92,9 @@ module Rack::Insight
|
|
74
92
|
logger.warn("Rack::Insight::Config#configure: when logger is set, log_level and log_file have no effect, and will only confuse you.")
|
75
93
|
end
|
76
94
|
@verbosity = config[:verbosity]
|
95
|
+
if @verbosity.nil?
|
96
|
+
@verbosity = Rack::Insight::Config::VERBOSITY[:silent]
|
97
|
+
end
|
77
98
|
@filtered_backtrace = config[:filtered_backtrace]
|
78
99
|
@silence_magic_insight_warnings = config[:silence_magic_insight_warnings]
|
79
100
|
@database = config[:database]
|
@@ -105,6 +126,10 @@ module Rack::Insight
|
|
105
126
|
self.config[:panel_configs][panel_name_sym] = @panel_configs[panel_name_sym]
|
106
127
|
end
|
107
128
|
|
129
|
+
def self.verbosity
|
130
|
+
@verbosity ||= self.config[:verbosity]
|
131
|
+
end
|
132
|
+
|
108
133
|
def self.logger
|
109
134
|
@logger ||= begin
|
110
135
|
logga = self.config[:logger]
|
@@ -5,6 +5,13 @@ require 'base64'
|
|
5
5
|
module Rack::Insight
|
6
6
|
class Database
|
7
7
|
|
8
|
+
module EigenClient
|
9
|
+
def self.included(base)
|
10
|
+
base.send(:attr_accessor, :table)
|
11
|
+
base.send(:attr_accessor, :key_sql_template)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
8
15
|
# Classes including this module must define the following structure:
|
9
16
|
# class FooBar
|
10
17
|
# include Rack::Insight::Database
|
@@ -17,15 +24,16 @@ module Rack::Insight
|
|
17
24
|
# TODO: Move the has_table definition into this module's included hook.
|
18
25
|
module RequestDataClient
|
19
26
|
def key_sql_template(sql)
|
20
|
-
|
27
|
+
self.class.key_sql_template = sql
|
21
28
|
end
|
22
29
|
|
23
30
|
def table_setup(name, *keys)
|
24
31
|
self.class.has_table = true
|
25
|
-
|
32
|
+
self.class.table = DataTable.new(name, *keys)
|
26
33
|
if keys.empty?
|
27
|
-
|
34
|
+
self.class.key_sql_template = ''
|
28
35
|
end
|
36
|
+
self.class.table
|
29
37
|
end
|
30
38
|
|
31
39
|
def store(env, *keys_and_value)
|
@@ -36,19 +44,24 @@ module Rack::Insight
|
|
36
44
|
value = keys_and_value[-1]
|
37
45
|
keys = keys_and_value[0...-1]
|
38
46
|
|
39
|
-
|
47
|
+
#puts "value: #{value}"
|
48
|
+
#puts "keys: #{keys}"
|
49
|
+
#puts "table: #{self.class.table.inspect}"
|
50
|
+
#puts "@key_sql_template: #{self.class.key_sql_template}"
|
51
|
+
#puts "class: #{self.class.inspect}"
|
52
|
+
self.class.table.store(request_id, value, self.class.key_sql_template % keys)
|
40
53
|
end
|
41
54
|
|
42
55
|
def retrieve(request_id)
|
43
|
-
|
56
|
+
self.class.table.for_request(request_id)
|
44
57
|
end
|
45
58
|
|
46
59
|
def count(request_id)
|
47
|
-
|
60
|
+
self.class.table.count_for_request(request_id)
|
48
61
|
end
|
49
62
|
|
50
63
|
def table_length
|
51
|
-
|
64
|
+
self.class.table.length
|
52
65
|
end
|
53
66
|
end
|
54
67
|
|
@@ -4,6 +4,7 @@ end
|
|
4
4
|
require 'rack/insight/instrumentation/instrument'
|
5
5
|
require 'rack/insight/instrumentation/probe'
|
6
6
|
require 'rack/insight/instrumentation/client'
|
7
|
+
require 'rack/insight/instrumentation/eigen_client'
|
7
8
|
require 'rack/insight/instrumentation/setup'
|
8
9
|
require 'rack/insight/instrumentation/package-definition'
|
9
10
|
require 'rack/insight/instrumentation/probe-definition'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Rack::Insight::Instrumentation
|
2
|
+
module EigenClient
|
3
|
+
|
4
|
+
def self.included(base)
|
5
|
+
# Once a panel is probed self.is_probing should be set to true
|
6
|
+
# Panels without tables override with self.has_table = false
|
7
|
+
# check is_magic to wrap any functionality targeted at magic panels.
|
8
|
+
base.send(:attr_accessor, :is_probing)
|
9
|
+
base.send(:attr_accessor, :has_table)
|
10
|
+
base.send(:attr_accessor, :table)
|
11
|
+
base.send(:attr_accessor, :is_magic)
|
12
|
+
base.send(:attr_accessor, :template_root)
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
data/lib/rack/insight/logging.rb
CHANGED
@@ -1,14 +1,12 @@
|
|
1
|
+
require 'rack/insight/config'
|
2
|
+
|
1
3
|
module Rack::Insight
|
2
4
|
module Logging
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
# Silent can be used with unless instead of if. Example:
|
9
|
-
# logger.info("some message") unless app.verbose(:silent)
|
10
|
-
:silent => Logger::FATAL
|
11
|
-
}
|
5
|
+
|
6
|
+
def verbosity
|
7
|
+
Rack::Insight::Config.verbosity
|
8
|
+
end
|
9
|
+
module_function :verbosity
|
12
10
|
|
13
11
|
def logger
|
14
12
|
Rack::Insight::Config.logger
|
@@ -18,15 +16,15 @@ module Rack::Insight
|
|
18
16
|
# max_level is confusing because the 'level' of output goes up (and this is what max refers to)
|
19
17
|
# when the integer value goes DOWN
|
20
18
|
def verbose(max_level = false)
|
21
|
-
#logger.unknown "Rack::Insight::
|
22
|
-
return false if (!
|
23
|
-
return true if (
|
19
|
+
#logger.unknown "Rack::Insight::Logging.verbosity: #{Rack::Insight::Logging.verbosity} <= max_level: #{VERBOSITY[max_level]}" #for debugging the logger
|
20
|
+
return false if (!verbosity) # false results in Exactly Zero output!
|
21
|
+
return true if (verbosity == true) # Not checking truthy because need to check against max_level...
|
24
22
|
# Example: if configured log spam level is high (1) logger should get all messages that are not :debug (0)
|
25
23
|
# so, if a log statement has if verbose(:low) (:low is 3)
|
26
24
|
# 1 <= 3 # true => Message sent to logger
|
27
25
|
# then, if a log statement has if verbose(:debug) (:debug is 0)
|
28
26
|
# 1 <= 0 # false => Nothing sent to logger
|
29
|
-
return true if Rack::Insight::Config
|
27
|
+
return true if verbosity <= (Rack::Insight::Config::VERBOSITY[max_level]) # Integers!
|
30
28
|
end
|
31
29
|
module_function :verbose
|
32
30
|
end
|
data/lib/rack/insight/panel.rb
CHANGED
@@ -16,14 +16,19 @@ module Rack::Insight
|
|
16
16
|
|
17
17
|
attr_reader :request
|
18
18
|
|
19
|
+
# has table defaults to true for panels.
|
20
|
+
def self.has_table
|
21
|
+
self.has_table.nil? ? true : self.class.table.nil?
|
22
|
+
end
|
23
|
+
|
19
24
|
class << self
|
20
25
|
|
21
26
|
include Rack::Insight::Logging
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
+
# This will allow the following:
|
28
|
+
# p = Panel.new
|
29
|
+
# p.class.is_probing = true
|
30
|
+
include Rack::Insight::Instrumentation::EigenClient
|
31
|
+
include Rack::Insight::Database::EigenClient
|
27
32
|
|
28
33
|
def file_index
|
29
34
|
return @file_index ||= Hash.new do |h,k|
|
@@ -113,13 +118,15 @@ module Rack::Insight
|
|
113
118
|
# end
|
114
119
|
panel_name = self.underscored_name.to_sym
|
115
120
|
if self.has_custom_probes?(panel_name)
|
121
|
+
# Both formats are valid and must be supported
|
122
|
+
#config[:panel_configs][:log] = {:probes => {'Logger' => [:instance, :add]}}
|
123
|
+
#config[:panel_configs][:log] = {:probes => ['Logger', :instance, :add]}
|
116
124
|
custom_probes = Rack::Insight::Config.config[:panel_configs][panel_name][:probes]
|
117
125
|
if custom_probes.kind_of?(Hash)
|
118
126
|
probe(self) do
|
119
127
|
custom_probes.each do |klass, method_probes|
|
120
|
-
probe_type = method_probes.shift
|
121
128
|
instrument klass do
|
122
|
-
self.send("#{
|
129
|
+
self.send("#{method_probes[0]}_probe", *(method_probes[1..-1]))
|
123
130
|
end
|
124
131
|
end
|
125
132
|
end
|