rails_mini_profiler 0.1.1 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +41 -10
  3. data/app/assets/fonts/rails_mini_profiler/LICENSE.txt +202 -0
  4. data/app/assets/fonts/rails_mini_profiler/OpenSans-Bold.ttf +0 -0
  5. data/app/assets/fonts/rails_mini_profiler/OpenSans-Regular.ttf +0 -0
  6. data/app/assets/fonts/rails_mini_profiler/OpenSans-SemiBold.ttf +0 -0
  7. data/app/assets/javascripts/rails_mini_profiler.js +2 -0
  8. data/app/assets/stylesheets/rails_mini_profiler/application.css +23 -1
  9. data/app/assets/stylesheets/rails_mini_profiler/traces.css +1 -1
  10. data/app/controllers/rails_mini_profiler/application_controller.rb +1 -1
  11. data/app/models/rails_mini_profiler/application_record.rb +1 -1
  12. data/app/views/layouts/rails_mini_profiler/application.html.erb +0 -4
  13. data/lib/generators/rails_mini_profiler/install_generator.rb +5 -0
  14. data/lib/generators/rails_mini_profiler/templates/rails_mini_profiler.rb.erb +18 -7
  15. data/lib/rails_mini_profiler.rb +29 -3
  16. data/lib/rails_mini_profiler/badge.rb +18 -1
  17. data/lib/rails_mini_profiler/configuration.rb +24 -0
  18. data/lib/rails_mini_profiler/engine.rb +3 -0
  19. data/lib/rails_mini_profiler/guard.rb +18 -7
  20. data/lib/rails_mini_profiler/logger.rb +5 -0
  21. data/lib/rails_mini_profiler/models/base_model.rb +5 -0
  22. data/lib/rails_mini_profiler/models/trace.rb +28 -0
  23. data/lib/rails_mini_profiler/redirect.rb +8 -0
  24. data/lib/rails_mini_profiler/request_context.rb +25 -6
  25. data/lib/rails_mini_profiler/storage.rb +18 -0
  26. data/lib/rails_mini_profiler/tracers.rb +1 -1
  27. data/lib/rails_mini_profiler/version.rb +1 -1
  28. data/public/rails_mini_profiler/speedscope/LICENSE +21 -0
  29. data/public/rails_mini_profiler/speedscope/demangle-cpp.1768f4cc.js +4 -0
  30. data/public/rails_mini_profiler/speedscope/demangle-cpp.1768f4cc.js.map +1 -0
  31. data/public/rails_mini_profiler/speedscope/favicon-16x16.f74b3187.png +0 -0
  32. data/public/rails_mini_profiler/speedscope/favicon-32x32.bc503437.png +0 -0
  33. data/public/rails_mini_profiler/speedscope/file-format-schema.json +324 -0
  34. data/public/rails_mini_profiler/speedscope/import.e3a73ef4.js +117 -0
  35. data/public/rails_mini_profiler/speedscope/import.e3a73ef4.js.map +1 -0
  36. data/public/rails_mini_profiler/speedscope/index.html +2 -0
  37. data/public/rails_mini_profiler/speedscope/release.txt +3 -0
  38. data/public/rails_mini_profiler/speedscope/reset.8c46b7a1.css +2 -0
  39. data/public/rails_mini_profiler/speedscope/reset.8c46b7a1.css.map +1 -0
  40. data/public/rails_mini_profiler/speedscope/source-map.438fa06b.js +24 -0
  41. data/public/rails_mini_profiler/speedscope/source-map.438fa06b.js.map +1 -0
  42. data/public/rails_mini_profiler/speedscope/speedscope.026f36b0.js +200 -0
  43. data/public/rails_mini_profiler/speedscope/speedscope.026f36b0.js.map +1 -0
  44. data/vendor/assets/javascripts/popper.js +6 -0
  45. data/vendor/assets/javascripts/tippy.js +2 -0
  46. metadata +30 -7
  47. data/lib/rails_mini_profiler/errors.rb +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 68745f57dfbd4c05a60722a699c377ec8b5eb6f101edc3259bec8134f3b8078e
4
- data.tar.gz: c28c669797fb80f92590a9b7574878c59bc0050c415b939d14936c2caf7127d1
3
+ metadata.gz: 0024a0bf06919b656615d69145f2f68cbd18cca28a1ff1358aa0a06ab0bf2955
4
+ data.tar.gz: 9d3eb7af567564dc6458125cde850d8dd5db1117e50b4bf298bc07024f2cc533
5
5
  SHA512:
6
- metadata.gz: 8c2a6559821ce43c54dd30f1f8c396734b2f8d2559b81802553a31197f7a1cdafbd7ee25756f59ea51e3b6aa4685a6184a9b8972bdc3b761e7ac4b6261724ee2
7
- data.tar.gz: 34af332d02f3e9a7de68e74a3f900b8c58c57bed9f7fcb37b4c7125e9086c57d446885d8778755d92bddcbb10cd8b5e3393c066877ca9844cffec9e712a82506
6
+ metadata.gz: 7c24ccb1d9c71acc7fa565f51d3832844e78969438080d5f849ca79734b9cbe77be0de055067f077ed07ec6f5a5d85d6e0a9ab8906adb361b126ac07bd4aa9ab
7
+ data.tar.gz: 9a440fb88d0066f1caf5d89115c1e3479dfa44bf01fe0b617f79ddc87a6ddba80365ca02a39d9154b101fc479dd3255d01ba34a6f0939ab68274a4a9390a3f68
data/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  [![Gem Version](https://badge.fury.io/rb/rails_mini_profiler.svg)](https://badge.fury.io/rb/rails_mini_profiler)
10
10
  [![Main](https://github.com/hschne/rails-mini-profiler/actions/workflows/main.yml/badge.svg)](https://github.com/hschne/rails-mini-profiler/actions/workflows/main.yml)
11
- [![Main](https://img.shields.io/github/license/hschne/rails-mini-profiler)](https://img.shields.io/github/license/hschne/rails-mini-profiler)
11
+ [![License](https://img.shields.io/github/license/hschne/rails-mini-profiler)](https://img.shields.io/github/license/hschne/rails-mini-profiler)
12
12
 
13
13
  [![Maintainability](https://api.codeclimate.com/v1/badges/1fcc2f4d01ab5bf7a260/maintainability)](https://codeclimate.com/github/hschne/rails-mini-profiler/maintainability)
14
14
  [![Test Coverage](https://api.codeclimate.com/v1/badges/1fcc2f4d01ab5bf7a260/test_coverage)](https://codeclimate.com/github/hschne/rails-mini-profiler/test_coverage)
@@ -91,17 +91,20 @@ By clicking on individual traces you can find out detailed information.
91
91
 
92
92
  ### Flamegraphs
93
93
 
94
- Rails Mini Profiler per default records Flamegraphs for every profiled request for convenience. Note that Flamegraphs recording
95
- incur a significant performance penalty, and can take up a lot of space.
94
+ Rails Mini Profiler automatically records Flamegraphs for profiled requests. To enable this feature, add [Stackprof](https://github.com/tmm1/stackprof)
95
+ to your Gemfile:
96
96
 
97
- To change the default behavior see [Configuration](#Configuration).
97
+ ```ruby
98
+ gem 'stackprof'
99
+ ```
100
+
101
+ For convenience, Flamegraphs are recorded for every request. This may incur a significant performance penalty. To change the default behavior see [Configuration](#Configuration).
98
102
 
99
- Flamegraphs are rendered using [Speedscope](https://github.com/jlfwong/speedscope). If Flamegraphs are not rendering
100
- you may have to amend your content security policy. See [Troubleshooting](#Troubleshooting)
103
+ Flamegraphs are rendered using [Speedscope](https://github.com/jlfwong/speedscope). See [Troubleshooting](#Troubleshooting) if Flamegraphs are not rendering correctly.
101
104
 
102
105
  ## Configuration
103
106
 
104
- You can set the following configuration options in Rails Mini Profiler:
107
+ Rails Mini Profiler provides a wide array of configuration options. You can find details below. For an example configuration check `initializers/rails_mini_profiler.rb` (or [the template file](https://github.com/hschne/rails-mini-profiler/blob/main/lib/generators/rails_mini_profiler/templates/rails_mini_profiler.rb.erb)).
105
108
 
106
109
  | Option | Default | Description |
107
110
  | ------------------------ | ---------------------------- | ----------------------------------------------------------------------------------------------- |
@@ -136,7 +139,7 @@ traces and requests are stored.
136
139
 
137
140
  Rails Mini Profiler does not offer an automatic way to clean up old profiling information. It is recommended you add a sweeper job to clean up old profiled requests periodically (e.g. using [clockwork](https://github.com/adamwiggins/clockwork). For example, with ActiveJob:
138
141
 
139
- ```
142
+ ```ruby
140
143
  # Clockwork
141
144
  every(1.month, 'purge rails mini profiler' do
142
145
  ProfiledRequestCleanupJob.perform_later
@@ -166,8 +169,6 @@ You may also explicitly set the user from the application itself:
166
169
 
167
170
  ```ruby
168
171
  class ApplicationController < ActionController::Base
169
- ...
170
-
171
172
  before_action do
172
173
  RailsMiniProfiler::User.authorize(current_user.id)
173
174
  end
@@ -221,6 +222,36 @@ rails rails_mini_profiler:install:migrations
221
222
  rails db:migrate
222
223
  ```
223
224
 
225
+ ### Support for API-Only Apps
226
+
227
+ Rails Mini Profiler supports API-only apps, but you have to make some small adjustments to use it. At the top of `application.rb` add [Sprockets](https://github.com/rails/sprockets-rails):
228
+
229
+ ```
230
+ require "sprockets/railtie"
231
+ ```
232
+
233
+ Then, modify `application.rb`:
234
+
235
+ ```
236
+ module ApiOnly
237
+ class Application < Rails::Application
238
+
239
+ config.api_only = true # Either set this to false
240
+ config.middleware.use ActionDispatch::Flash # Or add this
241
+ end
242
+ end
243
+ ```
244
+
245
+ **Note: Sprockets and flash are currently required for some of Rails Mini Profiler's UI features. These modifications may no longer be needed in the future.
246
+
247
+ ### No Flamegraphs are being recored?
248
+
249
+ Make sure you have added [StackProf](https://github.com/tmm1/stackprof) to your Gemfile.
250
+
251
+ ```ruby
252
+ gem 'stackprof'
253
+ ```
254
+
224
255
  ### Flamegraphs are not rendering?
225
256
 
226
257
  Flamegraphs are loaded into [Speedscope](https://github.com/jlfwong/speedscope) using an Iframe and URI Encoded blobs (see [source](https://github.com/hschne/rails-mini-profiler/blob/main/app/views/rails_mini_profiler/flamegraphs/show.html.erb))
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -12,6 +12,8 @@
12
12
  //
13
13
  //= require rails-ujs
14
14
  //= require_tree .
15
+ //= require popper
16
+ //= require tippy
15
17
 
16
18
  function setupRequestSearch() {
17
19
  const profiledRequestNameSearch = document.getElementById('profiled-request-search')
@@ -14,6 +14,27 @@
14
14
  *= require_self
15
15
  */
16
16
 
17
+ @font-face {
18
+ font-family: 'Open Sans';
19
+ font-weight: 400;
20
+ font-style: normal;
21
+ src: url('OpenSans-Regular.ttf') format("truetype");
22
+ }
23
+
24
+ @font-face {
25
+ font-family: 'Open Sans';
26
+ font-weight: 600;
27
+ font-style: normal;
28
+ src: url('OpenSans-SemiBold.ttf') format("truetype");
29
+ }
30
+
31
+ @font-face {
32
+ font-family: 'Open Sans';
33
+ font-weight: 700;
34
+ font-style: normal;
35
+ src: url('OpenSans-Bold.ttf') format("truetype");
36
+ }
37
+
17
38
  html {
18
39
  width: 100%;
19
40
  height: 100%;
@@ -49,7 +70,8 @@ html {
49
70
  --border-color: var(--grey-200);
50
71
  --text-color: var(--grey-900);
51
72
 
52
- font-family: 'Open Sans', sans-serif;
73
+ font-family: 'Open Sans', monospace;
74
+
53
75
  }
54
76
 
55
77
  body {
@@ -71,7 +71,7 @@
71
71
 
72
72
  .sequel-trace-binds {
73
73
  margin: 0 0 1em 0;
74
- padding: .5em 0;
74
+ padding: .5em 1em;
75
75
  font-size: 12px;
76
76
  overflow: auto;
77
77
  max-height: 100px;
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsMiniProfiler
4
- class ApplicationController < ::ApplicationController
4
+ class ApplicationController < ActionController::Base
5
5
  rescue_from ActiveRecord::RecordNotFound, with: :not_found
6
6
 
7
7
  before_action :check_current_user
@@ -3,7 +3,7 @@
3
3
  module RailsMiniProfiler
4
4
  class ApplicationRecord < ActiveRecord::Base
5
5
  if RailsMiniProfiler.storage_configuration.database.present?
6
- establish_connection(RailsMiniProfiler.storage_configuration.database.present?)
6
+ establish_connection(RailsMiniProfiler.storage_configuration.database)
7
7
  end
8
8
 
9
9
  self.abstract_class = true
@@ -7,10 +7,6 @@
7
7
 
8
8
  <%= javascript_include_tag "rails_mini_profiler" %>
9
9
  <%= stylesheet_link_tag "rails_mini_profiler/application", media: "all" %>
10
- <link rel="preconnect" href="https://fonts.gstatic.com">
11
- <script src="https://unpkg.com/@popperjs/core@2"></script>
12
- <script src="https://unpkg.com/tippy.js@6"></script>
13
- <link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,600;0,700;0,800;1,300;1,400;1,600;1,700;1,800&display=swap" rel="stylesheet">
14
10
  </head>
15
11
  <body>
16
12
 
@@ -1,10 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsMiniProfiler
4
+ # Generators for Rails Mini Profiler
4
5
  module Generators
6
+ # A basic installation generator to help set up users apps
5
7
  class InstallGenerator < Rails::Generators::Base
6
8
  source_root File.expand_path('templates', __dir__)
7
9
 
10
+ # Install Rails Mini Profiler to your Rails app
11
+ #
12
+ # Updates the routes file to mount the engine, adds an initializer and copies a migration.
8
13
  desc 'Install rails-mini-profiler'
9
14
  def install
10
15
  route("mount RailsMiniProfiler::Engine => '/rails_mini_profiler'")
@@ -1,13 +1,24 @@
1
1
  RailsMiniProfiler.configure do |config|
2
2
  # Customize when Rails Mini Profiler should run
3
- # config.enabled = proc { |env| Rails.env.development? || request.headers[RMP_ENABLED].present? }
3
+ config.enabled = proc { |env| Rails.env.development? || env['HTTP_RMP_ENABLED'].present? }
4
4
 
5
- # Disable Flamegraph generation
6
- # config.flamegraph_enabled = false
5
+ # Configure how hedgehog badge is rendered
6
+ config.badge_enabled = true
7
+ # config.badge_position = 'top-left'
7
8
 
8
- # Use RailsMiniProfiler::Storage::ActiveRecord to store profiles in your Database
9
- config.storage = RailsMiniProfiler::Storage
9
+ # Configure Flamegraph generation
10
+ config.flamegraph_enabled = true
11
+ # config.flamegraph_sample_rate = 0.5
10
12
 
11
- # Uncomment to customize how users are detected
12
- # config.user_provider = proc { |env| Rack::Request.new(env).ip }
13
+ # Configure endpoints to profile
14
+ config.skip_paths = []
15
+
16
+ # Configure how Rails Mini Profiler stores profiling information
17
+ # config.storage.database = :rmp_database
18
+ # config.storage.profiled_requests_table = :rmp_profiled_requests
19
+ # config.storage.traces_table = :rmp_traces
20
+ # config.storage.flamegraphs_table = :rmp_flamegraphs
21
+
22
+ # Customize how users are detected
23
+ config.user_provider = proc { |env| Rack::Request.new(env).ip }
13
24
  end