tuttle 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/README.md +61 -4
  4. data/Rakefile +1 -16
  5. data/app/controllers/tuttle/active_job_controller.rb +51 -0
  6. data/app/controllers/tuttle/active_model_serializers_controller.rb +3 -8
  7. data/app/controllers/tuttle/application_controller.rb +3 -0
  8. data/app/controllers/tuttle/cancancan_controller.rb +8 -15
  9. data/app/controllers/tuttle/devise_controller.rb +1 -2
  10. data/app/controllers/tuttle/gems_controller.rb +4 -4
  11. data/app/controllers/tuttle/home_controller.rb +0 -1
  12. data/app/controllers/tuttle/paperclip_controller.rb +1 -2
  13. data/app/controllers/tuttle/rack_mini_profiler_controller.rb +15 -0
  14. data/app/controllers/tuttle/rails_controller.rb +45 -7
  15. data/app/controllers/tuttle/request_controller.rb +0 -4
  16. data/app/controllers/tuttle/ruby_controller.rb +6 -2
  17. data/app/helpers/tuttle/application_helper.rb +13 -8
  18. data/app/models/tuttle/configuration_registry.rb +25 -0
  19. data/app/models/tuttle/version_detector.rb +9 -0
  20. data/app/views/layouts/tuttle/application.html.erb +29 -20
  21. data/app/views/tuttle/active_job/index.html.erb +48 -0
  22. data/app/views/tuttle/active_model_serializers/index.html.erb +2 -0
  23. data/app/views/tuttle/gems/get_process_mem.html.erb +13 -13
  24. data/app/views/tuttle/gems/http_clients.html.erb +9 -10
  25. data/app/views/tuttle/gems/json.html.erb +3 -3
  26. data/app/views/tuttle/gems/other.html.erb +41 -11
  27. data/app/views/tuttle/home/index.html.erb +27 -23
  28. data/app/views/tuttle/{performance_tuning → rack_mini_profiler}/index.html.erb +6 -6
  29. data/app/views/tuttle/rails/_cache_dalli_store.html.erb +65 -0
  30. data/app/views/tuttle/rails/_cache_memory_store.html.erb +43 -0
  31. data/app/views/tuttle/rails/_cache_monitor.html.erb +63 -0
  32. data/app/views/tuttle/rails/assets.html.erb +181 -28
  33. data/app/views/tuttle/rails/cache.html.erb +92 -102
  34. data/app/views/tuttle/rails/database.html.erb +2 -2
  35. data/app/views/tuttle/rails/index.html.erb +20 -21
  36. data/app/views/tuttle/rails/routes.html.erb +88 -36
  37. data/app/views/tuttle/rails/schema_cache.html.erb +2 -1
  38. data/app/views/tuttle/ruby/index.html.erb +24 -20
  39. data/config/rails_config_base.yml +80 -0
  40. data/config/rails_config_v4.x.yml +14 -0
  41. data/config/rails_config_v5.x.yml +12 -0
  42. data/config/routes.rb +7 -1
  43. data/lib/tuttle.rb +3 -6
  44. data/lib/tuttle/engine.rb +24 -12
  45. data/lib/tuttle/instrumenter.rb +7 -7
  46. data/lib/tuttle/middleware/request_profiler.rb +165 -24
  47. data/lib/tuttle/presenters/action_dispatch/routing/route_wrapper.rb +7 -3
  48. data/lib/tuttle/presenters/rack_mini_profiler/client_settings.rb +27 -0
  49. data/lib/tuttle/ruby_prof/fast_call_stack_printer.rb +26 -53
  50. data/lib/tuttle/version.rb +1 -1
  51. metadata +18 -8
  52. data/app/controllers/tuttle/performance_tuning_controller.rb +0 -14
@@ -1,8 +1,10 @@
1
+ # frozen-string-literal: true
2
+
1
3
  module Tuttle
2
4
  module ApplicationHelper
3
-
4
- def truth_label(is_true, true_label='true'.freeze, false_label='false'.freeze)
5
- "<span class='label label-#{ is_true ? 'success'.freeze : 'danger'.freeze}'>#{ is_true ? true_label : false_label}</span>".html_safe
5
+ def truth_label(is_true, true_label = 'true', false_label = 'false')
6
+ content_tag(:span, is_true ? true_label : false_label,
7
+ class: ['label', is_true ? 'label-success' : 'label-danger'])
6
8
  end
7
9
 
8
10
  def tuttle_redacted(enumarator)
@@ -12,23 +14,26 @@ module Tuttle
12
14
  end
13
15
 
14
16
  def main_app_root_path
15
- main_app.respond_to?(:root_path) ? main_app.root_path : "/"
17
+ main_app.respond_to?(:root_path) ? main_app.root_path : '/'
16
18
  end
17
19
 
18
20
  def main_app_root_url
19
- main_app.respond_to?(:root_url) ? main_app.root_url : "/"
21
+ main_app.respond_to?(:root_url) ? main_app.root_url : '/'
22
+ end
23
+
24
+ def rails_guides_versioned_url(path)
25
+ "http://guides.rubyonrails.org/v#{Tuttle::VersionDetector.rails_major_minor}/#{path}"
20
26
  end
21
27
 
22
28
  private
23
29
 
24
30
  def redact_by_key(key, value)
25
31
  case key
26
- when 'password', %r/(_secret|_credentials)/
27
- '--HIDDEN--'.freeze
32
+ when 'password', /(_secret|_credentials)/
33
+ '--HIDDEN--'
28
34
  else
29
35
  value
30
36
  end
31
37
  end
32
-
33
38
  end
34
39
  end
@@ -0,0 +1,25 @@
1
+ module Tuttle
2
+ class ConfigurationRegistry
3
+
4
+ class << self
5
+ def data
6
+ @registry ||= load_data
7
+ end
8
+
9
+ private
10
+
11
+ def load_data
12
+ data_dir = Tuttle::Engine.instance.paths['config'].first
13
+
14
+ data = YAML.load_file(File.expand_path('rails_config_base.yml', data_dir))
15
+ if Rails::VERSION::MAJOR == 4
16
+ data.merge!(YAML.load_file(File.expand_path('rails_config_v4.x.yml', data_dir)))
17
+ elsif Rails::VERSION::MAJOR == 5
18
+ data.merge!(YAML.load_file(File.expand_path('rails_config_v5.x.yml', data_dir)))
19
+ end
20
+
21
+ data
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,9 @@
1
+ module Tuttle
2
+ class VersionDetector
3
+
4
+ def self.rails_major_minor
5
+ @rails_major_minor ||= Rails::VERSION::STRING.slice(0, 3)
6
+ end
7
+
8
+ end
9
+ end
@@ -5,13 +5,19 @@
5
5
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1">
7
7
  <title>Tuttle</title>
8
- <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css">
9
- <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap-theme.min.css">
8
+ <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
9
+ <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
10
+ <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous">
11
+ <%= stylesheet_link_tag "//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/styles/default.min.css" %>
12
+ <%= content_for(:stylesheets) -%>
10
13
  <link rel="icon" href="//s3.amazonaws.com/tuttle-assets/images/favicon.ico">
11
14
  <style>
12
15
  html { overflow: -moz-scrollbars-vertical; overflow-y: scroll; }
13
16
  body { padding-top: 50px; }
14
17
  table.not-wide { width: auto; }
18
+ pre code.hljs { background-color: #f5f5f5; }
19
+ a[href*="github.com"] { white-space: nowrap; }
20
+ a[href*="github.com"]:after { font-family: FontAwesome; content: "\f09b"; display: inline-block; color: initial; padding-left: 3px; }
15
21
  </style>
16
22
  <%= csrf_meta_tags %>
17
23
  </head>
@@ -35,18 +41,21 @@
35
41
  <a href="#" class="dropdown-toggle" data-toggle="dropdown">Rails <span class="caret"></span></a>
36
42
  <ul class="dropdown-menu" role="menu">
37
43
  <li><%= link_to 'Overview', rails_path %></li>
38
- <li class="divider"></li>
44
+ <li role="separator" class="divider"></li>
39
45
  <li><%= link_to 'Controllers', rails_controllers_path %></li>
40
46
  <li><%= link_to 'Models', rails_models_path %></li>
41
- <li><%= link_to 'Helpers', rails_helpers_path %></li>
42
- <li><%= link_to 'Assets', rails_assets_path %></li>
43
47
  <li><%= link_to 'Routes', rails_routes_path %></li>
44
- <li><%= link_to 'Generators', rails_generators_path %></li>
45
- <li><%= link_to 'Engines', rails_engines_path %></li>
48
+ <li><%= link_to 'Helpers', rails_helpers_path %></li>
49
+ <li role="separator" class="divider"></li>
50
+ <li><%= link_to 'Asset Pipeline', rails_assets_path %></li>
51
+ <li><%= link_to 'Caching', rails_cache_path %></li>
52
+ <li role="separator" class="divider"></li>
46
53
  <li><%= link_to 'Database', rails_database_path %></li>
47
54
  <li><%= link_to 'Schema Cache', rails_schema_cache_path %></li>
48
- <li><%= link_to 'Instrumentation', rails_instrumentation_path %></li>
49
- <li><%= link_to 'Caching', rails_cache_path %></li>
55
+ <li role="separator" class="divider"></li>
56
+ <li><%= link_to 'Generators', rails_generators_path %></li>
57
+ <li><%= link_to 'Engines', rails_engines_path %></li>
58
+ <li class="hide"><%= link_to 'Instrumentation', rails_instrumentation_path %></li>
50
59
  </ul>
51
60
  </li>
52
61
  <li class="dropdown">
@@ -64,10 +73,13 @@
64
73
  <ul class="dropdown-menu" role="menu">
65
74
  <li><%= link_to 'Overview', gems_path %></li>
66
75
  <li class="divider"></li>
67
- <%- if defined?(Devise) %>
76
+ <%- if defined?(::ActiveJob) %>
77
+ <li><%= link_to 'ActiveJob', active_job_path %></li>
78
+ <%- end %>
79
+ <%- if defined?(::Devise) %>
68
80
  <li><%= link_to 'Devise', devise_path %></li>
69
81
  <%- end %>
70
- <%- if defined?(CanCanCan) %>
82
+ <%- if defined?(::CanCanCan) %>
71
83
  <li><%= link_to 'CanCanCan', cancancan_path %></li>
72
84
  <%- end %>
73
85
  <%- if defined?(::Paperclip) %>
@@ -97,17 +109,14 @@
97
109
 
98
110
  <div class="container">
99
111
  <div class="row">
100
- <%= yield =%>
112
+ <%= yield -%>
101
113
  </div>
102
114
  </div>
103
115
 
104
- <script src="//code.jquery.com/jquery-2.1.3.min.js"></script>
105
- <script src="//maxcdn.bootstrapcdn.com/bootstrap/latest/js/bootstrap.min.js"></script>
106
- <script type="application/javascript">
107
- $(function () {
108
- $('[data-toggle="tooltip"]').tooltip();
109
- });
110
- </script>
111
- <%= content_for(:javascripts) =%>
116
+ <script src="//code.jquery.com/jquery-2.2.4.min.js" integrity="sha384-rY/jv8mMhqDabXSo+UCggqKtdmBfd3qC2/KvyTDNQ6PcUJXaxK1tMepoQda4g5vB" crossorigin="anonymous"></script>
117
+ <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
118
+ <%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.7.0/highlight.min.js" %>
119
+ <%= content_for(:javascripts) -%>
120
+ <script>hljs.initHighlightingOnLoad();</script>
112
121
  </body>
113
122
  </html>
@@ -0,0 +1,48 @@
1
+ <h1>Active Job Overview</h1>
2
+
3
+ <dl class="dl-horizontal">
4
+ <dt>Active Job Version</dt><dd><%= ActiveJob::VERSION::STRING %></dd>
5
+ </dl>
6
+
7
+ <h3>Config Settings</h3>
8
+ <table class="table table-condensed">
9
+ <tr>
10
+ <th>Setting</th>
11
+ <th>Value</th>
12
+ <th>Description</th>
13
+ </tr>
14
+ <tr>
15
+ <td>config.active_job</td>
16
+ <td><code><%= Rails.configuration.active_job %></code></td>
17
+ <td>All settings for config.active_job</td>
18
+ </tr>
19
+ <tr>
20
+ <td>config.active_job.queue_adapter</td>
21
+ <td><%= Rails.configuration.active_job.queue_adapter %></td>
22
+ <td></td>
23
+ </tr>
24
+ <tr>
25
+ <td>config.active_job.queue_name_prefix</td>
26
+ <td><%= Rails.configuration.active_job.queue_name_prefix %></td>
27
+ <td>An optional name to prepend to job queue names</td>
28
+ </tr>
29
+ </table>
30
+
31
+ <h3>Job Classes</h3>
32
+ <table class="table table-condensed">
33
+ <tr>
34
+ <th>Class</th>
35
+ <th>Queue Adapter</th>
36
+ <th>Queue</th>
37
+ <th>perform arguments</th>
38
+ </tr>
39
+ <% @job_classes.each do |job_klass| %>
40
+ <tr>
41
+ <td><code><%= job_klass.name %></code></td>
42
+ <td><code><%= job_klass.queue_adapter %></code></td>
43
+ <% # TODO: queue_name can be a Proc set with `queue_as` %>
44
+ <td><code><%= job_klass.queue_name %></code></td>
45
+ <td><code><%= job_klass.instance_method(:perform).parameters.map { |_req, var| var }.join(', ') %></code></td>
46
+ </tr>
47
+ <% end %>
48
+ </table>
@@ -54,6 +54,7 @@
54
54
  <% end %>
55
55
  </table>
56
56
 
57
+ <% if false # This seems to be in flux %>
57
58
  <h3>Adapters</h3>
58
59
  <table class="table table-condensed not-wide">
59
60
  <tr>
@@ -67,6 +68,7 @@
67
68
  </tr>
68
69
  <% end %>
69
70
  </table>
71
+ <% end %>
70
72
 
71
73
  <h3>Active Record Models</h3>
72
74
  <table class="table table-condensed not-wide">
@@ -1,11 +1,13 @@
1
1
  <h2>Process and Memory</h2>
2
+ <% if defined?(GetProcessMem) %>
2
3
  GetProcessMem Version: <%= GetProcessMem::VERSION %>
4
+ <% end %>
3
5
 
4
6
  <h3>Ruby Process Information</h3>
5
7
  <table class="table table-condensed not-wide">
6
8
  <tr>
7
9
  <th>PID</th>
8
- <td><%= $PID %></td>
10
+ <td><%= Process.pid %></td>
9
11
  </tr>
10
12
  <tr>
11
13
  <th>Parent PPID</th>
@@ -50,41 +52,39 @@ GetProcessMem Version: <%= GetProcessMem::VERSION %>
50
52
  </table>
51
53
 
52
54
 
53
- <% if defined?(GetProcessMem) %>
54
- <% memory_self = GetProcessMem.new($PID) %>
55
- <% memory_parent = GetProcessMem.new(Process.ppid) %>
55
+ <% if @memory_self %>
56
56
  <h3>GetProcessMem</h3>
57
57
  <table class="table table-condensed not-wide">
58
58
  <tr>
59
59
  <th>Linux?</th>
60
- <td><%= truth_label(memory_self.linux?) %></td>
60
+ <td><%= truth_label(@memory_self.linux?) %></td>
61
61
  </tr>
62
62
  <tr>
63
63
  <th>PID bytes</th>
64
- <td><%= memory_self.bytes %></td>
64
+ <td><%= ActiveSupport::NumberHelper.number_to_human_size(@memory_self.bytes.to_i) %></td>
65
65
  </tr>
66
66
  <tr>
67
67
  <th>PID ps_memory</th>
68
- <td><%= memory_self.send(:ps_memory) %></td>
68
+ <td><%= ActiveSupport::NumberHelper.number_to_human_size(@memory_self.send(:ps_memory).to_i) %></td>
69
69
  </tr>
70
- <% if memory_parent.respond_to?(:linux_status_memory) %>
70
+ <% if @memory_self.respond_to?(:linux_status_memory) %>
71
71
  <tr>
72
72
  <th>PID status_memory</th>
73
- <td><%= memory_self.linux_status_memory || '--Unknown--' %></td>
73
+ <td><%= @memory_self.linux_status_memory > 0 ? ActiveSupport::NumberHelper.number_to_human_size(@memory_self.linux_status_memory.to_i) : '--Unknown--' %></td>
74
74
  </tr>
75
75
  <% end %>
76
76
  <tr>
77
77
  <th>PPID bytes</th>
78
- <td><%= memory_parent.bytes %></td>
78
+ <td><%= ActiveSupport::NumberHelper.number_to_human_size(@memory_parent.bytes.to_i) %></td>
79
79
  </tr>
80
80
  <tr>
81
81
  <th>PPID ps_memory</th>
82
- <td><%= memory_parent.send(:ps_memory) %></td>
82
+ <td><%= ActiveSupport::NumberHelper.number_to_human_size(@memory_parent.send(:ps_memory).to_i) %></td>
83
83
  </tr>
84
- <% if memory_parent.respond_to?(:linux_status_memory) %>
84
+ <% if @memory_parent.respond_to?(:linux_status_memory) %>
85
85
  <tr>
86
86
  <th>PPID status_memory</th>
87
- <td><%= memory_parent.linux_status_memory || '--Unknown--' %></td>
87
+ <td><%= @memory_parent.linux_status_memory > 0 ? ActiveSupport::NumberHelper.number_to_human_size(@memory_parent.linux_status_memory.to_i) : '--Unknown--' %></td>
88
88
  </tr>
89
89
  <% end %>
90
90
  </table>
@@ -14,21 +14,20 @@
14
14
  <p>Libraries detected and loaded</p>
15
15
  <ul>
16
16
  <li>Net::HTTP (core ruby) <%= truth_label(defined?(Net::HTTP)) %></li>
17
- <li>Excon: <%= truth_label(defined?(Excon)) %></li>
18
- <li>HTTPI: <%= truth_label(defined?(HTTPI)) %></li>
19
- <li>httpclient: <%= truth_label(defined?(HTTPClient)) %></li>
20
- <li>Typhoeus: <%= truth_label(defined?(Typhoeus)) %></li>
21
- <li>Faraday: <%= truth_label(defined?(Faraday)) %>
17
+ <li><a href="https://github.com/excon/excon">Excon</a>: <%= truth_label(defined?(Excon)) %></li>
18
+ <li><a href="https://github.com/savonrb/httpi">HTTPI</a>: <%= truth_label(defined?(HTTPI)) %></li>
19
+ <li><a href="https://github.com/nahi/httpclient">httpclient</a>: <%= truth_label(defined?(HTTPClient)) %></li>
20
+ <li><a href="https://github.com/typhoeus/typhoeus">Typhoeus</a>: <%= truth_label(defined?(Typhoeus)) %></li>
21
+ <li><a href="https://github.com/lostisland/faraday">Faraday</a>: <%= truth_label(defined?(Faraday)) %>
22
22
  <%- if defined?(Faraday) %>
23
23
  &mdash; (Default adapter: <%= Faraday.default_adapter %>)
24
24
  <%- end %>
25
25
  </li>
26
- <li>Net::HTTP::Post::Multipart: <%= truth_label(defined?(Net::HTTP::Post::Multipart)) %></li>
27
- <li>Patron: <%= truth_label(defined?(Patron::Session)) %></li>
28
- <li>Savon: <%= truth_label(defined?(Savon)) %></li>
29
- <li>Event Machine HttpRequest: <%= truth_label(defined?(EventMachine::HttpRequest)) %></li>
26
+ <li><a href="https://github.com/nicksieger/multipart-post">multipart-post</a>: <%= truth_label(defined?(Net::HTTP::Post::Multipart)) %></li>
27
+ <li><a href="https://github.com/toland/patron">Patron</a>: <%= truth_label(defined?(Patron::Session)) %></li>
28
+ <li><a href="https://github.com/savonrb/savon">Savon</a>: <%= truth_label(defined?(Savon)) %></li>
29
+ <li><a href="https://github.com/igrigorik/em-http-request">Event Machine HttpRequest</a>: <%= truth_label(defined?(EventMachine::HttpRequest)) %></li>
30
30
  </ul>
31
- <p></p>
32
31
  </div>
33
32
  <div class="panel-footer">
34
33
  </div>
@@ -14,10 +14,10 @@
14
14
  <ul>
15
15
  <li>JSON Pure: <%= truth_label(defined?(JSON::Pure)) %></li>
16
16
  <li>JSON: <%= truth_label(defined?(JSON) && !defined?(JSON::Pure)) %></li>
17
- <li>Yajl: <%= truth_label(defined?(Yajl)) %></li>
18
- <li>Oj: <%= truth_label(defined?(Oj)) %></li>
17
+ <li><a href="https://github.com/brianmario/yajl-ruby">Yajl</a>: <%= truth_label(defined?(Yajl)) %></li>
18
+ <li><a href="https://github.com/ohler55/oj">Oj</a>: <%= truth_label(defined?(Oj)) %></li>
19
19
  <li>
20
- MultiJson: <%= truth_label(defined?(MultiJson)) %>
20
+ <a href="https://github.com/intridea/multi_json">MultiJson</a>: <%= truth_label(defined?(MultiJson)) %>
21
21
  <%- if defined?(MultiJson) %>
22
22
  &mdash; (Adapter: <%= MultiJson.adapter %>)
23
23
  <%- end %>
@@ -9,7 +9,7 @@
9
9
  Various gems are often included in applications to eke out a bit more performance.
10
10
  Here are various gems which may be helpful.
11
11
  </p>
12
- <p>fast_blank - <%= truth_label("TEST".methods.include?(:blank_as?), 'installed', 'not installed') %></p>
12
+ <p><a href="https://github.com/SamSaffron/fast_blank">fast_blank</a> - <%= truth_label("TEST".methods.include?(:blank_as?), 'installed', 'not installed') %></p>
13
13
  </div>
14
14
  <div class="panel-footer">
15
15
  </div>
@@ -23,11 +23,11 @@
23
23
  <p>Much of Tuttle is a work in progress. But these bits are still under development...</p>
24
24
  <ul>
25
25
  <li><%= link_to 'Request Inspector', '/tuttle/request' %></li>
26
- <% if defined?(ActiveModel::Serializers) %>
26
+ <% if defined?(ActiveModel::Serializer) || defined?(ActiveModelSerializers) %>
27
27
  <li><%= link_to 'ActiveModel Serializers', '/tuttle/active_model_serializers' %> - (0.9 and 0.10 support)</li>
28
28
  <% end %>
29
- <% if defined?(Rack::MiniProfiler) %>
30
- <li><%= link_to 'Rack::MiniProfiler', '/tuttle/performance_tuning' %></li>
29
+ <% if defined?(::Rack::MiniProfiler::ClientSettings) %>
30
+ <li><%= link_to 'Rack::MiniProfiler', rack_mini_profiler_path %></li>
31
31
  <% end %>
32
32
  </ul>
33
33
  </div>
@@ -35,6 +35,7 @@
35
35
  </div>
36
36
  </div>
37
37
 
38
+ <a id="request-profiler"></a>
38
39
  <div class="panel panel-default">
39
40
  <div class="panel-heading">
40
41
  <h3 class="panel-title">Experimental Request Profiler</h3>
@@ -63,15 +64,16 @@
63
64
  <p>Profile memory allocation using <code>memory_profiler</code> with <code>tuttle-profiler=memory_profiler</code> query param.</p>
64
65
  <p>
65
66
  Additional parameters can include:
66
- <ul>
67
- <li><code>memory_profiler_allow_files</code> - Regexp pattern for files to be included</li>
68
- <li><code>memory_profiler_ignore_files</code> - Regexp pattern for files to be ignored</li>
69
- <li><code>memory_profiler_top</code> - Number of lines to include in report (defaults to 50)</li>
70
- </ul>
71
67
  </p>
68
+ <ul>
69
+ <li><code>memory_profiler_allow_files</code> - Regexp pattern for files to be included</li>
70
+ <li><code>memory_profiler_ignore_files</code> - Regexp pattern for files to be ignored</li>
71
+ <li><code>memory_profiler_top</code> - Number of lines to include in report (defaults to 50)</li>
72
+ </ul>
72
73
  <p>Example:
73
74
  <% example_url = main_app_root_url + '?tuttle-profiler=memory_profiler' %>
74
- <%= link_to example_url, example_url %></p>
75
+ <%= link_to example_url, example_url %>
76
+ </p>
75
77
  <br/>
76
78
 
77
79
  <h4>CPU Profiling <%= truth_label(defined?(RubyProf), 'available', 'not available') %></h4>
@@ -86,7 +88,7 @@
86
88
  </ul>
87
89
  <p>Example:
88
90
  <% example_url = main_app_root_url + '?tuttle-profiler=ruby-prof&ruby-prof_printer=fast_stack' %>
89
- <%= link_to example_url, example_url %></p>
91
+ <%= link_to example_url, example_url %>
90
92
  </p>
91
93
 
92
94
  <% else %>
@@ -116,3 +118,31 @@
116
118
  <div class="panel-footer">
117
119
  </div>
118
120
  </div>
121
+
122
+ <div class="panel panel-default">
123
+ <div class="panel-heading">
124
+ <h3 class="panel-title">Facter</h3>
125
+ </div>
126
+ <div class="panel-body">
127
+ <p>
128
+ <a href="https://github.com/puppetlabs/facter">Facter</a> is a gem that will collect and display system facts.
129
+ It is typically used by Puppet separately from your application.
130
+ If the gem is available, those facts will be reported here by Tuttle.
131
+ </p>
132
+
133
+ <% if defined?(Facter) %>
134
+ <p>Facter has collected the following information:</p>
135
+ <dl class="dl-horizontal">
136
+ <% Facter.to_hash.sort.each do |k, v| %>
137
+ <dt><%= k %></dt><dd><%= v.inspect %></dd>
138
+ <% end %>
139
+ </dl>
140
+ <% else %>
141
+ <p class="alert alert-warning">
142
+ <a href="https://github.com/puppetlabs/facter">Facter</a> is not available
143
+ </p>
144
+ <p>You can optionally require this gem (even if you do not use Puppet) by adding the following to your Gemfile.</p>
145
+ <pre><code class="ruby">gem 'facter'</code></pre>
146
+ <% end %>
147
+ </div>
148
+ </div>
@@ -11,21 +11,28 @@
11
11
  <p>Version: <%= Rails::VERSION::STRING %></p>
12
12
  <p>Environment: <%= Rails.env %></p>
13
13
  <p>Root: <%= Rails.root %></p>
14
- <p>Controllers: <%= ActionController::Base.descendants.size %></p>
15
- <p>Models: <%= ActiveRecord::Base.descendants.size %></p>
14
+ <p>Database: <%= ::ActiveRecord::Base.connection.adapter_name rescue 'N/A' %></p>
15
+ <p>Caching: <%= truth_label(::ActionController::Base.send(:cache_configured?), 'Enabled', 'Disabled') %></p>
16
16
  </div>
17
17
  <div class="panel-footer">
18
- <%= link_to 'More...', rails_path %>
18
+ <%= link_to "Configuration", rails_path, :class=>['btn','btn-primary'], :role=>'button' %>
19
+ <%= link_to "Database", rails_database_path, :class=>['btn','btn-primary'], :role=>'button' %>
20
+ <%= link_to "Asset Pipeline", rails_assets_path, :class=>['btn','btn-primary'], :role=>'button' %>
21
+ <%= link_to "Caching", rails_cache_path, :class=>['btn','btn-primary'], :role=>'button' %>
19
22
  </div>
20
23
  </div>
21
24
 
22
25
  <div class="panel panel-default">
23
26
  <div class="panel-heading">
24
- <h3 class="panel-title">Tuttle Gem Helper Tools</h3>
27
+ <h3 class="panel-title">Libraries and Frameworks</h3>
25
28
  </div>
26
29
  <ul class="list-group">
30
+ <li class="list-group-item"><%= link_to 'ActiveSupport', active_support_path %></li>
31
+ <%- if defined?(::ActiveJob) %>
32
+ <li class="list-group-item"><%= link_to 'ActiveJob', active_job_path %></li>
33
+ <%- end %>
27
34
  <%- if defined?(CanCanCan) %>
28
- <li class="list-group-item"><%= link_to 'CanCan', cancancan_path %></li>
35
+ <li class="list-group-item"><%= link_to 'CanCanCan', cancancan_path %></li>
29
36
  <%- end %>
30
37
  <%- if defined?(Devise) %>
31
38
  <li class="list-group-item"><%= link_to 'Devise', devise_path %></li>
@@ -33,23 +40,19 @@
33
40
  <%- if defined?(Paperclip) %>
34
41
  <li class="list-group-item"><%= link_to 'Paperclip', paperclip_path %></li>
35
42
  <%- end %>
36
- <%- if !defined?(CanCanCan) && !defined?(Devise) && !defined?(Paperclip) %>
37
- <li class="list-group-item list-group-item-warning">None</li>
38
- <%- end %>
43
+ <li class="list-group-item"><%= link_to 'HTTP Clients', gems_http_clients_path %></li>
44
+ <li class="list-group-item"><%= link_to 'JSON', gems_json_path %></li>
39
45
  </ul>
40
46
  </div>
41
47
 
42
48
  <div class="panel panel-default">
43
49
  <div class="panel-heading">
44
- <h3 class="panel-title">Ruby</h3>
45
- </div>
46
- <div class="panel-body">
47
- <p>Version: <%= RUBY_DESCRIPTION %></p>
48
- <p>Gems: <%= Bundler.rubygems.all_specs.size %></p>
49
- </div>
50
- <div class="panel-footer">
51
- <%= link_to 'More...', ruby_path %>
50
+ <h3 class="panel-title">Performance Tuning</h3>
52
51
  </div>
52
+ <ul class="list-group">
53
+ <li class="list-group-item"><%= link_to 'Ruby VM tuning', ruby_tuning_path %></li>
54
+ <li class="list-group-item"><%= link_to 'Request Profiling', gems_other_path(:anchor => 'request-profiler') %></li>
55
+ </ul>
53
56
  </div>
54
57
 
55
58
  </div>
@@ -68,17 +71,18 @@
68
71
 
69
72
  <div class="panel panel-default">
70
73
  <div class="panel-heading">
71
- <h3 class="panel-title">Events (<%= Tuttle::Instrumenter.events.size %>)</h3>
74
+ <h3 class="panel-title">Ruby</h3>
72
75
  </div>
73
- <ul class="list-group">
74
- <% @event_counts.sort.each do |name,val| -%>
75
- <li class="list-group-item"><span class="badge"><%= val %></span><%= name %></li>
76
- <% end -%>
77
- </ul>
78
76
  <div class="panel-body">
79
- <%= link_to 'Details...', rails_instrumentation_path %>
77
+ <p>Version: <%= RUBY_DESCRIPTION %></p>
78
+ <p>Gems: <%= Bundler.rubygems.all_specs.size %></p>
79
+ </div>
80
+ <div class="panel-footer">
81
+ <%= link_to "Configuration", ruby_path, :class=>['btn','btn-primary'], :role=>'button' %>
82
+ <%= link_to "Gems", gems_path, :class=>['btn','btn-primary'], :role=>'button' %>
80
83
  </div>
81
84
  </div>
85
+
82
86
  </div>
83
87
 
84
88
  </div>