rack-mini-profiler 0.1.21 → 0.1.26
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.
Potentially problematic release.
This version of rack-mini-profiler might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/Ruby/CHANGELOG +135 -0
- data/{README.md → Ruby/README.md} +40 -9
- data/Ruby/lib/html/flamegraph.html +325 -0
- data/Ruby/lib/html/includes.css +451 -0
- data/{lib → Ruby/lib}/html/includes.js +135 -24
- data/{lib → Ruby/lib}/html/includes.less +38 -35
- data/{lib → Ruby/lib}/html/includes.tmpl +40 -15
- data/{lib → Ruby/lib}/html/jquery.1.7.1.js +1 -1
- data/{lib → Ruby/lib}/html/jquery.tmpl.js +1 -1
- data/{lib → Ruby/lib}/html/list.css +0 -0
- data/{lib → Ruby/lib}/html/list.js +7 -6
- data/{lib → Ruby/lib}/html/list.tmpl +0 -0
- data/Ruby/lib/html/profile_handler.js +1 -0
- data/{lib → Ruby/lib}/html/share.html +0 -0
- data/{lib → Ruby/lib}/mini_profiler/client_settings.rb +0 -0
- data/{lib → Ruby/lib}/mini_profiler/client_timer_struct.rb +1 -1
- data/{lib → Ruby/lib}/mini_profiler/config.rb +57 -52
- data/{lib → Ruby/lib}/mini_profiler/context.rb +11 -10
- data/Ruby/lib/mini_profiler/custom_timer_struct.rb +22 -0
- data/Ruby/lib/mini_profiler/flame_graph.rb +54 -0
- data/{lib → Ruby/lib}/mini_profiler/gc_profiler.rb +35 -12
- data/{lib → Ruby/lib}/mini_profiler/page_timer_struct.rb +7 -2
- data/{lib → Ruby/lib}/mini_profiler/profiler.rb +209 -144
- data/{lib → Ruby/lib}/mini_profiler/profiling_methods.rb +131 -108
- data/{lib → Ruby/lib}/mini_profiler/request_timer_struct.rb +20 -1
- data/{lib → Ruby/lib}/mini_profiler/sql_timer_struct.rb +0 -0
- data/{lib → Ruby/lib}/mini_profiler/storage/abstract_store.rb +31 -27
- data/{lib → Ruby/lib}/mini_profiler/storage/file_store.rb +111 -109
- data/{lib → Ruby/lib}/mini_profiler/storage/memcache_store.rb +11 -9
- data/{lib → Ruby/lib}/mini_profiler/storage/memory_store.rb +65 -63
- data/Ruby/lib/mini_profiler/storage/redis_store.rb +54 -0
- data/{lib → Ruby/lib}/mini_profiler/timer_struct.rb +0 -0
- data/Ruby/lib/mini_profiler/version.rb +5 -0
- data/Ruby/lib/mini_profiler_rails/railtie.rb +89 -0
- data/Ruby/lib/patches/net_patches.rb +14 -0
- data/{lib → Ruby/lib}/patches/sql_patches.rb +89 -48
- data/{lib → Ruby/lib}/rack-mini-profiler.rb +1 -0
- data/rack-mini-profiler.gemspec +6 -4
- metadata +53 -64
- data/CHANGELOG +0 -99
- data/lib/html/includes.css +0 -75
- data/lib/html/profile_handler.js +0 -62
- data/lib/mini_profiler/storage/redis_store.rb +0 -44
- data/lib/mini_profiler_rails/railtie.rb +0 -85
@@ -1,44 +0,0 @@
|
|
1
|
-
module Rack
|
2
|
-
class MiniProfiler
|
3
|
-
class RedisStore < AbstractStore
|
4
|
-
|
5
|
-
EXPIRE_SECONDS = 60 * 60 * 24
|
6
|
-
|
7
|
-
def initialize(args)
|
8
|
-
args ||= {}
|
9
|
-
@prefix = args[:prefix] || 'MPRedisStore'
|
10
|
-
end
|
11
|
-
|
12
|
-
def save(page_struct)
|
13
|
-
redis.setex "#{@prefix}#{page_struct['Id']}", EXPIRE_SECONDS, Marshal::dump(page_struct)
|
14
|
-
end
|
15
|
-
|
16
|
-
def load(id)
|
17
|
-
raw = redis.get "#{@prefix}#{id}"
|
18
|
-
if raw
|
19
|
-
Marshal::load raw
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def set_unviewed(user, id)
|
24
|
-
redis.sadd "#{@prefix}-#{user}-v", id
|
25
|
-
end
|
26
|
-
|
27
|
-
def set_viewed(user, id)
|
28
|
-
redis.srem "#{@prefix}-#{user}-v", id
|
29
|
-
end
|
30
|
-
|
31
|
-
def get_unviewed_ids(user)
|
32
|
-
redis.smembers "#{@prefix}-#{user}-v"
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
|
-
def redis
|
38
|
-
require 'redis' unless defined? Redis
|
39
|
-
Redis.new
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,85 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
module MiniProfilerRails
|
4
|
-
|
5
|
-
class Railtie < ::Rails::Railtie
|
6
|
-
|
7
|
-
initializer "rack_mini_profiler.configure_rails_initialization" do |app|
|
8
|
-
c = Rack::MiniProfiler.config
|
9
|
-
|
10
|
-
# By default, only show the MiniProfiler in development mode, in production allow profiling if post_authorize_cb is set
|
11
|
-
c.pre_authorize_cb = lambda { |env|
|
12
|
-
Rails.env.development? || Rails.env.production?
|
13
|
-
}
|
14
|
-
|
15
|
-
c.skip_paths ||= []
|
16
|
-
|
17
|
-
if Rails.env.development?
|
18
|
-
c.skip_paths << "/assets/"
|
19
|
-
c.skip_schema_queries = true
|
20
|
-
end
|
21
|
-
|
22
|
-
if Rails.env.production?
|
23
|
-
c.authorization_mode = :whitelist
|
24
|
-
end
|
25
|
-
|
26
|
-
# The file store is just so much less flaky
|
27
|
-
tmp = Rails.root.to_s + "/tmp/miniprofiler"
|
28
|
-
FileUtils.mkdir_p(tmp) unless File.exists?(tmp)
|
29
|
-
|
30
|
-
c.storage_options = {:path => tmp}
|
31
|
-
c.storage = Rack::MiniProfiler::FileStore
|
32
|
-
|
33
|
-
# Quiet the SQL stack traces
|
34
|
-
c.backtrace_remove = Rails.root.to_s + "/"
|
35
|
-
c.backtrace_includes = [/^\/?(app|config|lib|test)/]
|
36
|
-
c.skip_schema_queries = Rails.env != 'production'
|
37
|
-
|
38
|
-
# Install the Middleware
|
39
|
-
app.middleware.insert(0, Rack::MiniProfiler)
|
40
|
-
|
41
|
-
# Attach to various Rails methods
|
42
|
-
::Rack::MiniProfiler.profile_method(ActionController::Base, :process) {|action| "Executing action: #{action}"}
|
43
|
-
::Rack::MiniProfiler.profile_method(ActionView::Template, :render) {|x,y| "Rendering: #{@virtual_path}"}
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
# TODO: Implement something better here
|
48
|
-
# config.after_initialize do
|
49
|
-
#
|
50
|
-
# class ::ActionView::Helpers::AssetTagHelper::JavascriptIncludeTag
|
51
|
-
# alias_method :asset_tag_orig, :asset_tag
|
52
|
-
# def asset_tag(source,options)
|
53
|
-
# current = Rack::MiniProfiler.current
|
54
|
-
# return asset_tag_orig(source,options) unless current
|
55
|
-
# wrapped = ""
|
56
|
-
# unless current.mpt_init
|
57
|
-
# current.mpt_init = true
|
58
|
-
# wrapped << Rack::MiniProfiler::ClientTimerStruct.init_instrumentation
|
59
|
-
# end
|
60
|
-
# name = source.split('/')[-1]
|
61
|
-
# wrapped << Rack::MiniProfiler::ClientTimerStruct.instrument(name, asset_tag_orig(source,options)).html_safe
|
62
|
-
# wrapped
|
63
|
-
# end
|
64
|
-
# end
|
65
|
-
|
66
|
-
# class ::ActionView::Helpers::AssetTagHelper::StylesheetIncludeTag
|
67
|
-
# alias_method :asset_tag_orig, :asset_tag
|
68
|
-
# def asset_tag(source,options)
|
69
|
-
# current = Rack::MiniProfiler.current
|
70
|
-
# return asset_tag_orig(source,options) unless current
|
71
|
-
# wrapped = ""
|
72
|
-
# unless current.mpt_init
|
73
|
-
# current.mpt_init = true
|
74
|
-
# wrapped << Rack::MiniProfiler::ClientTimerStruct.init_instrumentation
|
75
|
-
# end
|
76
|
-
# name = source.split('/')[-1]
|
77
|
-
# wrapped << Rack::MiniProfiler::ClientTimerStruct.instrument(name, asset_tag_orig(source,options)).html_safe
|
78
|
-
# wrapped
|
79
|
-
# end
|
80
|
-
# end
|
81
|
-
|
82
|
-
# end
|
83
|
-
|
84
|
-
end
|
85
|
-
end
|