rack-mini-profiler 1.0.2 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +138 -21
  3. data/README.md +201 -94
  4. data/lib/enable_rails_patches.rb +5 -0
  5. data/lib/generators/rack_mini_profiler/USAGE +9 -0
  6. data/lib/generators/rack_mini_profiler/install_generator.rb +13 -0
  7. data/lib/generators/{rack_profiler/templates/rack_profiler.rb → rack_mini_profiler/templates/rack_mini_profiler.rb} +1 -1
  8. data/lib/generators/rack_profiler/install_generator.rb +6 -3
  9. data/lib/html/dot.1.1.2.min.js +2 -0
  10. data/lib/html/includes.css +144 -45
  11. data/lib/html/includes.js +1423 -1009
  12. data/lib/html/includes.scss +538 -441
  13. data/lib/html/includes.tmpl +231 -148
  14. data/lib/html/pretty-print.js +810 -0
  15. data/lib/html/profile_handler.js +1 -1
  16. data/lib/html/rack-mini-profiler.css +3 -0
  17. data/lib/html/rack-mini-profiler.js +2 -0
  18. data/lib/html/share.html +0 -1
  19. data/lib/html/speedscope/LICENSE +21 -0
  20. data/lib/html/speedscope/README.md +3 -0
  21. data/lib/html/speedscope/demangle-cpp.1768f4cc.js +4 -0
  22. data/lib/html/speedscope/favicon-16x16.f74b3187.png +0 -0
  23. data/lib/html/speedscope/favicon-32x32.bc503437.png +0 -0
  24. data/lib/html/speedscope/file-format-schema.json +324 -0
  25. data/lib/html/speedscope/fonts/source-code-pro-regular.css +8 -0
  26. data/lib/html/speedscope/fonts/source-code-pro-v13-regular.woff +0 -0
  27. data/lib/html/speedscope/fonts/source-code-pro-v13-regular.woff2 +0 -0
  28. data/lib/html/speedscope/import.cf0fa83f.js +115 -0
  29. data/lib/html/speedscope/index.html +2 -0
  30. data/lib/html/speedscope/release.txt +3 -0
  31. data/lib/html/speedscope/reset.8c46b7a1.css +2 -0
  32. data/lib/html/speedscope/source-map.438fa06b.js +24 -0
  33. data/lib/html/speedscope/speedscope.44364064.js +200 -0
  34. data/lib/html/vendor.js +848 -0
  35. data/lib/mini_profiler/asset_version.rb +3 -2
  36. data/lib/mini_profiler/client_settings.rb +15 -7
  37. data/lib/mini_profiler/config.rb +51 -5
  38. data/lib/mini_profiler/gc_profiler.rb +1 -1
  39. data/lib/mini_profiler/profiling_methods.rb +13 -8
  40. data/lib/mini_profiler/snapshots_transporter.rb +109 -0
  41. data/lib/mini_profiler/storage/abstract_store.rb +52 -1
  42. data/lib/mini_profiler/storage/file_store.rb +7 -3
  43. data/lib/mini_profiler/storage/memcache_store.rb +13 -7
  44. data/lib/mini_profiler/storage/memory_store.rb +98 -5
  45. data/lib/mini_profiler/storage/redis_store.rb +226 -3
  46. data/lib/mini_profiler/storage.rb +7 -0
  47. data/lib/mini_profiler/timer_struct/base.rb +2 -0
  48. data/lib/mini_profiler/timer_struct/custom.rb +1 -0
  49. data/lib/mini_profiler/timer_struct/page.rb +60 -4
  50. data/lib/mini_profiler/timer_struct/request.rb +53 -11
  51. data/lib/mini_profiler/timer_struct/sql.rb +6 -2
  52. data/lib/mini_profiler/timer_struct.rb +8 -0
  53. data/lib/mini_profiler/version.rb +2 -1
  54. data/lib/{mini_profiler/profiler.rb → mini_profiler.rb} +394 -82
  55. data/lib/mini_profiler_rails/railtie.rb +88 -7
  56. data/lib/mini_profiler_rails/railtie_methods.rb +61 -0
  57. data/lib/patches/db/activerecord.rb +1 -12
  58. data/lib/patches/db/mongo.rb +1 -1
  59. data/lib/patches/db/moped.rb +1 -1
  60. data/lib/patches/db/mysql2/alias_method.rb +30 -0
  61. data/lib/patches/db/mysql2/prepend.rb +34 -0
  62. data/lib/patches/db/mysql2.rb +4 -27
  63. data/lib/patches/db/plucky.rb +4 -4
  64. data/lib/patches/db/riak.rb +1 -1
  65. data/lib/patches/net_patches.rb +21 -10
  66. data/lib/patches/sql_patches.rb +13 -5
  67. data/lib/prepend_mysql2_patch.rb +5 -0
  68. data/lib/prepend_net_http_patch.rb +5 -0
  69. data/lib/rack-mini-profiler.rb +1 -24
  70. data/rack-mini-profiler.gemspec +17 -8
  71. metadata +156 -32
  72. data/lib/html/jquery.1.7.1.js +0 -4
  73. data/lib/html/jquery.tmpl.js +0 -486
  74. data/lib/html/list.css +0 -9
  75. data/lib/html/list.js +0 -38
  76. data/lib/html/list.tmpl +0 -34
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'fileutils'
4
+ require_relative './railtie_methods'
4
5
 
5
6
  module Rack::MiniProfilerRails
7
+ extend Rack::MiniProfilerRailsMethods
6
8
 
7
9
  # call direct if needed to do a defer init
8
10
  def self.initialize!(app)
@@ -28,10 +30,12 @@ module Rack::MiniProfilerRails
28
30
 
29
31
  if serves_static_assets?(app)
30
32
  c.skip_paths << app.config.assets.prefix
33
+ wp_assets_path = get_webpacker_assets_path()
34
+ c.skip_paths << wp_assets_path if wp_assets_path
31
35
  end
32
36
 
33
37
  unless Rails.env.development? || Rails.env.test?
34
- c.authorization_mode = :whitelist
38
+ c.authorization_mode = :allow_authorized
35
39
  end
36
40
 
37
41
  if Rails.logger
@@ -55,16 +59,92 @@ module Rack::MiniProfilerRails
55
59
 
56
60
  # Install the Middleware
57
61
  app.middleware.insert(0, Rack::MiniProfiler)
62
+ c.enable_advanced_debugging_tools = Rails.env.development?
58
63
 
59
- # Attach to various Rails methods
60
- ActiveSupport.on_load(:action_controller) do
61
- ::Rack::MiniProfiler.profile_method(ActionController::Base, :process) { |action| "Executing action: #{action}" }
64
+ if ::Rack::MiniProfiler.patch_rails?
65
+ # Attach to various Rails methods
66
+ ActiveSupport.on_load(:action_controller) do
67
+ ::Rack::MiniProfiler.profile_method(ActionController::Base, :process) { |action| "Executing action: #{action}" }
68
+ end
69
+
70
+ ActiveSupport.on_load(:action_view) do
71
+ ::Rack::MiniProfiler.profile_method(ActionView::Template, :render) { |x, y| "Rendering: #{@virtual_path}" }
72
+ end
73
+ else
74
+ subscribe("start_processing.action_controller") do |name, start, finish, id, payload|
75
+ next if !should_measure?
76
+
77
+ current = Rack::MiniProfiler.current
78
+ description = "Executing action: #{payload[:action]}"
79
+ Thread.current[get_key(payload)] = current.current_timer
80
+ Rack::MiniProfiler.current.current_timer = current.current_timer.add_child(description)
81
+ end
82
+
83
+ subscribe("process_action.action_controller") do |name, start, finish, id, payload|
84
+ next if !should_measure?
85
+
86
+ key = get_key(payload)
87
+ parent_timer = Thread.current[key]
88
+ next if !parent_timer
89
+
90
+ Thread.current[key] = nil
91
+ Rack::MiniProfiler.current.current_timer.record_time
92
+ Rack::MiniProfiler.current.current_timer = parent_timer
93
+ end
94
+
95
+ subscribe("render_partial.action_view") do |name, start, finish, id, payload|
96
+ render_notification_handler(shorten_identifier(payload[:identifier]), finish, start)
97
+ end
98
+
99
+ subscribe("render_template.action_view") do |name, start, finish, id, payload|
100
+ render_notification_handler(shorten_identifier(payload[:identifier]), finish, start)
101
+ end
102
+
103
+ if Rack::MiniProfiler.subscribe_sql_active_record
104
+ # we don't want to subscribe if we've already patched a DB driver
105
+ # otherwise we would end up with 2 records for every query
106
+ subscribe("sql.active_record") do |name, start, finish, id, payload|
107
+ next if !should_measure?
108
+ next if payload[:name] =~ /SCHEMA/ && Rack::MiniProfiler.config.skip_schema_queries
109
+
110
+ Rack::MiniProfiler.record_sql(
111
+ payload[:sql],
112
+ (finish - start) * 1000,
113
+ Rack::MiniProfiler.binds_to_params(payload[:binds])
114
+ )
115
+ end
116
+ end
62
117
  end
63
- ActiveSupport.on_load(:action_view) do
64
- ::Rack::MiniProfiler.profile_method(ActionView::Template, :render) { |x, y| "Rendering: #{@virtual_path}" }
118
+ @already_initialized = true
119
+ end
120
+
121
+ def self.create_engine
122
+ return if defined?(Rack::MiniProfilerRails::Engine)
123
+ klass = Class.new(::Rails::Engine) do
124
+ engine_name 'rack-mini-profiler'
125
+ config.assets.paths << File.expand_path('../../html', __FILE__)
126
+ config.assets.precompile << 'rack-mini-profiler.js'
127
+ config.assets.precompile << 'rack-mini-profiler.css'
65
128
  end
129
+ Rack::MiniProfilerRails.const_set("Engine", klass)
130
+ end
66
131
 
67
- @already_initialized = true
132
+ def self.subscribe(event, &blk)
133
+ if ActiveSupport::Notifications.respond_to?(:monotonic_subscribe)
134
+ ActiveSupport::Notifications.monotonic_subscribe(event) { |*args| blk.call(*args) }
135
+ else
136
+ ActiveSupport::Notifications.subscribe(event) do |name, start, finish, id, payload|
137
+ blk.call(name, start.to_f, finish.to_f, id, payload)
138
+ end
139
+ end
140
+ end
141
+
142
+ def self.get_key(payload)
143
+ "mini_profiler_parent_timer_#{payload[:controller]}_#{payload[:action]}".to_sym
144
+ end
145
+
146
+ def self.shorten_identifier(identifier)
147
+ identifier.split('/').last(2).join('/')
68
148
  end
69
149
 
70
150
  def self.serves_static_assets?(app)
@@ -95,6 +175,7 @@ module Rack::MiniProfilerRails
95
175
  middlewares = app.middleware.middlewares
96
176
  if Rack::MiniProfiler.config.suppress_encoding.nil? &&
97
177
  middlewares.include?(Rack::Deflater) &&
178
+ middlewares.include?(Rack::MiniProfiler) &&
98
179
  middlewares.index(Rack::Deflater) > middlewares.index(Rack::MiniProfiler)
99
180
  Rack::MiniProfiler.config.suppress_encoding = true
100
181
  end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rack::MiniProfilerRailsMethods
4
+ def render_notification_handler(name, finish, start, name_as_description: false)
5
+ return if !should_measure?
6
+
7
+ description = name_as_description ? name : "Rendering: #{name}"
8
+ current = Rack::MiniProfiler.current.current_timer
9
+ node = current.add_child(description)
10
+ duration = finish - start
11
+ duration_ms = duration * 1000
12
+ node.start -= duration
13
+ node[:start_milliseconds] -= duration_ms
14
+ node.record_time(duration_ms)
15
+
16
+ children_duration = 0
17
+ to_be_moved = { requests: [], sql: [], custom: {} }
18
+ current.children.each do |child|
19
+ next if child == node
20
+ if should_move?(child, node)
21
+ to_be_moved[:requests] << child
22
+ children_duration += child[:duration_milliseconds]
23
+ end
24
+ end
25
+ node[:duration_without_children_milliseconds] = duration_ms - children_duration
26
+ to_be_moved[:requests].each { |req| current.move_child(req, node) }
27
+
28
+ current.sql_timings.each do |sql|
29
+ to_be_moved[:sql] << sql if should_move?(sql, node)
30
+ end
31
+ to_be_moved[:sql].each { |sql| current.move_sql(sql, node) }
32
+
33
+ current.custom_timings.each do |type, timings|
34
+ to_be_moved[:custom] = []
35
+ timings.each do |custom|
36
+ to_be_moved[:custom] << custom if should_move?(custom, node)
37
+ end
38
+ to_be_moved[:custom].each { |custom| current.move_custom(type, custom, node) }
39
+ end
40
+ end
41
+
42
+ def should_measure?
43
+ current = Rack::MiniProfiler.current
44
+ current && current.measure
45
+ end
46
+
47
+ def should_move?(child, node)
48
+ start = :start_milliseconds
49
+ duration = :duration_milliseconds
50
+ child[start] >= node[start] &&
51
+ child[start] + child[duration] <= node[start] + node[duration]
52
+ end
53
+
54
+ def get_webpacker_assets_path
55
+ if defined?(Webpacker) && Webpacker.config.config_path.exist?
56
+ Webpacker.config.public_output_path.to_s.gsub(Webpacker.config.public_path.to_s, "")
57
+ end
58
+ end
59
+
60
+ extend self
61
+ end
@@ -15,17 +15,6 @@ module Rack
15
15
  end
16
16
  end
17
17
 
18
- def binds_to_params(binds)
19
- return if binds.nil? || Rack::MiniProfiler.config.max_sql_param_length == 0
20
- # map ActiveRecord::Relation::QueryAttribute to [name, value]
21
- params = binds.map { |c| c.kind_of?(Array) ? [c.first, c.last] : [c.name, c.value] }
22
- if (skip = Rack::MiniProfiler.config.skip_sql_param_names)
23
- params.map { |(n, v)| n =~ skip ? [n, nil] : [n, v] }
24
- else
25
- params
26
- end
27
- end
28
-
29
18
  def log_with_miniprofiler(*args, &block)
30
19
  return log_without_miniprofiler(*args, &block) unless SqlPatches.should_measure?
31
20
 
@@ -37,7 +26,7 @@ module Rack
37
26
  return rval if Rack::MiniProfiler.config.skip_schema_queries && name =~ (/SCHEMA/)
38
27
 
39
28
  elapsed_time = SqlPatches.elapsed_time(start)
40
- Rack::MiniProfiler.record_sql(sql, elapsed_time, binds_to_params(binds))
29
+ Rack::MiniProfiler.record_sql(sql, elapsed_time, Rack::MiniProfiler.binds_to_params(binds))
41
30
  rval
42
31
  end
43
32
  end
@@ -8,7 +8,7 @@ class Mongo::Server::Connection
8
8
  result, _record = SqlPatches.record_sql(args[0][0].payload.inspect) do
9
9
  dispatch_without_timing(*args, &blk)
10
10
  end
11
- return result
11
+ result
12
12
  end
13
13
 
14
14
  # TODO: change to Module#prepend as soon as Ruby 1.9.3 support is dropped
@@ -9,6 +9,6 @@ class Moped::Node
9
9
  result, _record = SqlPatches.record_sql(args[0].log_inspect) do
10
10
  process_without_profiling(*args, &blk)
11
11
  end
12
- return result
12
+ result
13
13
  end
14
14
  end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The best kind of instrumentation is in the actual db provider, however we don't want to double instrument
4
+
5
+ class Mysql2::Result
6
+ alias_method :each_without_profiling, :each
7
+ def each(*args, &blk)
8
+ return each_without_profiling(*args, &blk) unless defined?(@miniprofiler_sql_id)
9
+
10
+ start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
11
+ result = each_without_profiling(*args, &blk)
12
+ elapsed_time = SqlPatches.elapsed_time(start)
13
+
14
+ @miniprofiler_sql_id.report_reader_duration(elapsed_time)
15
+ result
16
+ end
17
+ end
18
+
19
+ class Mysql2::Client
20
+ alias_method :query_without_profiling, :query
21
+ def query(*args, &blk)
22
+ return query_without_profiling(*args, &blk) unless SqlPatches.should_measure?
23
+
24
+ result, record = SqlPatches.record_sql(args[0]) do
25
+ query_without_profiling(*args, &blk)
26
+ end
27
+ result.instance_variable_set("@miniprofiler_sql_id", record) if result
28
+ result
29
+ end
30
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Mysql2::Result
4
+ module MiniProfiler
5
+ def each(*args, &blk)
6
+ return super unless defined?(@miniprofiler_sql_id)
7
+
8
+ start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
9
+ result = super
10
+ elapsed_time = SqlPatches.elapsed_time(start)
11
+
12
+ @miniprofiler_sql_id.report_reader_duration(elapsed_time)
13
+ result
14
+ end
15
+ end
16
+
17
+ prepend MiniProfiler
18
+ end
19
+
20
+ class Mysql2::Client
21
+ module MiniProfiler
22
+ def query(*args, &blk)
23
+ return super unless SqlPatches.should_measure?
24
+
25
+ result, record = SqlPatches.record_sql(args[0]) do
26
+ super
27
+ end
28
+ result.instance_variable_set("@miniprofiler_sql_id", record) if result
29
+ result
30
+ end
31
+ end
32
+
33
+ prepend MiniProfiler
34
+ end
@@ -1,30 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # The best kind of instrumentation is in the actual db provider, however we don't want to double instrument
4
-
5
- class Mysql2::Result
6
- alias_method :each_without_profiling, :each
7
- def each(*args, &blk)
8
- return each_without_profiling(*args, &blk) unless defined?(@miniprofiler_sql_id)
9
-
10
- start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
11
- result = each_without_profiling(*args, &blk)
12
- elapsed_time = SqlPatches.elapsed_time(start)
13
-
14
- @miniprofiler_sql_id.report_reader_duration(elapsed_time)
15
- result
16
- end
17
- end
18
-
19
- class Mysql2::Client
20
- alias_method :query_without_profiling, :query
21
- def query(*args, &blk)
22
- return query_without_profiling(*args, &blk) unless SqlPatches.should_measure?
23
-
24
- result, record = SqlPatches.record_sql(args[0]) do
25
- query_without_profiling(*args, &blk)
26
- end
27
- result.instance_variable_set("@miniprofiler_sql_id", record) if result
28
- result
29
- end
3
+ if defined?(Rack::MINI_PROFILER_PREPEND_MYSQL2_PATCH)
4
+ require "patches/db/mysql2/prepend"
5
+ else
6
+ require "patches/db/mysql2/alias_method"
30
7
  end
@@ -9,19 +9,19 @@ class Plucky::Query
9
9
  alias_method :remove_without_profiling, :remove
10
10
 
11
11
  def find_each(*args, &blk)
12
- return profile_database_operation(__callee__, filtered_inspect(), *args, &blk)
12
+ profile_database_operation(__callee__, filtered_inspect(), *args, &blk)
13
13
  end
14
14
 
15
15
  def find_one(*args, &blk)
16
- return profile_database_operation(__callee__, filtered_inspect(args[0]), *args, &blk)
16
+ profile_database_operation(__callee__, filtered_inspect(args[0]), *args, &blk)
17
17
  end
18
18
 
19
19
  def count(*args, &blk)
20
- return profile_database_operation(__callee__, filtered_inspect(), *args, &blk)
20
+ profile_database_operation(__callee__, filtered_inspect(), *args, &blk)
21
21
  end
22
22
 
23
23
  def remove(*args, &blk)
24
- return profile_database_operation(__callee__, filtered_inspect(), *args, &blk)
24
+ profile_database_operation(__callee__, filtered_inspect(), *args, &blk)
25
25
  end
26
26
 
27
27
  private
@@ -2,7 +2,7 @@
2
2
 
3
3
  # riak-client 2.2.2 patches
4
4
  class Riak::Multiget
5
- class <<self
5
+ class << self
6
6
  alias_method :get_all_without_profiling, :get_all
7
7
  def get_all(client, fetch_list)
8
8
  return get_all_without_profiling(client, fetch_list) unless SqlPatches.should_measure?
@@ -1,16 +1,27 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- if (defined?(Net) && defined?(Net::HTTP))
4
-
5
- Net::HTTP.class_eval do
6
- def request_with_mini_profiler(*args, &block)
7
- request = args[0]
8
- Rack::MiniProfiler.step("Net::HTTP #{request.method} #{request.path}") do
9
- request_without_mini_profiler(*args, &block)
3
+ if ENV['RACK_MINI_PROFILER_PATCH_NET_HTTP'] != 'false'
4
+ if (defined?(Net) && defined?(Net::HTTP))
5
+ if defined?(Rack::MINI_PROFILER_PREPEND_NET_HTTP_PATCH)
6
+ module NetHTTPWithMiniProfiler
7
+ def request(request, *args, &block)
8
+ Rack::MiniProfiler.step("Net::HTTP #{request.method} #{request.path}") do
9
+ super
10
+ end
11
+ end
12
+ end
13
+ Net::HTTP.prepend(NetHTTPWithMiniProfiler)
14
+ else
15
+ Net::HTTP.class_eval do
16
+ def request_with_mini_profiler(*args, &block)
17
+ request = args[0]
18
+ Rack::MiniProfiler.step("Net::HTTP #{request.method} #{request.path}") do
19
+ request_without_mini_profiler(*args, &block)
20
+ end
21
+ end
22
+ alias request_without_mini_profiler request
23
+ alias request request_with_mini_profiler
10
24
  end
11
25
  end
12
- alias request_without_mini_profiler request
13
- alias request request_with_mini_profiler
14
26
  end
15
-
16
27
  end
@@ -11,7 +11,7 @@ class SqlPatches
11
11
  start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
12
12
  result = yield
13
13
  record = ::Rack::MiniProfiler.record_sql(statement, elapsed_time(start), parameters)
14
- return result, record
14
+ [result, record]
15
15
  end
16
16
 
17
17
  def self.should_measure?
@@ -23,18 +23,26 @@ class SqlPatches
23
23
  ((Process.clock_gettime(Process::CLOCK_MONOTONIC) - start_time).to_f * 1000).round(1)
24
24
  end
25
25
 
26
+ def self.patch_rails?
27
+ ::Rack::MiniProfiler.patch_rails?
28
+ end
29
+
26
30
  def self.sql_patches
27
31
  patches = []
28
32
 
29
33
  patches << 'mysql2' if defined?(Mysql2::Client) && Mysql2::Client.class == Class
30
34
  patches << 'pg' if defined?(PG::Result) && PG::Result.class == Class
31
35
  patches << 'oracle_enhanced' if defined?(ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter) && ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.class == Class &&
32
- SqlPatches.correct_version?('~> 1.5.0', ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter)
36
+ SqlPatches.correct_version?('~> 1.5.0', ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter) &&
37
+ patch_rails?
33
38
  # if the adapters were directly patched, don't patch again
34
- return patches unless patches.empty?
39
+ if !patches.empty?
40
+ Rack::MiniProfiler.subscribe_sql_active_record = false
41
+ return patches
42
+ end
35
43
  patches << 'sequel' if defined?(Sequel::Database) && Sequel::Database.class == Class
36
- patches << 'activerecord' if defined?(ActiveRecord) && ActiveRecord.class == Module
37
-
44
+ patches << 'activerecord' if defined?(ActiveRecord) && ActiveRecord.class == Module && patch_rails?
45
+ Rack::MiniProfiler.subscribe_sql_active_record = patches.empty? && !patch_rails?
38
46
  patches
39
47
  end
40
48
 
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rack
4
+ MINI_PROFILER_PREPEND_MYSQL2_PATCH = true
5
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rack
4
+ MINI_PROFILER_PREPEND_NET_HTTP_PATCH = true
5
+ end
@@ -1,32 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'json'
4
- require 'timeout'
5
- require 'thread'
6
- require 'securerandom'
7
-
8
3
  require 'mini_profiler/version'
9
4
  require 'mini_profiler/asset_version'
10
5
 
11
- require 'mini_profiler/timer_struct/base'
12
- require 'mini_profiler/timer_struct/page'
13
- require 'mini_profiler/timer_struct/sql'
14
- require 'mini_profiler/timer_struct/custom'
15
- require 'mini_profiler/timer_struct/client'
16
- require 'mini_profiler/timer_struct/request'
17
-
18
- require 'mini_profiler/storage/abstract_store'
19
- require 'mini_profiler/storage/memcache_store'
20
- require 'mini_profiler/storage/memory_store'
21
- require 'mini_profiler/storage/redis_store'
22
- require 'mini_profiler/storage/file_store'
23
-
24
- require 'mini_profiler/config'
25
- require 'mini_profiler/profiling_methods'
26
- require 'mini_profiler/context'
27
- require 'mini_profiler/client_settings'
28
- require 'mini_profiler/gc_profiler'
29
- require 'mini_profiler/profiler'
6
+ require 'mini_profiler'
30
7
 
31
8
  require 'patches/sql_patches'
32
9
  require 'patches/net_patches'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path('../lib', __FILE__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'mini_profiler/version'
@@ -9,7 +11,7 @@ Gem::Specification.new do |s|
9
11
  s.authors = ["Sam Saffron", "Robin Ward", "Aleks Totic"]
10
12
  s.description = "Profiling toolkit for Rack applications with Rails integration. Client Side profiling, DB profiling and Server profiling."
11
13
  s.email = "sam.saffron@gmail.com"
12
- s.homepage = "http://miniprofiler.com"
14
+ s.homepage = "https://miniprofiler.com"
13
15
  s.license = "MIT"
14
16
  s.files = [
15
17
  'rack-mini-profiler.gemspec',
@@ -19,22 +21,29 @@ Gem::Specification.new do |s|
19
21
  "CHANGELOG.md"
20
22
  ]
21
23
  s.add_runtime_dependency 'rack', '>= 1.2.0'
22
- s.required_ruby_version = '>= 2.3.0'
24
+ s.required_ruby_version = '>= 2.6.0'
23
25
 
24
26
  s.metadata = {
25
- 'source_code_uri' => 'https://github.com/MiniProfiler/rack-mini-profiler',
27
+ 'source_code_uri' => Rack::MiniProfiler::SOURCE_CODE_URI,
26
28
  'changelog_uri' => 'https://github.com/MiniProfiler/rack-mini-profiler/blob/master/CHANGELOG.md'
27
29
  }
28
30
 
29
- s.add_development_dependency 'rake', '< 11'
31
+ s.add_development_dependency 'rake'
30
32
  s.add_development_dependency 'rack-test'
31
- s.add_development_dependency 'activerecord', '~> 3.0'
32
33
  s.add_development_dependency 'dalli'
33
- s.add_development_dependency 'rspec', '~> 3.6.0'
34
+ s.add_development_dependency 'rspec', '~> 3.12.0'
34
35
  s.add_development_dependency 'redis'
35
- s.add_development_dependency 'sass'
36
- s.add_development_dependency 'flamegraph'
36
+ s.add_development_dependency 'sassc'
37
+ s.add_development_dependency 'stackprof'
37
38
  s.add_development_dependency 'rubocop'
39
+ s.add_development_dependency 'mini_racer'
40
+ s.add_development_dependency 'nokogiri'
41
+ s.add_development_dependency 'rubocop-discourse'
42
+ s.add_development_dependency 'listen'
43
+ s.add_development_dependency 'webpacker'
44
+ s.add_development_dependency 'rails', '~> 6.0'
45
+ s.add_development_dependency 'webmock', '3.9.1'
46
+ s.add_development_dependency 'rubyzip'
38
47
 
39
48
  s.require_paths = ["lib"]
40
49
  end