rack-mini-profiler 0.9.0.pre → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +154 -0
- data/README.md +138 -46
- data/lib/html/includes.css +18 -4
- data/lib/html/includes.js +99 -58
- data/lib/html/includes.less +26 -5
- data/lib/html/includes.tmpl +50 -49
- data/lib/html/list.tmpl +8 -8
- data/lib/mini_profiler/asset_version.rb +5 -0
- data/lib/mini_profiler/client_settings.rb +3 -3
- data/lib/mini_profiler/config.rb +11 -11
- data/lib/mini_profiler/gc_profiler.rb +10 -10
- data/lib/mini_profiler/profiler.rb +136 -97
- data/lib/mini_profiler/profiling_methods.rb +15 -17
- data/lib/mini_profiler/storage/file_store.rb +30 -8
- data/lib/mini_profiler/storage/memcache_store.rb +6 -7
- data/lib/mini_profiler/storage/memory_store.rb +63 -13
- data/lib/mini_profiler/storage/redis_store.rb +19 -11
- data/lib/mini_profiler/timer_struct/base.rb +33 -0
- data/lib/mini_profiler/timer_struct/client.rb +89 -0
- data/lib/mini_profiler/timer_struct/custom.rb +22 -0
- data/lib/mini_profiler/timer_struct/page.rb +62 -0
- data/lib/mini_profiler/timer_struct/request.rb +126 -0
- data/lib/mini_profiler/timer_struct/sql.rb +59 -0
- data/lib/mini_profiler/version.rb +2 -2
- data/lib/mini_profiler_rails/railtie.rb +26 -8
- data/lib/patches/db/activerecord.rb +42 -0
- data/lib/patches/db/moped.rb +12 -0
- data/lib/patches/db/mysql2.rb +30 -0
- data/lib/patches/db/pg.rb +104 -0
- data/lib/patches/db/plucky.rb +47 -0
- data/lib/patches/db/rsolr.rb +24 -0
- data/lib/patches/db/sequel.rb +10 -0
- data/lib/patches/sql_patches.rb +17 -248
- data/lib/rack-mini-profiler.rb +28 -0
- data/rack-mini-profiler.gemspec +27 -15
- metadata +159 -39
- data/CHANGELOG +0 -174
- data/lib/mini_profiler/client_timer_struct.rb +0 -78
- data/lib/mini_profiler/custom_timer_struct.rb +0 -22
- data/lib/mini_profiler/page_timer_struct.rb +0 -58
- data/lib/mini_profiler/request_timer_struct.rb +0 -115
- data/lib/mini_profiler/sql_timer_struct.rb +0 -58
- data/lib/mini_profiler/timer_struct.rb +0 -33
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6f6c4ad1e41a0b8cf00506f6c3d732a0a8ea2dc1
|
|
4
|
+
data.tar.gz: 0a4e5b357dd0473b157ba8728c069cd165fbb99f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 91b62e7d1beec331e6d104bbf3efe4b2e267c1d93e83166d3289d15798e3a777f847e8f7a0d49f138098e3fea075dcc771b13691534087c6911cf08072e157ee
|
|
7
|
+
data.tar.gz: 81115816fa927e35361804b8e8ef79148d39283cbf7b7609020dd993b811e7af4972f38b5c00d75a04f01eb3a3c1e33a2e0a3e5fbe74370efccd25694f069257
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# CHANGELOG
|
|
2
|
+
## 0.9.4 - 2014-07-08 (Sam Saffron)
|
|
3
|
+
- [UX] added a link to "more" actions in profiler
|
|
4
|
+
- [FEATURE] pp=help now displays links
|
|
5
|
+
- [FEATURE] simple memory report with pp=analyze-memory
|
|
6
|
+
|
|
7
|
+
## 0.9.2 - 2014-06-26 (Sam Saffron)
|
|
8
|
+
- [CHANGE] staging and other environments behave like production (Cedric Felizard)
|
|
9
|
+
- [DOC] CHANGELOG reorg (Olivier Lacan)
|
|
10
|
+
- [FIXED] Double calls to Rack::MiniProfilerRails.initialize! now raise an exception (Julik Tarkhanov)
|
|
11
|
+
- [FIXED] Add no-store header (George Mendoza)
|
|
12
|
+
|
|
13
|
+
## 0.9.1 - 2014-03-13 (Sam Saffron)
|
|
14
|
+
- [ADDED] Added back Ruby 1.8 support (thanks Malet)
|
|
15
|
+
- [IMPROVED] Amended Railstie so MiniProfiler can be launched with action view or action controller (Thanks Akira)
|
|
16
|
+
- [FIXED] Rails 3.0 support (thanks Zlatko)
|
|
17
|
+
- [FIXED] Possible XSS (admin only)
|
|
18
|
+
- [FIXED] Corrected Sql patching to avoid setting instance vars on nil which is frozen (thanks Andy, huoxito)
|
|
19
|
+
|
|
20
|
+
## 0.9.0.pre - 2013-12-12 (Sam Saffron)
|
|
21
|
+
- Bumped up version to reflect the stability of the project
|
|
22
|
+
- [IMPROVED] Reports for pp=profile-gc
|
|
23
|
+
- [IMPROVED] pp=flamegraph&flamegraph_sample_rate=1 , allow you to specify sampling rates
|
|
24
|
+
|
|
25
|
+
## 2013-09-17 (Ross Wilson)
|
|
26
|
+
- [IMPROVED] Instead of supressing all "/assets/" requests we now check the configured
|
|
27
|
+
config.assets.prefix path since developers can rename the path to serve Asset Pipeline
|
|
28
|
+
files from
|
|
29
|
+
|
|
30
|
+
## 2013-09-03
|
|
31
|
+
- [IMPROVED] Flamegraph now has much increased fidelity
|
|
32
|
+
- [REMOVED] Ripped out flamegraph so it can be isolated into a gem
|
|
33
|
+
- [REMOVED] Ripped out pp=sample it just was never really used
|
|
34
|
+
|
|
35
|
+
## 1.30 - 2013-08-30
|
|
36
|
+
- [ADDED] Rack::MiniProfiler.counter_method(klass,name) for injecting counters
|
|
37
|
+
- [FIXED] Counters were not shifting the table correctly
|
|
38
|
+
|
|
39
|
+
## 1.29 - 2013-08-20
|
|
40
|
+
- [ADDED] Implemented exception tracing using TracePoint see pp=trace-exceptions
|
|
41
|
+
- [FIXED] SOLR patching had an incorrect monkey patch
|
|
42
|
+
|
|
43
|
+
## 1.28 - 2012-07-18
|
|
44
|
+
- [FIXED] Diagnostics in abstract storage was raising not implemented killing
|
|
45
|
+
?pp=env and others
|
|
46
|
+
- [FIXED] SOLR xml unescaped by mistake
|
|
47
|
+
|
|
48
|
+
## 1.27 - 2013-06-26
|
|
49
|
+
- [ADDED] Rack::MiniProfiler.config.backtrace_threshold_ms
|
|
50
|
+
- [ADDED] jQuery 2.0 support
|
|
51
|
+
- [FIXED] Disabled global ajax handlers on MP requests @JP
|
|
52
|
+
|
|
53
|
+
## 1.26 - 2013-04-11
|
|
54
|
+
- [IMPROVED] Allow Rack::MiniProfilerRails.initialize!(Rails.application), for post config intialization
|
|
55
|
+
|
|
56
|
+
## 1.25 - 2013-04-08
|
|
57
|
+
- [FIXED] Missed flamegraph.html from build
|
|
58
|
+
|
|
59
|
+
## 1.24 - 2013-04-08
|
|
60
|
+
- [ADDED] Flame Graph Support see: http://samsaffron.com/archive/2013/03/19/flame-graphs-in-ruby-miniprofiler
|
|
61
|
+
- [ADDED] New toggle_shortcut and start_hidden options
|
|
62
|
+
- [ADDED] Mongoid support
|
|
63
|
+
- [ADDED] Rack::MiniProfiler.counter counter_name {}
|
|
64
|
+
- [ADDED] Net:HTTP profiling
|
|
65
|
+
- [ADDED] Ruby 1.8.7 support ... grrr
|
|
66
|
+
- [IMPROVED] More robust gc profiling
|
|
67
|
+
- [IMPROVED] Script tag initialized via data-attributes
|
|
68
|
+
- [IMPROVED] Allow usage of existing jQuery if its already loaded
|
|
69
|
+
- [IMPROVED] Pre-authorize to run in all non development? and production? modes
|
|
70
|
+
- [FIXED] AngularJS support and MooTools
|
|
71
|
+
- [FIXED] File retention leak in file_store
|
|
72
|
+
- [FIXED] HTML5 implicit <body> tags
|
|
73
|
+
- [FIXED] pp=enable
|
|
74
|
+
|
|
75
|
+
## 1.22 - 2012-09-20
|
|
76
|
+
- [FIXED] Permission issue in the gem
|
|
77
|
+
|
|
78
|
+
## 17-September-2012
|
|
79
|
+
- [IMPROVED] Allow rack-mini-profiler to be sourced from github
|
|
80
|
+
- [IMPROVED] Extracted the pp=profile-gc-time out, the object space profiler needs to disable gc
|
|
81
|
+
|
|
82
|
+
## 1.21 - 2012-09-17
|
|
83
|
+
- [ADDED] New MemchacedStore
|
|
84
|
+
- [ADDED] Rails 4 support
|
|
85
|
+
|
|
86
|
+
## 2012-09-12 (Sam Saffron)
|
|
87
|
+
- [ADDED] pp=profile-gc: allows you to profile the GC in Ruby 1.9.3
|
|
88
|
+
|
|
89
|
+
## 1.19 - 2012-09-10 (Sam Saffron)
|
|
90
|
+
- [FIXED] Compatibility issue with Ruby 1.8.7
|
|
91
|
+
|
|
92
|
+
## 1.17 - 2012-09-09 (Sam Saffron)
|
|
93
|
+
- [FIXED] pp=sample was bust unless stacktrace was installed
|
|
94
|
+
|
|
95
|
+
## 1.16 - 2012-09-05 (Sam Saffron)
|
|
96
|
+
- [IMPROVED] Implemented stacktrace properly
|
|
97
|
+
- [FIXED] Long standing problem specs (issue with memory store)
|
|
98
|
+
- [FIXED] Issue where profiler would be dumped when you got a 404 in production (and any time rails is bypassed)
|
|
99
|
+
|
|
100
|
+
## 1.15.pre - 2012-09-04 (Sam Saffron)
|
|
101
|
+
- [FIXED] Annoying bug where client settings were not sticking
|
|
102
|
+
- [FIXED] Long standing issue with Rack::ConditionalGet stopping MiniProfiler from working properly
|
|
103
|
+
|
|
104
|
+
## 1.13.pre - 2012-09-03 (Sam Saffron)
|
|
105
|
+
- [ADDED] Setting: config.backtrace_ignores = [] - an array of regexes that match on caller lines that get ignored
|
|
106
|
+
- [ADDED] Setting: config.backtrace_includes = [] - an array of regexes that get included in the trace by default
|
|
107
|
+
- [ADDED] pp=normal-backtrace to clear the "sticky" state
|
|
108
|
+
- [IMPROVED] Cleaned up the way client settings are stored
|
|
109
|
+
- [IMPROVED] Made pp=full-backtrace "sticky"
|
|
110
|
+
- [IMPROVED] Changed "pp=sample" to work with "caller" no need for stack trace gem
|
|
111
|
+
- [FIXED] pg gem prepared statements were not being logged correctly
|
|
112
|
+
|
|
113
|
+
## 1.12.pre - 2012-08-20 (Sam Saffron)
|
|
114
|
+
- [IMPROVED] Cap X-MiniProfiler-Ids at 10, otherwise the header can get killed
|
|
115
|
+
|
|
116
|
+
## 2012-08-10 (Sam Saffron)
|
|
117
|
+
- [ADDED] Basic prepared statement profiling for Postgres
|
|
118
|
+
|
|
119
|
+
## 2012-08-07 (Sam Saffron)
|
|
120
|
+
- [ADDED] Option to disable profiler for the current session (pp=disable / pp=enable)
|
|
121
|
+
- [ADDED] yajl compatability contributed by Sven Riedel
|
|
122
|
+
|
|
123
|
+
## 0.1.9 - 2012-07-30 (Sam Saffron)
|
|
124
|
+
- [IMPROVED] Made compliant with ancient versions of Rack (including Rack used by Rails2)
|
|
125
|
+
- [FIXED] Broken share link
|
|
126
|
+
- [FIXED] Crashes on startup (in MemoryStore and FileStore)
|
|
127
|
+
- [FIXED] Unicode issue
|
|
128
|
+
|
|
129
|
+
## 0.1.7 - 2012-07-18 (Sam Saffron)
|
|
130
|
+
- [ADDED] First Paint time for Google Chrome
|
|
131
|
+
- [FIXED] Ensure non Rails installs have mini profiler
|
|
132
|
+
|
|
133
|
+
## 2012-07-12 (Sam Saffron)
|
|
134
|
+
- [ADDED] Native PG and MySql2 interceptors, this gives way more accurate times
|
|
135
|
+
- [ADDED] some more client probing built in to rails
|
|
136
|
+
- [IMPROVED] Refactored context so its a proper class and not a hash
|
|
137
|
+
- [IMPROVED] More tests
|
|
138
|
+
- [FIXED] Incorrect profiling steps (was not indenting or measuring start time right
|
|
139
|
+
|
|
140
|
+
## 0.1.3 - 2012-07-09 (Sam Saffron)
|
|
141
|
+
- [ADDED] New option to display full backtraces pp=full-backtrace
|
|
142
|
+
- [IMPROVED] Cleaned up mechanism for profiling in production, all you need to do now
|
|
143
|
+
is call Rack::MiniProfiler.authorize_request to get profiling working in
|
|
144
|
+
production
|
|
145
|
+
- [IMPROVED] Cleaned up railties, got rid of the post authorize callback
|
|
146
|
+
|
|
147
|
+
## 2012-06-28 (Sam Saffron)
|
|
148
|
+
- [ADDED] Started change log
|
|
149
|
+
- [ADDED] added MemcacheStore
|
|
150
|
+
- [IMPROVED] Corrected profiler so it properly captures POST requests (was supressing non 200s)
|
|
151
|
+
- [IMPROVED] Amended Rack.MiniProfiler.config[:user_provider] to use ip addres for identity
|
|
152
|
+
- [IMPROVED] Supress all '/assets/' in the rails tie (makes debugging easier)
|
|
153
|
+
- [FIXED] Issue where unviewed missing ids never got cleared
|
|
154
|
+
- [FIXED] record_sql was mega buggy
|
data/README.md
CHANGED
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
# rack-mini-profiler
|
|
2
2
|
|
|
3
|
-
[](https://codeclimate.com/github/MiniProfiler/rack-mini-profiler) [](https://travis-ci.org/MiniProfiler/rack-mini-profiler)
|
|
4
4
|
|
|
5
5
|
Middleware that displays speed badge for every html page. Designed to work both in production and in development.
|
|
6
6
|
|
|
7
|
+
#### Features
|
|
8
|
+
|
|
9
|
+
* database profiling. Currently supports Mysql2, Postgres, and Mongoid3 (with fallback support to ActiveRecord)
|
|
10
|
+
|
|
11
|
+
#### Learn more
|
|
12
|
+
|
|
13
|
+
* [Visit our community](http://community.miniprofiler.com)
|
|
14
|
+
* [Watch the RailsCast](http://railscasts.com/episodes/368-miniprofiler)
|
|
15
|
+
* [Read about Flame graphs in rack-mini-profiler](http://samsaffron.com/archive/2013/03/19/flame-graphs-in-ruby-miniprofiler)
|
|
16
|
+
* [Read the announcement posts from 2012](http://samsaffron.com/archive/2012/07/12/miniprofiler-ruby-edition)
|
|
17
|
+
|
|
7
18
|
## rack-mini-profiler needs your help
|
|
8
19
|
|
|
9
20
|
We have decided to restructure our repository so there is a central UI repo and the various language implementation have their own.
|
|
10
21
|
|
|
11
|
-
The new home for rack-mini-profiler is https://github.com/MiniProfiler/rack-mini-profiler
|
|
12
|
-
|
|
13
22
|
**WE NEED HELP.**
|
|
14
23
|
|
|
15
24
|
- Setting up a build that reuses https://github.com/MiniProfiler/ui
|
|
16
25
|
- Migrating the internal data structures [per the spec](https://github.com/MiniProfiler/ui)
|
|
17
|
-
- Cleaning up the [horrendous class structure that is using strings as keys and crazy non-objects](https://github.com/MiniProfiler/rack-mini-profiler/blob/master/lib/mini_profiler/sql_timer_struct.rb#L36-L44)
|
|
18
|
-
- Add travis-ci testing at least MRI 1.9.3, JRuby and MRI 2.0
|
|
19
26
|
|
|
20
27
|
If you feel like taking on any of this start an issue and update us on your progress.
|
|
21
28
|
|
|
@@ -33,6 +40,28 @@ NOTE: Be sure to require rack_mini_profiler below the `pg` and `mysql` gems in y
|
|
|
33
40
|
|
|
34
41
|
All you have to do is include the Gem and you're good to go in development. See notes below for use in production.
|
|
35
42
|
|
|
43
|
+
#### Rails and manual initialization
|
|
44
|
+
|
|
45
|
+
In case you need to make sure rack_mini_profiler initialized after all other gems.
|
|
46
|
+
Or you want to execute some code before rack_mini_profiler required.
|
|
47
|
+
|
|
48
|
+
```ruby
|
|
49
|
+
gem 'rack-mini-profiler', require: false
|
|
50
|
+
```
|
|
51
|
+
Note the `require: false` part - if omitted, it will cause the Railtie for the mini-profiler to
|
|
52
|
+
be loaded outright, and an attempt to re-initialize it manually will raise an exception.
|
|
53
|
+
|
|
54
|
+
Then put initialize code in file like `config/initializers/rack_profiler.rb`
|
|
55
|
+
|
|
56
|
+
```ruby
|
|
57
|
+
if Rails.env == 'development'
|
|
58
|
+
require 'rack-mini-profiler'
|
|
59
|
+
|
|
60
|
+
# initialization is skipped so trigger it
|
|
61
|
+
Rack::MiniProfilerRails.initialize!(Rails.application)
|
|
62
|
+
end
|
|
63
|
+
```
|
|
64
|
+
|
|
36
65
|
#### Rack Builder
|
|
37
66
|
|
|
38
67
|
```ruby
|
|
@@ -53,7 +82,17 @@ class MyApp < Sinatra::Base
|
|
|
53
82
|
end
|
|
54
83
|
```
|
|
55
84
|
|
|
56
|
-
|
|
85
|
+
### Flamegraphs
|
|
86
|
+
|
|
87
|
+
To generate [flamegraphs](http://samsaffron.com/archive/2013/03/19/flame-graphs-in-ruby-miniprofiler):
|
|
88
|
+
|
|
89
|
+
* add the [**flamegraph**](https://github.com/SamSaffron/flamegraph) gem to your Gemfile
|
|
90
|
+
* visit a page in your app with `?pp=flamegraph`
|
|
91
|
+
|
|
92
|
+
Flamegraph generation is supported in MRI 2.0 and 2.1 only.
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
## Access control in production
|
|
57
96
|
|
|
58
97
|
rack-mini-profiler is designed with production profiling in mind. To enable that just run `Rack::MiniProfiler.authorize_request` once you know a request is allowed to profile.
|
|
59
98
|
|
|
@@ -66,20 +105,33 @@ def authorize
|
|
|
66
105
|
end
|
|
67
106
|
```
|
|
68
107
|
|
|
69
|
-
##
|
|
108
|
+
## Configuration
|
|
109
|
+
|
|
110
|
+
Various aspects of rack-mini-profiler's behavior can be configured when your app boots.
|
|
111
|
+
For example in a Rails app, this should be done in an initializer:
|
|
112
|
+
**config/initializers/mini_profiler.rb**
|
|
113
|
+
|
|
114
|
+
### Caching behavior
|
|
115
|
+
To fix some nasty bugs with rack-mini-profiler showing the wrong data, the middleware
|
|
116
|
+
will remove headers relating to caching (Date & Etag on responses, If-Modified-Since & If-None-Match on requests).
|
|
117
|
+
This probably won't ever break your application, but it can cause some unexpected behavior. For
|
|
118
|
+
example, in a Rails app, calls to `stale?` will always return true.
|
|
70
119
|
|
|
71
|
-
|
|
120
|
+
To disable this behavior, use the following config setting:
|
|
121
|
+
|
|
122
|
+
```ruby
|
|
123
|
+
# Do not let rack-mini-profiler disable caching
|
|
124
|
+
Rack::MiniProfiler.config.disable_caching = false # defaults to true
|
|
125
|
+
```
|
|
72
126
|
|
|
73
|
-
|
|
127
|
+
### Storage
|
|
74
128
|
|
|
75
|
-
rack-mini-profiler stores
|
|
129
|
+
rack-mini-profiler stores its results so they can be shared later and aren't lost at the end of the request.
|
|
76
130
|
|
|
77
131
|
There are 4 storage options: `MemoryStore`, `RedisStore`, `MemcacheStore`, and `FileStore`.
|
|
78
132
|
|
|
79
133
|
`FileStore` is the default in Rails environments and will write files to `tmp/miniprofiler/*`. `MemoryStore` is the default otherwise.
|
|
80
134
|
|
|
81
|
-
To change the default you can create a file in `config/initializers/mini_profiler.rb`
|
|
82
|
-
|
|
83
135
|
```ruby
|
|
84
136
|
# set MemoryStore
|
|
85
137
|
Rack::MiniProfiler.config.storage = Rack::MiniProfiler::MemoryStore
|
|
@@ -98,7 +150,7 @@ RedisStore/MemcacheStore work in multi process and multi machine environments (R
|
|
|
98
150
|
|
|
99
151
|
Additionally you may implement an AbstractStore for your own provider.
|
|
100
152
|
|
|
101
|
-
|
|
153
|
+
### User result segregation
|
|
102
154
|
|
|
103
155
|
MiniProfiler will attempt to keep all user results isolated, out-of-the-box the user provider uses the ip address:
|
|
104
156
|
|
|
@@ -114,35 +166,59 @@ Rack::MiniProfiler.config.user_provider = Proc.new{ |env| CurrentUser.get(env) }
|
|
|
114
166
|
|
|
115
167
|
The string this function returns should be unique for each user on the system (for anonymous you may need to fall back to ip address)
|
|
116
168
|
|
|
117
|
-
|
|
169
|
+
### Configuration Options
|
|
118
170
|
|
|
171
|
+
You can set configuration options using the configuration accessor on `Rack::MiniProfiler`.
|
|
172
|
+
For example:
|
|
173
|
+
|
|
174
|
+
```ruby
|
|
175
|
+
Rack::MiniProfiler.config.position = 'right'
|
|
176
|
+
Rack::MiniProfiler.config.start_hidden = true
|
|
119
177
|
```
|
|
120
|
-
|
|
121
|
-
$ rake spec
|
|
122
|
-
```
|
|
178
|
+
The available configuration options are:
|
|
123
179
|
|
|
124
|
-
|
|
180
|
+
* pre_authorize_cb - A lambda callback you can set to determine whether or not mini_profiler should be visible on a given request. Default in a Rails environment is only on in development mode. If in a Rack app, the default is always on.
|
|
181
|
+
* position - Can either be 'right' or 'left'. Default is 'left'.
|
|
182
|
+
* skip_paths - Specifies path list that can be skipped.
|
|
183
|
+
* skip_schema_queries - Whether or not you want to log the queries about the schema of your tables. Default is 'false', 'true' in rails development.
|
|
184
|
+
* auto_inject (default true) - when false the miniprofiler script is not injected in the page
|
|
185
|
+
* backtrace_filter - a regex you can use to filter out unwanted lines from the backtraces
|
|
186
|
+
* toggle_shortcut (default Alt+P) - a jquery.hotkeys.js-style keyboard shortcut, used to toggle the mini_profiler's visibility. See https://github.com/jeresig/jquery.hotkeys for more info.
|
|
187
|
+
* start_hidden (default false) - Whether or not you want the mini_profiler to be visible when loading a page
|
|
188
|
+
* backtrace_threshold_ms (default zero) - Minimum SQL query elapsed time before a backtrace is recorded. Backtrace recording can take a couple of milliseconds on rubies earlier than 2.0, impacting performance for very small queries.
|
|
189
|
+
* flamegraph_sample_rate (default 0.5ms) - How often fast_stack should get stack trace info to generate flamegraphs
|
|
125
190
|
|
|
126
|
-
|
|
191
|
+
### Custom middleware ordering (required if using `Rack::Deflate` with Rails)
|
|
127
192
|
|
|
128
|
-
|
|
193
|
+
If you are using `Rack::Deflate` with rails and rack-mini-profiler in its default configuration,
|
|
194
|
+
`Rack::MiniProfiler` will be injected (as always) at position 0 in the middleware stack. This
|
|
195
|
+
will result in it attempting to inject html into the already-compressed response body. To fix this,
|
|
196
|
+
the middleware ordering must be overriden.
|
|
129
197
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
Rack::MiniProfiler
|
|
140
|
-
|
|
141
|
-
Rack::MiniProfiler.config.flamegraph_sample_rate = 1
|
|
198
|
+
To do this, first add `, require: false` to the gemfile entry for rack-mini-profiler.
|
|
199
|
+
This will prevent the railtie from running. Then, customize the initialization
|
|
200
|
+
in the initializer like so:
|
|
201
|
+
|
|
202
|
+
```ruby
|
|
203
|
+
require 'rack-mini-profiler'
|
|
204
|
+
|
|
205
|
+
Rack::MiniProfilerRails.initialize!(Rails.application)
|
|
206
|
+
|
|
207
|
+
Rails.application.middleware.delete(Rack::MiniProfiler)
|
|
208
|
+
Rails.application.middleware.insert_after(Rack::Deflater, Rack::MiniProfiler)
|
|
142
209
|
```
|
|
143
210
|
|
|
211
|
+
Deleting the middleware and then reinserting it is a bit inelegant, but
|
|
212
|
+
a sufficient and costless solution. It is possible that rack-mini-profiler might
|
|
213
|
+
support this scenario more directly if it is found that
|
|
214
|
+
there is significant need for this confriguration or that
|
|
215
|
+
the above recipe causes problems.
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
## Special query strings
|
|
219
|
+
|
|
220
|
+
If you include the query string `pp=help` at the end of your request you will see the various options available. You can use these options to extend or contract the amount of diagnostics rack-mini-profiler gathers.
|
|
144
221
|
|
|
145
|
-
In a Rails app, this can be done conveniently in an initializer such as config/initializers/mini_profiler.rb.
|
|
146
222
|
|
|
147
223
|
## Rails 2.X support
|
|
148
224
|
|
|
@@ -163,7 +239,7 @@ c.storage_options = {:path => tmp}
|
|
|
163
239
|
c.storage = ::Rack::MiniProfiler::FileStore
|
|
164
240
|
config.middleware.use(::Rack::MiniProfiler)
|
|
165
241
|
::Rack::MiniProfiler.profile_method(ActionController::Base, :process) {|action| "Executing action: #{action}"}
|
|
166
|
-
::Rack::MiniProfiler.profile_method(ActionView::Template, :render) {|x,y| "Rendering: #{
|
|
242
|
+
::Rack::MiniProfiler.profile_method(ActionView::Template, :render) {|x,y| "Rendering: #{path_without_format_and_extension}"}
|
|
167
243
|
|
|
168
244
|
# monkey patch away an activesupport and json_pure incompatability
|
|
169
245
|
# http://pivotallabs.com/users/alex/blog/articles/1332-monkey-patch-of-the-day-activesupport-vs-json-pure-vs-ruby-1-8
|
|
@@ -174,19 +250,35 @@ if JSON.const_defined?(:Pure)
|
|
|
174
250
|
end
|
|
175
251
|
```
|
|
176
252
|
|
|
177
|
-
##
|
|
253
|
+
## Running the Specs
|
|
254
|
+
|
|
255
|
+
```
|
|
256
|
+
$ rake build
|
|
257
|
+
$ rake spec
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Additionally you can also run `autotest` if you like.
|
|
178
261
|
|
|
179
|
-
|
|
180
|
-
* position - Can either be 'right' or 'left'. Default is 'left'.
|
|
181
|
-
* skip_schema_queries - Whether or not you want to log the queries about the schema of your tables. Default is 'false', 'true' in rails development.
|
|
182
|
-
* auto_inject (default true) - when false the miniprofiler script is not injected in the page
|
|
183
|
-
* backtrace_filter - a regex you can use to filter out unwanted lines from the backtraces
|
|
184
|
-
* toggle_shortcut (default Alt+P) - a jquery.hotkeys.js-style keyboard shortcut, used to toggle the mini_profiler's visibility. See http://code.google.com/p/js-hotkeys/ for more info.
|
|
185
|
-
* start_hidden (default false) - Whether or not you want the mini_profiler to be visible when loading a page
|
|
186
|
-
* backtrace_threshold_ms (default zero) - Minimum SQL query elapsed time before a backtrace is recorded. Backtrace recording can take a couple of milliseconds on rubies earlier than 2.0, impacting performance for very small queries.
|
|
187
|
-
* flamegraph_sample_rate (default 0.5ms) - How often fast_stack should get stack trace info to generate flamegraphs
|
|
262
|
+
## Licence
|
|
188
263
|
|
|
189
|
-
|
|
264
|
+
The MIT License (MIT)
|
|
190
265
|
|
|
191
|
-
|
|
266
|
+
Copyright (c) 2013 Sam Saffron
|
|
267
|
+
|
|
268
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
269
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
270
|
+
in the Software without restriction, including without limitation the rights
|
|
271
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
272
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
273
|
+
furnished to do so, subject to the following conditions:
|
|
274
|
+
|
|
275
|
+
The above copyright notice and this permission notice shall be included in
|
|
276
|
+
all copies or substantial portions of the Software.
|
|
192
277
|
|
|
278
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
279
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
280
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
281
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
282
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
283
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
284
|
+
THE SOFTWARE.
|
data/lib/html/includes.css
CHANGED
|
@@ -149,6 +149,21 @@
|
|
|
149
149
|
.profiler-result .profiler-queries .profiler-stack-trace {
|
|
150
150
|
margin-bottom: 15px;
|
|
151
151
|
}
|
|
152
|
+
.profiler-result .profiler-queries tbody tr {
|
|
153
|
+
border-bottom: 1px solid #f1f1f1;
|
|
154
|
+
}
|
|
155
|
+
.profiler-result .profiler-queries tr {
|
|
156
|
+
background-color: #FFF;
|
|
157
|
+
}
|
|
158
|
+
.profiler-result .profiler-queries tr.slow {
|
|
159
|
+
background-color: #FEE;
|
|
160
|
+
}
|
|
161
|
+
.profiler-result .profiler-queries tr.very-slow {
|
|
162
|
+
background-color: #FDD;
|
|
163
|
+
}
|
|
164
|
+
.profiler-result .profiler-queries tr.very-very-slow {
|
|
165
|
+
background-color: #FCC;
|
|
166
|
+
}
|
|
152
167
|
.profiler-result .profiler-queries pre {
|
|
153
168
|
font-family: Consolas, monospace, serif;
|
|
154
169
|
white-space: pre-wrap;
|
|
@@ -163,14 +178,10 @@
|
|
|
163
178
|
.profiler-result .profiler-queries td {
|
|
164
179
|
padding: 15px;
|
|
165
180
|
text-align: left;
|
|
166
|
-
background-color: #fff;
|
|
167
181
|
}
|
|
168
182
|
.profiler-result .profiler-queries td:last-child {
|
|
169
183
|
padding-right: 25px;
|
|
170
184
|
}
|
|
171
|
-
.profiler-result .profiler-queries .profiler-odd td {
|
|
172
|
-
background-color: #e5e5e5;
|
|
173
|
-
}
|
|
174
185
|
.profiler-result .profiler-queries .profiler-since-start,
|
|
175
186
|
.profiler-result .profiler-queries .profiler-duration {
|
|
176
187
|
text-align: right;
|
|
@@ -384,6 +395,9 @@
|
|
|
384
395
|
padding: 0px;
|
|
385
396
|
margin: 0px;
|
|
386
397
|
}
|
|
398
|
+
.profiler-results .profiler-more-actions {
|
|
399
|
+
float: left;
|
|
400
|
+
}
|
|
387
401
|
.profiler-queries-bg {
|
|
388
402
|
z-index: 2147483642;
|
|
389
403
|
display: none;
|